bmegli / cave-crawler-mcu

cave-crawler microcontroller firmware code (Teensy 3.5)
GNU General Public License v3.0
0 stars 0 forks source link

USB/serial communication protocol #3

Open bmegli opened 6 years ago

bmegli commented 6 years ago

Design and implement communication protocol for handling serial/USB communication.

MCU <--> higher level controller

Requirements:

Document the protocol on wiki

bmegli commented 5 years ago

The packet structure

Start Byte Size Type Payload End Byte
bytes 1 1 1 type dependent 1
value fixed 0xFB 0-255 defined set type dependent fixed 0xFC

Types

Preliminary

Type Value Payload bytes Info
ODOMETRY 0x01 28 encoders and IMU quaternions
XV11LIDAR 0x02 15 lidar data
RPLIDARA3 0x03 138 compressed ultra capsules, sequence

ODOMETRY

Timestamp Left encoder Right encoder QW QX QY QZ
bytes 4 4 4 4 4 4 4
type uint32 int32 int32 float float float float
unit us counts counts quaternion quaternion quaternion quaternion

XV11LIDAR

Timestamp Angle quad Speed64 Distances x 4 [mm]
bytes 4 1 2 8
type uint32 uint8_t uint16_t uint16_t x 4 (array)
unit us 0,89 for 0-3,356-359 rpm = Speed/64 flag, distances or error_code

RPLIDARA3

Timestamp Device ID Sequence Data
bytes 4 1 1 132
type uint32 uint8 uint8 ultra_capsules
unit us ID counts RPLidarA3 internal