dotbot.dotbot_simulator module#

Dotbot simulator for the DotBot project.

class dotbot.dotbot_simulator.DotBotSimulator(settings)[source]#

Bases: Thread

Simulator class for the dotbot.

Parameters:

settings (SimulatedDotBotSettings)

advertise()[source]#

Send an advertisement message to the gateway.

handle_frame(frame)[source]#

Decode the serial input received from the gateway.

Parameters:

frame (Frame)

run()[source]#

Update the state of the dotbot simulator.

stop()[source]#
update(dt)[source]#

State space model update.

Parameters:

dt (float)

property header#
class dotbot.dotbot_simulator.DotBotSimulatorCommunicationInterface(on_frame_received, simulator_init_state_path)[source]#

Bases: Thread

Bidirectional serial interface to control simulated robots

Parameters:
  • on_frame_received (Callable)

  • simulator_init_state_path (str)

flush()[source]#

Flush fake serial output.

handle_dotbot_frame(frame)[source]#

Send bytes to the fake serial, similar to the real gateway.

run()[source]#

Listen continuously at each byte received on the fake serial interface.

stop()[source]#
write(bytes_)[source]#

Write bytes on the fake serial.

class dotbot.dotbot_simulator.DotBotSimulatorMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

Operation mode of the dotbot simulator.

AUTOMATIC = 'AUTOMATIC'#
MANUAL = 'MANUAL'#
class dotbot.dotbot_simulator.InitStateToml(*, dotbots, network=SimulatedNetworkSettings(pdr=100))[source]#

Bases: BaseModel

Parameters:
dotbots: List[SimulatedDotBotSettings]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

network: SimulatedNetworkSettings#
class dotbot.dotbot_simulator.SimulatedDotBotSettings(*, address, pos_x, pos_y, theta, calibrated=True, motor_left_error=0.5, motor_right_error=0)[source]#

Bases: BaseModel

Parameters:
  • address (str)

  • pos_x (int)

  • pos_y (int)

  • theta (float)

  • calibrated (bool)

  • motor_left_error (float)

  • motor_right_error (float)

address: str#
calibrated: bool#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

motor_left_error: float#
motor_right_error: float#
pos_x: int#
pos_y: int#
theta: float#
class dotbot.dotbot_simulator.SimulatedNetworkSettings(*, pdr=100)[source]#

Bases: BaseModel

Parameters:

pdr (int)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pdr: int#
class dotbot.dotbot_simulator.Waypoint(x, y)[source]#

Bases: object

Waypoint class for the dotbot simulator.

Parameters:
  • x (int)

  • y (int)

x: int#
y: int#
dotbot.dotbot_simulator.battery_discharge_model(time_elapsed_s)[source]#

Simple battery discharge model.

Parameters:

time_elapsed_s (float)

Return type:

int