Protocol#

group drv_protocol

Definitions and implementations of the DotBot protocol.

Author

Alexandre Abadie alexandre.abadie@inria.fr

Copyright

Inria, 2022

Defines

DB_FIRMWARE_VERSION#

Version of the firmware.

DB_SWARM_ID#

Default swarm ID.

DB_BROADCAST_ADDRESS#

Broadcast address.

DB_GATEWAY_ADDRESS#

Gateway address.

DB_MAX_WAYPOINTS#

Max number of waypoints.

Enums

enum command_type_t#

Command type.

Values:

enumerator DB_PROTOCOL_CMD_MOVE_RAW#

Move raw command type.

enumerator DB_PROTOCOL_CMD_RGB_LED#

RGB LED command type.

enumerator DB_PROTOCOL_LH2_RAW_DATA#

Lighthouse 2 raw data.

enumerator DB_PROTOCOL_LH2_LOCATION#

Lighthouse processed locations.

enumerator DB_PROTOCOL_ADVERTISEMENT#

DotBot advertisements.

enumerator DB_PROTOCOL_GPS_LOCATION#

GPS data from SailBot.

enumerator DB_PROTOCOL_DOTBOT_DATA#

DotBot specific data (for now location and direction)

enumerator DB_PROTOCOL_CONTROL_MODE#

Robot remote control mode (automatic or manual)

enumerator DB_PROTOCOL_LH2_WAYPOINTS#

List of LH2 waypoints to follow.

enumerator DB_PROTOCOL_GPS_WAYPOINTS#

List of GPS waypoints to follow.

enumerator DB_PROTOCOL_SAILBOT_DATA#

SailBot specific data (for now GPS and direction)

enumerator DB_PROTOCOL_CMD_XGO_ACTION#

XGO action command.

enumerator DB_PROTOCOL_LH2_PROCESSED_DATA#

Lighthouse 2 data processed at the DotBot.

enumerator DB_PROTOCOL_TDMA_UPDATE_TABLE#

Receive new timings for the TDMA table.

enumerator DB_PROTOCOL_TDMA_SYNC_FRAME#

Sent by the gateway at the beginning of a TDMA frame.

enumerator DB_PROTOCOL_TDMA_KEEP_ALIVE#

Sent by the client if there is nothing else to send.

enum application_type_t#

Application type.

Values:

enumerator DotBot#

DotBot application.

enumerator SailBot#

SailBot application.

enumerator FreeBot#

FreeBot application.

enumerator XGO#

XGO application.

enumerator LH2_mini_mote#

LH2 mini mote application.

enum protocol_control_mode_t#

Control mode.

Values:

enumerator ControlManual#

Manual mode.

enumerator ControlAuto#

Automatic mode.

Functions

void db_protocol_init(void)#

Initializes the RNG used as a source for random message IDs.

void db_protocol_header_to_buffer(uint8_t *buffer, uint64_t dst, application_type_t application, command_type_t command_type)#

Write the protocol header in a buffer.

Parameters:
  • buffer[out] Bytes array to write to

  • dst[in] Destination address written in the header

  • application[in] Application type that relates to this header

  • command_type[in] Command type that follows this header

void db_protocol_cmd_move_raw_to_buffer(uint8_t *buffer, uint64_t dst, application_type_t application, protocol_move_raw_command_t *command)#

Write a move raw command in a buffer.

Parameters:
  • buffer[out] Bytes array to write to

  • dst[in] Destination address written in the header

  • application[in] Application type that relates to this command

  • command[in] Pointer to the move raw command

void db_protocol_cmd_rgbled_to_buffer(uint8_t *buffer, uint64_t dst, application_type_t application, protocol_rgbled_command_t *command)#

Write an rgbled command in a buffer.

Parameters:
  • buffer[out] Bytes array to write to

  • dst[in] Destination address written in the header

  • application[in] Application type that relates to this command

  • command[in] Pointer to the rgbled command

struct protocol_header_t#

DotBot protocol header.

Public Members

uint64_t dst#

Destination address of this packet.

uint64_t src#

Source address of this packet.

uint16_t swarm_id#

Swarm ID.

application_type_t application#

Application type.

uint8_t version#

Version of the firmware.

uint32_t msg_id#

Message ID.

command_type_t type#

Type of command following this header.

struct protocol_move_raw_command_t#

DotBot protocol move raw command.

Public Members

int8_t left_x#

Horizontal coordinate for left side.

int8_t left_y#

Vertical coordinate for left side.

int8_t right_x#

Horizontal coordinate for right side.

int8_t right_y#

Vertical coordinate for right side.

struct protocol_rgbled_command_t#

DotBot protocol RGB LED command.

Public Members

uint8_t r#

Red component value.

uint8_t g#

Green component value.

uint8_t b#

Blue component value.

struct protocol_lh2_location_t#

DotBot protocol LH2 computed location.

Public Members

uint32_t x#

X coordinate, multiplied by 1e6.

uint32_t y#

Y coordinate, multiplied by 1e6.

uint32_t z#

Z coordinate, multiplied by 1e6.

struct protocol_lh2_waypoints_t#

DotBot protocol LH2 waypoints.

Public Members

uint8_t length#

Number of waypoints.

protocol_lh2_location_t points[DB_MAX_WAYPOINTS]#

Array containing a list of lh2 point coordinates.

struct protocol_gps_coordinate_t#

DotBot protocol GPS coordinates.

Public Members

int32_t latitude#

Latitude, multiplied by 1e6.

int32_t longitude#

Longitude, multiplied by 1e6.

struct protocol_gps_waypoints_t#

DotBot protocol GPS waypoints.

Public Members

uint8_t length#

Number of waypoints.

protocol_gps_coordinate_t coordinates[DB_MAX_WAYPOINTS]#

Array containing a list of GPS coordinates.

struct protocol_lh2_processed_packet_t#

LH2 process data compressed for sending over radio.

Public Members

uint8_t selected_polynomial#

selected poly is the polyomial # (between 0 and 31) that the demodulation code thinks the demodulated bits are a part of, initialize to error state

uint32_t lfsr_location#

LFSR location is the position in a given polynomial’s LFSR that the decoded data is, initialize to error state.

uint32_t timestamp_us#

How many microseconds passed since the sample was taken.

struct protocol_tdma_table_t#

Public Members

uint32_t frame_period#

duration of a full TDMA frame

uint32_t rx_start#

start to listen for packets

uint16_t rx_duration#

duration of the RX period

uint32_t tx_start#

start of slot for transmission

uint16_t tx_duration#

duration of the TX period

uint32_t next_period_start#

time until the start of the next TDMA frame

struct protocol_sync_frame_t#

Public Members

uint32_t frame_period#

duration of a full TDMA frame