For version v0.1, the I2C protocol use for message parsing is very simple. As of right now, the I2C messages consist of 32 bytes in which the first byte corresponds to an ID, and the remaining 31 bytes can be used to send data. Future implementations can be considered, such as using an extended header with additional information, CRC or other checkusm features, etc.
The structure of the message is as follows:
| Field | Size (in bytes) | Description |
|---|---|---|
| ID | 1 | Messge identifiers: |
MOTOR_SPEEDS: specific speeds to set for each one of the 4 motors of the rover. Speeds are expressed using 2 bytes for each motor, using an integer of 16 bits (2 bytes or int16). The speed is expressed as a percentage, related to PWM duty cycle duration(i.e. -100%-100%), and it is multiplied by a factor of 100 (so a speed of 56.65% would correspond to a raw value of 5665).
The raw body message would look something like:
| Motor 1 Speed MSB | Motor 1 Speed LSB | … | Motor 4 Speed MSB | Motor 4 Speed LSB |
|---|---|---|---|---|
| Msg Byte 2 | Msg byte 3 | Msg byte 8 | Msg byte 9 |
For version v0.1, the standard for BT messages is also kept very simple. This standard provides a bit more flexibility, and it is meant to simplify the implementation of new GUI-BT functionalities in the future. The message can have a size of up to 1024 bytes. The structure of the BT message is as follows:
| Field | Size (in bytes) | Description |
|---|---|---|
| ID | 1 | Messge identifiers: |