In RIC we only use the basic formatting of the ROSSerial protocol and not the publish/subscribe mechanism of ROS. In ROSSerial message formats are predefined and must be understood by both both RIC and the interface software.
A rosserial packet looks like this:
1st Byte - Sync Flag (Value: 0xff) 2nd Byte - Sync Flag / Protocol version 3rd Byte - Message Length (N) - Low Byte 4th Byte - Message Length (N) - High Byte 5th Byte - Checksum over message length 6th Byte - Topic ID - Low Byte 7th Byte - Topic ID - High Byte x Bytes - Serialized Message Data Byte x+1 - Checksum over Topic ID and Message Data |
The ROSSerial format is described in more detail on the ROS wiki
Marty 2 ROSSerial messages are different from Marty 1 and Marty 1 messages are not supported by Marty 2.
Topic Name | Msg Type | Description |
---|---|---|
smart_servos Code: 120 | SmartServo [] SmartServo:
| An array of smart servo info each 6 bytes long IDNo is the index of the motor in the order described elsewhere with Left Hip == 0 position is an int16, same format as commanded positions, -32768 indicates an unknown value motorCurrent in milliamps, -32768 indicates an unknown value status byte is as reported by the servo |
accel Code 121 | ( | The x,y,z of the built in accelerometer |
power_status Code 122 | uint8 uint8 uint16 uint16 int16 uint16 uint16 powerFlags | Power status information Remaining capacity percentage (0..100) Battery temperature degC Remaining capacity mAh Battery fully charged mAh Current in mA, +ve means charging Time 5V has been on for in seconds Power Flags: bit 0 == on USB power bit 1 == 5V is turned on bit 2 == battery info is NOT valid bit 3 == USB power info is NOT valid |
add_ons | AddOnInfo [] AddOnInfo: uint8 IDNo uint8 StatusFlags uint8 [10] RecentData | An array of add-on info each 12 bytes long IDNo is the IDNo of the add-on see hwstatus information for ordering but note this is dynamically allocated Status Flags: bit 7 (mask 0x80) indicates data is fresh (0 indicates stale) RecentData is the 10 bytes most recently read from the add-on during polling |
robot_status (orginal 2 byte message) New 24 byte message: added to RIC Firmware in 2021 NOTE: martypy and other interfaces need to be able to cope with both message lengths | uint8 MotionFlags uint8 queueLen uint32 heapFree uint32 heapMin uint32 pix0_RGBT uint32 pix1_RGBT uint32 pix2_RGBT uint8 sysManLoopMsAvg uint8 sysManLoopMsMax | MotionFlags: bit 0 ROBOT_IS_MOVING bit 1 ROBOT_IS_PAUSED bit 2 FIRMWARE_UPDATE_IN_PROGRESS number of queued work items (255 indicates >=255) heap free space in bytes heap minimum (lower watermark) bytes RGBT means RGB (big endian) value in 1st 3 bytes and pixel state in last byte where 0 == off, 1 == on, 2 == breath, 3 == override average and max ms for SysManager loop (main service loop). 255 indicates >= 255 |