Vision System Serial Protocol - MatthewMArnold/taproot GitHub Wiki
Auto aim target update messages will contain information on whether a valid target exists and the target's position, velocity, and acceleration at a certain point in time as specified by the timestamp.
Position, Velocity, and Acceleration values are in reference to the odometry/world frame.
- Target Position:
Will be stored as a
Positionobject with a x, y, and z coordinate. - Target Velocity:
Will be stored as a
Vectorobject with a x, y, and z coordinate. - Target Acceleration:
Will be stored as a
Vectorobject with a x, y, and z coordinate. - Valid Target Flag:
Will be stored as a boolean:
Trueif a valid target is detected,Falseotherwise - Time:
Will be stored as a
Timestamprepresenting the MCB time in microseconds at which this target information was recorded. - Fire Rate:
Will be stored as a
FireRateenumeration object with a value from 0 to 3 (inclusive).
Auto Aim Target Update messages are stored in byte format where offset is from the left and the data is stored in little endian format.
| Offset | Data | Size | Datatype |
|---|---|---|---|
| 0 | Position (x) | 4 bytes | float |
| 4 | Position (y) | 4 bytes | float |
| 8 | Position (z) | 4 bytes | float |
| 12 | Velocity (x) | 4 bytes | float |
| 16 | Velocity (y) | 4 bytes | float |
| 20 | Velocity (z) | 4 bytes | float |
| 24 | Acceleration (x) | 4 bytes | float |
| 28 | Acceleration (y) | 4 bytes | float |
| 32 | Acceleration (z) | 4 bytes | float |
| 36 | Valid Target Flag (has_target) | 1 byte | boolean |
| 37 | Timestamp (time_microsecs) | 4 bytes | int |
| 38 | Fire Rate (value) | 1 byte | unsigned char |
Odometry messages will contain information on the chassis position and pitch/yaw/roll and the pitch/yaw of each turret at a certain point in time as specified by the timestamp.
- Time:
Will be stored as a
MCB Timestamprepresenting the time in microseconds at which this odometry information was recorded. - Chassis position:
Will be stored as a
Positionclass with a x, y, and z coordinate. - Chassis pitch/yaw/roll: Stored as floats representing the orientation of the chassis (independently from the turrets) in radians.
- Number of turrets: Indicates the number of turret pitch/yaw pairs that are in the message.
There can be an arbitrary number of pitch/yaw pairs:
- Turret Pitch:
Will be stored as a
floatrepresenting the angle from the plane parallel to the ground. - Turret Yaw:
Will be stored as a
floatbetween 0 and 360 representing the counterclockwise rotation angle from a pre-established origin.
Odometry messages can be stored in byte format where offset is from the left and the data is stored in little endian format.
| Offset | Data | Size | Datatype |
|---|---|---|---|
| 0 | Timestamp (time_microsecs) | 4 bytes | int |
| 4 | Position (x) | 4 bytes | float |
| 8 | Position (y) | 4 bytes | float |
| 12 | Position (z) | 4 bytes | float |
| 16 | Chassis Pitch | 4 bytes | float |
| 20 | Chassis Yaw | 4 bytes | float |
| 24 | Chassis Roll | 4 bytes | float |
| 28 | Number of turrets | 1 bytes | int |
| 29 | Turret 1 Time | 4 bytes | int |
| 33 | Turret 1 Pitch | 4 bytes | float |
| 37 | Turret 1 Yaw | 4 bytes | float |
| 41 | Turret 2 Time | 4 bytes | int |
| 45 | Turret 2 Pitch | 4 bytes | float |
| 49 | Turret 2 Yaw | 4 bytes | float |
| ... | (continued turret pitch/yaw pairs) | float |
Sent at 1Hz from MCB to Jetson.
| Offset | Data | Size | Datatype | Notes |
|---|---|---|---|---|
| 0 | Competition Type and Stage | 1 byte | Two 4-bit integers: 0-3 bit: Competition type - 1 = RoboMaster Competitions - 2 = RoboMaster University Technical Challenge - 3 = ICRA RoboMaster University AI Challenge - 4 = RoboMaster University League 3V3 Confrontation - 5 = RoboMaster University League Standard Confrontation 4-7 bit: Current stage - 0 = Pre-competition stage - 1 = Setup period - 2 = Initialization stage - 3 = 5-second countdown - 4 = In combat - 5 = calculating competition results |
|
| 1 | Remaining time in current round (seconds) | 2 bytes | int | |
| 3 | Unix time of competition status update | 8 bytes | int | |
| 11 | Main controller power supply condition | 1 byte | 3 bits: (0 = no 24V output, 1 = 24V output) - 0 bit: output from gimbal port - 1 bit: output from chassis port - 2 bit: output from shooter port |
Data is actually updated at 10Hz from the referee system, but we only transmit from MCB to Jetson at 1Hz. Example of byte format: if data is True, False, True, byte content should be 00000101. (padding on left, fill bits from least significant bit first) |
Sent when the competition ends.
| Offset | Data | Size | Datatype |
|---|---|---|---|
| 0 | Competition result | 1 byte | int - 0 = Draw - 1 = Red Team victory - 2 = Blue Team victory |
Sent when our team receives a warning from the referee system.
| Offset | Data | Size | Datatype |
|---|---|---|---|
| 0 | Warning level | 1 byte | int - 1 = Yellow Card - 2 = Red Card - 3 = Forfeiture |
| 1 | Foul robot ID | 1 byte | int - When receiving a punitive forfeiture, robot ID = 0. - When receiving Yellow Card or Red Card, robot ID is the foul robot ID. |
MCB receives this data at 10Hz from referee, but MCB only sends a message to Jetson when there is a change detected in the value.
| Offset | Data | Size | Datatype |
|---|---|---|---|
| 0 | Current robot ID | 1 byte | int - 1 = Red Team hero robot - 2 = Red Team engineer robot - 3/4/5 = Red Team standard robot - 6 = Red Team aerial robot - 7 = Red Team sentry robot - 8 = Red Team dart robot - 9 = Red Team radar station - 101 = Blue Team hero robot - 102 = Blue Team engineer robot - 103/104/105 = Blue Team standard robot - 106 = Blue Team aerial robot - 107 = Blue Team sentry robot - 108 = Blue Team dart robot - 109 = Blue Team radar station |
Select new target messages represents a request from the MCB for a new target selection to be done. This message will come with a request id.
- request_id: a unique ID, aside from eventual wrap-around, representing this selection command
4-byte unsigned integer.
Sent when the robot needs to be shutdown.
Sent when the robot needs to reboot.