-
Notifications
You must be signed in to change notification settings - Fork 1
Vision System Serial Protocol
UART messages sent from the Xavier Jetson, our vision platform, to the RoboMaster Type A Board (MCB) will be a string of bytes in the following format:
Starting offset (bytes) | Length (bytes) | Name | Description |
---|---|---|---|
0 | 1 | Header | constant 0xA5 |
1 | 1 | Data Length [0] | length of data to be read in bytes, n. 8 LSB |
2 | 1 | Data Length [1] | length of data to be read in bytes, n. 8 MSB |
3 | 2 | Sequence Number | byte is incremented each time a message is sent |
5 | 1 | Message Type [0] | a user-chosen "type" flag. 8 LSB |
6 | 1 | Message Type [1] | a user-chosen "type" flag. 8 MSB |
7 | n | Data | The actual data sent |
Note that optional CRC bytes have been omitted as they are currently note used while communicating with the vision system. They are used only with referee system communication.
For RX, a general message is parsed into a SerialMessage
struct upon arrival. For TX, a
SerialMessage
is constructed and then transmitted. The generic struct is as follows:
struct SerialMessage
{
uint8_t headByte; ///< Use SERIAL_HEAD_BYTE.
uint16_t length; ///< Must be less than SERIAL_RX_BUFF_SIZE.
uint16_t type; ///< The type is specified and interpreted upon arrival.
uint8_t data[SERIAL_RX_BUFF_SIZE];
modm::Timestamp messageTimestamp; ///< The timestamp is in milliseconds.
uint8_t sequenceNumber; ///< Increment this for debugging purposes.
};
Below are the specifications for the different type of messages:
This message is sent from the Jetson to the MCB.
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x05 |
2 | Data Length [1] | 0x00 |
5 | Message type [0] | 0x01 |
6 | Message type [1] | 0x00 |
7 | pitch[0] | MSB of pitch to 1 decimal place * 10 |
8 | pitch[1] | LSB of pitch to 1 decimal place * 10 |
9 | yaw[0] | MSB of yaw to 1 decimal place * 10 |
10 | yaw[0] | LSB of yaw to 1 decimal place * 10 |
11 | has_target | 1 if target acquired, 0 otherwise |
To send turret bearings to the MCB, take the targeted pitch and yaw angles (in degrees), multiply by 10, then truncate to integers.
Data to be sent: pitch=12.6, yaw=68.0
Multiply pitch by 10 and you get 126, multiply yaw by 10 and you get 690.
Hex Representation of 126 is 0x007E, 680 is 0x02AB
Final Message:
0x69 0x01 0x00 0x04 0x00 0x7E 0x02 0xB2
This message is sent from the MCB to the Jetson. It, along with the other messages below are interleaved and sent round robin style.
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x04 |
2 | Data Length [1] | 0x00 |
5 | Message type [0] | 0x01 |
6 | Message type [1] | 0x00 |
7 | pitch[0] | MSB of pitch to 1 decimal place * 10 |
8 | pitch[1] | LSB of pitch to 1 decimal place * 10 |
9 | yaw[0] | MSB of yaw to 1 decimal place * 10 |
10 | yaw[0] | LSB of yaw to 1 decimal place * 10 |
Turret bearings feedback from the MCB are pitch and yaw angles (in degrees) are multiplied by 10, then truncate to integers.
This message is sent from the MCB to the Jetson. The telemetry data includes IMU angles, gyro, and accel data, as well as chassis wheel velocity.
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x1A |
2 | Data Length [1] | 0x00 |
5 | Message type [0] | 0x02 |
6 | Message type [1] | 0x00 |
7 | x_accel[0] | LSB of x accel to 2 decimal place * 100 |
8 | x_accel[1] | MSB of x accel to 2 decimal place * 100 |
9 | y_accel[0] | LSB of y accel to 2 decimal place * 100 |
10 | y_accel[1] | MSB of y accel to 2 decimal place * 100 |
11 | z_accel[0] | LSB of z accel to 2 decimal place * 100 |
12 | z_accel[1] | MSB of z accel to 2 decimal place * 100 |
13 | imu_roll[0] | LSB of IMU roll calculation to 2 decimal place * 100 |
14 | imu_roll[1] | MSB of IMU roll calculation to 2 decimal place * 100 |
15 | imu_pitch[0] | LSB of IMU pitch calculation to 2 decimal place * 100 |
16 | imu_pitch[1] | MSB of IMU pitch calculation to 2 decimal place * 100 |
17 | imu_yaw[0] | LSB of IMU yaw calculation to 2 decimal place * 100 |
18 | imu_yaw[1] | MSB of IMU yaw calculation to 2 decimal place * 100 |
19 | x_gyro[0] | LSB of x gyro to 2 decimal place * 100 |
20 | x_gyro[1] | MSB of x gyro to 2 decimal place * 100 |
21 | y_gyro[0] | LSB of y gyro to 2 decimal place * 100 |
22 | y_gyro[1] | MSB of y gyro to 2 decimal place * 100 |
23 | z_gyro[0] | LSB of z gyro to 2 decimal place * 100 |
24 | z_gyro[1] | MSB of z gyro to 2 decimal place * 100 |
25 | rightFrontWheelRPM[0], | LSB of the right front wheel's RPM |
26 | rightFrontWheelRPM[1] | MSB of the right front wheel's RPM |
27 | leftFrontWheelRPM[0], | LSB of the left front wheel's RPM |
28 | leftFrontWheelRPM[1] | MSB of the left front wheel's RPM |
29 | leftBackWheeRPM[0], | LSB of the left back wheel's RPM |
30 | leftBackWheeRPM[1] | MSB of the left back wheel's RPM |
31 | rightBackWheelRPM[0] | LSB of the right back wheel's RPM |
32 | rightBackWheelRPM[1] | MSB of the right back wheel's RPM |
Accel data in meters per second squared and gyro data in degrees per second are multiplied by 100, then truncated to a 16 bit integer.
This message is sent from the MCB to the Jetson.
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x01 |
2 | Data Length [1] | 0x00 |
5 | Message type [0] | 0x04 |
6 | Message type [1] | 0x00 |
7 | robot_type[0] | Raw robot type, per referee system specification |
This message is sent from the MCB to the Jetson.
This message is used to either request an aim request or cease requesting auto aim requests (see first message). This is the only message not sent every round robin iteration. It is only sent if an aim request has been queued.
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x01 |
2 | Data Length [1] | 0x00 |
5 | Message type [0] | 0x05 |
6 | Message type [1] | 0x00 |
7 | request_cv[0] | 0 for cease request, 1 for new auto aim request |
This wiki is specific to the RoboMaster robotics competition open source software award. Refer to our GitLab wiki instead if you would like to contribute.
Compilation and Installation
Block Diagrams
Theoretical Support Analysis
Software Architecture or Hierarchy Diagram
Embedded Debugging Tools
Miscellaneous