Skip to content

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

@robdobsn

Description

@robdobsn

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])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions