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 protocol_data_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.

enum packet_type_t#

Protocol packet type.

Values:

enumerator DB_PACKET_BEACON#

Beacon packet.

enumerator DB_PACKET_JOIN_REQUEST#

Join request packet.

enumerator DB_PACKET_JOIN_RESPONSE#

Join response packet.

enumerator DB_PACKET_LEAVE#

Leave packet.

enumerator DB_PACKET_DATA#

Data packet.

enumerator DB_PACKET_TDMA_UPDATE_TABLE#

TDMA table update packet.

enumerator DB_PACKET_TDMA_SYNC_FRAME#

TDMA sync frame packet.

enumerator DB_PACKET_TDMA_KEEP_ALIVE#

TDMA keep alive packet.

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

size_t db_protocol_header_to_buffer(uint8_t *buffer, uint64_t dst)#

Write the protocol header in a buffer.

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

  • dst[in] Destination address written in the header

Returns:

Number of bytes written in the buffer

size_t db_protocol_tdma_keep_alive_to_buffer(uint8_t *buffer, uint64_t dst)#

Write a TDMA keep alive packet in a buffer.

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

  • dst[in] Destination address written in the header

Returns:

Number of bytes written in the buffer

size_t db_protocol_tdma_table_update_to_buffer(uint8_t *buffer, uint64_t dst, protocol_tdma_table_t *tdma_table)#

Write a TDMA table update in a buffer.

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

  • dst[in] Destination address written in the header

  • tdma_table[in] Pointer to the TDMA table

Returns:

Number of bytes written in the buffer

size_t db_protocol_tdma_sync_frame_to_buffer(uint8_t *buffer, uint64_t dst, protocol_sync_frame_t *sync_frame)#

Write a TDMA sync frame in a buffer.

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

  • dst[in] Destination address written in the header

  • sync_frame[in] Pointer to the sync frame

Returns:

Number of bytes written in the buffer

size_t db_protocol_advertizement_to_buffer(uint8_t *buffer, uint64_t dst, application_type_t application)#

Write an application advertizement packet in a buffer.

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

  • dst[in] Destination address written in the header

  • application[in] Type of application advertized

Returns:

Number of bytes written in the buffer

size_t db_protocol_cmd_move_raw_to_buffer(uint8_t *buffer, uint64_t dst, 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

  • command[in] Pointer to the move raw command

Returns:

Number of bytes written in the buffer

size_t db_protocol_cmd_rgbled_to_buffer(uint8_t *buffer, uint64_t dst, 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

  • command[in] Pointer to the rgbled command

Returns:

Number of bytes written in the buffer

struct protocol_header_t#

DotBot protocol header.

Public Members

uint8_t version#

Version of the firmware.

packet_type_t packet_type#

Type of packet.

uint64_t dst#

Destination address of this packet.

uint64_t src#

Source address of this packet.

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#

DotBot protocol TDMA table update [all units are in microseconds].

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#

DotBot protocol sync messages marks the start of a TDMA frame [all units are in microseconds].

Public Members

uint32_t frame_period#

duration of a full TDMA frame