Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

martypy should accommodate ROSSERIAL messages of differing lengths to allow for message extension #35

Open
robdobsn opened this issue Jun 2, 2021 · 0 comments

Comments

@robdobsn
Copy link
Contributor

robdobsn commented Jun 2, 2021

martypy does not handle variable length ROSSERIAL messages. Hence it is not currently possible to accommodate additional fields in these messages - which are added to the end of the message - without martypy breaking. martypy should be updated to accommodate variable length ROSSERIAL messages.

For instance this code - currently at line 162 in RICROSSerial.py:

def extractRobotStatus(cls, buf: bytes) -> Dict:
        robotStat = struct.unpack(">BB", buf)

This fails if the size of buf is not exactly 2 bytes. It should be changed to something like (where cls.ROS_ROBOT_STATUS_BYTES is the number of bytes in the default size message)

    if len(buf) >= cls.ROS_ROBOT_STATUS_BYTES:
        robotStat = struct.unpack(">BBIIIIIBB", buf[0:cls.ROS_ROBOT_STATUS_BYTES])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant