dotbot.dotbot_simulator module#
Dotbot simulator for the DotBot project.
- class dotbot.dotbot_simulator.ControlLoopWaypoint[source]#
Bases:
StructureMirrors coordinate_t from control_loop.h — used when calling control_loop_set_waypoints.
- x#
Structure/Union member
- y#
Structure/Union member
- class dotbot.dotbot_simulator.DotBotSimulator(settings, tx_queue)[source]#
Bases:
objectSimulator class for the dotbot.
- Parameters:
settings (SimulatedDotBotSettings)
tx_queue (Queue)
- property header#
- class dotbot.dotbot_simulator.DotBotSimulatorCommunicationInterface(on_frame_received, simulator_init_state)[source]#
Bases:
objectBidirectional serial interface to control simulated robots
- Parameters:
on_frame_received (Callable)
simulator_init_state (str)
- class dotbot.dotbot_simulator.InitStateToml(*, dotbots, network=SimulatedNetworkSettings(pdr=100, uplink_pdr=100, downlink_pdr=100, slot_duration_ms=1.236, mqtt_latency_ms=0.0))[source]#
Bases:
BaseModel- Parameters:
dotbots (List[SimulatedDotBotSettings])
network (SimulatedNetworkSettings)
- 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.MariNetworkSimulator(settings, on_frame_received)[source]#
Bases:
objectTSCH slot-based network simulator modelling the Mari link layer.
- Parameters:
settings (SimulatedNetworkSettings)
on_frame_received (Callable)
- schedule_downlink(bytes_, dotbot, dotbot_index)[source]#
- Parameters:
bytes_ (bytes)
dotbot (DotBotSimulator)
dotbot_index (int)
- class dotbot.dotbot_simulator.RobotControl[source]#
Bases:
StructureMirrors robot_control_t from control_loop.h.
Only the stable external I/O boundary is represented here. All internal algorithm state lives in the opaque context managed by the C library. Layout must stay in sync with the C struct (no internal padding gaps).
- all_done#
Structure/Union member
- direction#
Structure/Union member
- encoder_left#
Structure/Union member
- encoder_right#
Structure/Union member
- pos_x#
Structure/Union member
- pos_y#
Structure/Union member
- pwm_left#
Structure/Union member
- pwm_right#
Structure/Union member
- waypoint_idx#
Structure/Union member
- waypoint_reached#
Structure/Union member
- waypoint_x#
Structure/Union member
- waypoint_y#
Structure/Union member
- class dotbot.dotbot_simulator.SimulatedDotBotSettings(*, address=<factory>, pos_x, pos_y, direction=-1000, calibrated=255, motor_left_error=0, motor_right_error=0, custom_control_loop_library=None, gru_model_path=None, battery_model_path=None, network_mode=SimulatedNetworkMode.DEFAULT)[source]#
Bases:
BaseModel- Parameters:
address (str)
pos_x (int)
pos_y (int)
direction (int)
calibrated (int)
motor_left_error (float)
motor_right_error (float)
custom_control_loop_library (Path)
gru_model_path (Path)
battery_model_path (Path)
network_mode (SimulatedNetworkMode)
- address: str#
- battery_model_path: Path#
- calibrated: int#
- custom_control_loop_library: Path#
- direction: int#
- gru_model_path: Path#
- 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#
- network_mode: SimulatedNetworkMode#
- pos_x: int#
- pos_y: int#
- class dotbot.dotbot_simulator.SimulatedNetworkMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
str,Enum- DEFAULT = 'default'#
- MARI = 'mari'#
- class dotbot.dotbot_simulator.SimulatedNetworkSettings(*, pdr=100, uplink_pdr=None, downlink_pdr=None, slot_duration_ms=1.236, mqtt_latency_ms=0.0)[source]#
Bases:
BaseModel- Parameters:
pdr (int)
uplink_pdr (int | None)
downlink_pdr (int | None)
slot_duration_ms (float)
mqtt_latency_ms (float)
- downlink_pdr: int | None#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- mqtt_latency_ms: float#
- pdr: int#
- slot_duration_ms: float#
- uplink_pdr: int | None#
- class dotbot.dotbot_simulator.Waypoint(x, y)[source]#
Bases:
objectWaypoint class for the dotbot simulator.
- Parameters:
x (int)
y (int)
- x: int#
- y: int#
- dotbot.dotbot_simulator.battery_discharge_model(time_elapsed_s)[source]#
Linear discharge over MAX_BATTERY_DURATION (supercapacitor idle model).
- Parameters:
time_elapsed_s (float)
- Return type:
int
- dotbot.dotbot_simulator.packaged_init_state_path()[source]#
Absolute path to the default simulator world shipped in the package.
- Return type:
Path
- dotbot.dotbot_simulator.resolve_init_state_path(path)[source]#
Resolve the simulator init-state .toml to load.
An existing file — an explicit
--simulator-init-statepath, or asimulator_init_state.tomlin the working directory — is used as given. When the default is requested and no such file is present, fall back to the world shipped inside the package, so the no-hardware path (dotbot run simulator/--conn simulator) works from any directory and from a pip-installed wheel. An explicit path that does not exist is returned unchanged so the caller gets a clear FileNotFoundError.- Parameters:
path (str)
- Return type:
str