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)

enum application_type_t#

Application type.

Values:

enumerator DotBot#

DotBot application.

enumerator SailBot#

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