-
Notifications
You must be signed in to change notification settings - Fork 11
Serial Data Protocol
Kaelin Laundry edited this page Aug 24, 2019
·
1 revision
UART messages sent between the MCB and the Jetson 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 MSB |
2 | 1 | Data Length [1] | length of data to be read in bytes, n. 8 LSB |
3 | 2 | Blank | blank |
5 | 1 | Message Type [0] | a user-chosen "type" flag. 8 MSB |
6 | 1 | Message Type [1] | a user-chosen "type" flag. 8 LSB |
7 | n | Data | The actual data sent |
Below are the specifications for the different type of messages:
Jetson-> MCB
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x00 |
2 | Data Length [1] | 0x04 |
5 | Message type [0] | 0x00 |
6 | Message type [1] | 0x01 |
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 |
To send turret bearings to the MCB, take the targeted pitch and yaw angles (in degrees) and multiply by 10, then truncate to integers.
Data to be sent: pitch=12.6, yaw=69.0
Multiply pitch by 10 and you get 126, multiply yaw by 10 and you get 690.
Hex Representation of 126 is 0x007E, 690 is 0x02B2
Final Message:
0x69 0x01 0x00 0x04 0x00 0x7E 0x02 0xB2
MCB -> Jetson
Idx | Attribute | Value |
---|---|---|
1 | Data Length [0] | 0x00 |
2 | Data Length [1] | 0x04 |
5 | Message type [0] | 0x00 |
6 | Message type [1] | 0x01 |
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) multiplied by 10, then truncate to integers.