dotbot.protocol module#
Module for the Dotbot protocol API.
- exception dotbot.protocol.ProtocolPayloadParserException[source]#
Bases:
ExceptionException raised on invalid or unsupported payload.
- class dotbot.protocol.Advertisement[source]#
Bases:
ProtocolDataDataclass that holds an advertisement (emtpy).
- static from_bytes(_)[source]#
Returns a ProtocolData instance from a bytearray.
- Parameters:
_ (bytes) –
- Return type:
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- class dotbot.protocol.ApplicationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumTypes of DotBot applications.
- DotBot = 0#
- Freebot = 2#
- SailBot = 1#
- XGO = 3#
- class dotbot.protocol.CommandMoveRaw(left_x=0, left_y=0, right_x=0, right_y=0)[source]#
Bases:
ProtocolDataDataclass that holds move raw command data fields.
- Parameters:
left_x (int) –
left_y (int) –
right_x (int) –
right_y (int) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- left_x: int = 0#
- left_y: int = 0#
- right_x: int = 0#
- right_y: int = 0#
- class dotbot.protocol.CommandRgbLed(red=0, green=0, blue=0)[source]#
Bases:
ProtocolDataDataclass that holds a complete rgb led command fields.
- Parameters:
red (int) –
green (int) –
blue (int) –
- blue: int = 0#
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- green: int = 0#
- red: int = 0#
- class dotbot.protocol.CommandXgoAction(action=0)[source]#
Bases:
ProtocolDataDataclass that holds an XGO action.
- Parameters:
action (int) –
- action: int = 0#
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- class dotbot.protocol.ControlMode(mode=ControlModeType.MANUAL)[source]#
Bases:
ProtocolDataDataclass that holds a control mode message.
- Parameters:
mode (ControlModeType) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- mode: ControlModeType = 0#
- class dotbot.protocol.ControlModeType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumTypes of DotBot control modes.
- AUTO = 1#
- MANUAL = 0#
- class dotbot.protocol.DotBotData(direction=65535, locations=<factory>)[source]#
Bases:
ProtocolDataDataclass that holds direction and LH2 raw data from DotBot application.
- Parameters:
direction (int) –
locations (List[Lh2RawLocation]) –
- direction: int = 65535#
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- locations: List[Lh2RawLocation]#
- class dotbot.protocol.DotBotSimulatorData(theta=65535, pos_x=0, pos_y=0)[source]#
Bases:
ProtocolDataDataclass that holds direction and GPS data and heading from SailBot application.
- Parameters:
theta (int) –
pos_x (int) –
pos_y (int) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- pos_x: int = 0#
- pos_y: int = 0#
- theta: int = 65535#
- class dotbot.protocol.GPSPosition(latitude=0, longitude=0)[source]#
Bases:
ProtocolDataDataclass that holds GPS positions.
- Parameters:
latitude (int) –
longitude (int) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- latitude: int = 0#
- longitude: int = 0#
- class dotbot.protocol.GPSWaypoints(threshold, waypoints=<factory>)[source]#
Bases:
ProtocolDataDataclass that holds a list of GPS waypoints.
- Parameters:
threshold (int) –
waypoints (List[GPSPosition]) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- threshold: int#
- waypoints: List[GPSPosition]#
- class dotbot.protocol.LH2Location(pos_x=0, pos_y=0, pos_z=0)[source]#
Bases:
ProtocolDataDataclass that holds LH2 computed location data.
- Parameters:
pos_x (int) –
pos_y (int) –
pos_z (int) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- pos_x: int = 0#
- pos_y: int = 0#
- pos_z: int = 0#
- class dotbot.protocol.LH2Waypoints(threshold, waypoints=<factory>)[source]#
Bases:
ProtocolDataDataclass that holds a list of LH2 waypoints.
- Parameters:
threshold (int) –
waypoints (List[LH2Location]) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- threshold: int#
- waypoints: List[LH2Location]#
- class dotbot.protocol.Lh2RawData(locations=<factory>)[source]#
Bases:
ProtocolDataDataclass that holds LH2 raw data.
- Parameters:
locations (List[Lh2RawLocation]) –
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- locations: List[Lh2RawLocation]#
- class dotbot.protocol.Lh2RawLocation(bits=0, polynomial_index=0, offset=0)[source]#
Bases:
ProtocolDataDataclass that holds LH2 raw location data.
- Parameters:
bits (int) –
polynomial_index (int) –
offset (int) –
- bits: int = 0#
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- offset: int = 0#
- polynomial_index: int = 0#
- class dotbot.protocol.PayloadType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
EnumTypes of DotBot payload types.
- ADVERTISEMENT = 4#
- CMD_MOVE_RAW = 0#
- CMD_RGB_LED = 1#
- CMD_XGO_ACTION = 11#
- CONTROL_MODE = 7#
- DOTBOT_DATA = 6#
- DOTBOT_SIMULATOR_DATA = 250#
- GPS_POSITION = 5#
- GPS_WAYPOINTS = 9#
- INVALID_PAYLOAD = 12#
- LH2_LOCATION = 3#
- LH2_RAW_DATA = 2#
- LH2_WAYPOINTS = 8#
- SAILBOT_DATA = 10#
- class dotbot.protocol.ProtocolData[source]#
Bases:
ABCBase class for protocol payload data classes.
- abstract property fields: List[ProtocolField]#
Returns the list of fields in this data.
- class dotbot.protocol.ProtocolField(value=0, name='', length=1, signed=False)[source]#
Bases:
objectData class that describes a payload field.
- Parameters:
value (int) –
name (str) –
length (int) –
signed (bool) –
- length: int = 1#
- name: str = ''#
- signed: bool = False#
- value: int = 0#
- class dotbot.protocol.ProtocolHeader(destination=18446744073709551615, source=0, swarm_id=0, application=ApplicationType.DotBot, version=8, msg_id=0)[source]#
Bases:
ProtocolDataDataclass that holds header fields.
- Parameters:
destination (int) –
source (int) –
swarm_id (int) –
application (ApplicationType) –
version (int) –
msg_id (int) –
- application: ApplicationType = 0#
- destination: int = 18446744073709551615#
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- msg_id: int = 0#
- source: int = 0#
- swarm_id: int = 0#
- version: int = 8#
- class dotbot.protocol.ProtocolPayload(header, payload_type, values)[source]#
Bases:
objectManage a protocol complete payload (header + type + values).
- Parameters:
header (ProtocolHeader) –
payload_type (PayloadType) –
values (ProtocolData) –
- static from_bytes(bytes_)[source]#
Parse a bytearray to return a protocol payload instance.
- Parameters:
bytes_ (bytes) –
- header: ProtocolHeader#
- payload_type: PayloadType#
- values: ProtocolData#
- class dotbot.protocol.SailBotData(direction=65535, latitude=0, longitude=0, wind_angle=65535, rudder_angle=0, sail_angle=0)[source]#
Bases:
ProtocolDataDataclass that holds SailBot data from SailBot application.
- Parameters:
direction (int) –
latitude (int) –
longitude (int) –
wind_angle (int) –
rudder_angle (int) –
sail_angle (int) –
- direction: int = 65535#
- property fields: List[ProtocolField]#
Returns the list of fields in this data.
- latitude: int = 0#
- longitude: int = 0#
- rudder_angle: int = 0#
- sail_angle: int = 0#
- wind_angle: int = 65535#