hardware
BumperHardware ¶
BumperHardware(
config: BumperConfiguration,
robot_brain: RobotBrain,
*,
expander: ExpanderHardware | None = None,
estop: EStop | None = None
)
Bases: BumperHardware
Hardware bumper that builds its Lizard pin wiring from a BumperConfiguration.
CanOpenMasterHardware ¶
CanOpenMasterHardware(
robot_brain: RobotBrain,
*,
can: CanHardware,
name: str = "master",
sync_interval: int = 5
)
Bases: ModuleHardware
RoSys module to control the CANOpen master Lizard module.
ConnectionStatus ¶
Bases: Enum
Connection status of the Teltonika router.
Events¶
| Name | Description |
|---|---|
CONNECTION_CHANGED |
Emitted when the connection status changes. |
INFO_UPDATED |
Emitted after modem, WiFi, and device info have been polled. |
WIFI_NETWORKS_CHANGED |
Emitted after the upstream WiFi client network list has been refreshed. |
DeviceInfo
dataclass
¶
DeviceInfo(
*,
firmware_version: str | None = None,
model: str | None = None,
serial: str | None = None
)
Router device information.
Events¶
| Name | Description |
|---|---|
CONNECTION_CHANGED |
Emitted when the connection status changes. |
INFO_UPDATED |
Emitted after modem, WiFi, and device info have been polled. |
WIFI_NETWORKS_CHANGED |
Emitted after the upstream WiFi client network list has been refreshed. |
Light ¶
Light(*, name: str, safety_managed: bool = True, **kwargs)
Bases: Module, ABC
Base class for a single light with on/off and duty cycle control.
on
async
¶
on() -> AsyncGenerator[None, None]
Keep the light on for the block; it stays on until the last concurrent block exits.
set_duty_cycle
async
¶
set_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of the light.
:param duty_cycle: float between 0 and 1 :raises ValueError: if duty cycle is not between 0 and 1
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
safety_managed |
Whether the robot's safety system force-disables this lamp on an e-stop or bumper trigger. |
LightHardware ¶
LightHardware(
config: LightConfiguration,
robot_brain: RobotBrain,
*,
expander: ExpanderHardware | None,
ledc_timer: int,
ledc_channel: int
)
Bases: Light, ModuleHardware, SafetyMixin
Light hardware implementation using a PWM output.
:param config: the lamp's configuration, whose name is the lamp's Lizard variable :param robot_brain: the robot brain driving the lamp :param expander: the port expander the lamp sits on, or None if it sits on the main chip :param ledc_timer: the LEDC timer the lamp's PWM output runs on :param ledc_channel: the LEDC channel the lamp occupies on its chip
_convert_duty_cycle_to_lizard
staticmethod
¶
_convert_duty_cycle_to_lizard(duty_cycle: float) -> int
Convert the duty cycle to Lizard's PwmOutput duty, where 256 keeps the output on for the whole period.
:param duty_cycle: float between 0 and 1 :return: int between 0 and 256 :raises ValueError: if duty cycle is not between 0 and 1
set_duty_cycle
async
¶
set_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of the light if the robot brain is ready.
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
safety_managed |
Whether the robot's safety system force-disables this lamp on an e-stop or bumper trigger. |
LightSimulation ¶
LightSimulation(
config: (
LightConfiguration | WorkLightMosfetConfiguration
),
**kwargs
)
Bases: Light, ModuleSimulation
Simulated light for testing.
:param config: the lamp's configuration, as the hardware lamp takes it
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
safety_managed |
Whether the robot's safety system force-disables this lamp on an e-stop or bumper trigger. |
Lights ¶
Lights(lights: Iterable[Light], *, title: str = 'Lights')
The lights of one robot, switchable as a group and individually by name.
:param lights: the robot's lights :param title: the label this group shows in the developer UI :raises ValueError: if two lights share a name
__getitem__ ¶
__getitem__(name: str) -> Light
Get a single light by name.
:param name: the name the light was configured with :return: the light :raises KeyError: if the robot has no light of that name
on
async
¶
on() -> AsyncGenerator[None, None]
Keep all lights on for the block; they stay on until the last concurrent block exits.
set_duty_cycle
async
¶
set_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of every light.
:param duty_cycle: float between 0 and 1 :raises ValueError: if duty cycle is not between 0 and 1
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
safety_managed |
Whether the robot's safety system force-disables this lamp on an e-stop or bumper trigger. |
ModemStatus
dataclass
¶
ModemStatus(
*,
rssi: int | None = None,
rsrp: int | None = None,
sinr: int | None = None,
rsrq: int | None = None,
operator: str | None = None,
network_type: str | None = None,
connection_state: str | None = None,
temperature: int | None = None
)
Cellular modem signal quality and connection info.
Events¶
| Name | Description |
|---|---|
CONNECTION_CHANGED |
Emitted when the connection status changes. |
INFO_UPDATED |
Emitted after modem, WiFi, and device info have been polled. |
WIFI_NETWORKS_CHANGED |
Emitted after the upstream WiFi client network list has been refreshed. |
ODriveTracksHardware ¶
ODriveTracksHardware(
config: ODriveTracksConfiguration,
robot_brain: RobotBrain,
estop: EStopHardware,
*,
can: CanHardware
)
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
linear_acceleration |
float |
The maximum linear acceleration rate. |
linear_deceleration |
float |
The maximum linear deceleration rate. |
Safety ¶
Safety(
*,
wheels: Wheels,
estop: EStop,
bumper: Bumper | None = None,
modules: list[SafetyMixin] | None = None
)
Bases: ABC
Coordinates safety behavior across wheels, estop, bumper, and registered modules.
Modules implementing SafetyMixin can be registered via add_module() to have their
enable/disable code automatically called when the safety state changes.
add_module ¶
add_module(module: SafetyMixin) -> None
Register a module to be enabled/disabled with the safety system.
SafetyHardware ¶
SafetyHardware(
robot_brain: RobotBrain,
*,
bumper: BumperHardware | None = None,
**kwargs
)
Bases: Safety, ModuleHardware
Generates Lizard code for hardware safety with automatic enable/disable behavior.
The generated code creates enable() and disable() functions that control
wheels and all registered SafetyMixin modules. State transitions:
- E-stop or bumper triggered →
disable()called immediately - E-stop released while disabled →
enable()called once the bumper is also inactive - Bumper released while disabled →
enable()called only after abumper.config.release_buffer_msbuffer has passed since the release, and only once the e-stop is also inactive. The buffer only delays re-enabling after a bumper release; it does not affect the e-stop, and it does not delaydisable()when the bumper is triggered. - No messages for 1s → wheels stop
- No messages for 20s → full disable (watchdog)
The bumper buffer is a level-triggered watchdog, not edge detection: while the bumper is
active, bumper_ready_at is pushed to now + bumper.config.release_buffer_ms every cycle, so
it settles at "last active cycle + buffer" the moment the bumper releases.
SafetyMixin ¶
Bases: ABC
Mixin for modules that integrate with the safety system.
Implement enable_code and disable_code to return Lizard code snippets
that get injected into the safety module's enable() and disable() functions.
SafetySimulation ¶
SafetySimulation(
*,
wheels: Wheels,
estop: EStop,
bumper: Bumper | None = None,
modules: list[SafetyMixin] | None = None
)
StatusControlHardware ¶
StatusControlHardware(
robot_brain: RobotBrain,
*,
expander: ExpanderHardware,
rdyp_pin: int = 39,
vdp_pin: int = 39
)
Bases: ModuleHardware
Reads the status of the robot's power distribution.
TeltonikaRouter ¶
TeltonikaRouter(url: str, admin_password: str)
Implements the API of the builtin Teltonika RUT901 router.
_classify_interface
classmethod
¶
_classify_interface(key: str) -> ConnectionStatus | None
Map an mwan3 failover interface key to its connection type (None if unknown).
_ensure_token
async
¶
_ensure_token() -> bool
Refresh the auth token if expired. Returns True if a valid token is available.
_get
async
¶
_get(endpoint: str) -> dict | list | None
Perform an authenticated GET request. Returns parsed JSON data or None.
_normalize_interface_list
staticmethod
¶
_normalize_interface_list(data: dict | list) -> list[dict]
Convert a dict-keyed or list response into a flat list of interface dicts.
_parse_wifi_client
staticmethod
¶
_parse_wifi_client(entry: dict) -> WifiClientNetwork
Build a WifiClientNetwork from a raw MultiAP candidate config entry.
Reads the enable state from RutOS's enabled field but falls back to the inverse of
the underlying UCI disabled flag when only that is present.
:param entry: one raw entry from the MultiAP config response. :return: the parsed candidate network.
_post
async
¶
_post(endpoint: str, *, json: dict | None = None) -> bool
Perform an authenticated POST request. Returns True on success.
_reject_redirect
staticmethod
¶
_reject_redirect(response: Response) -> None
Reject an unfollowed redirect: we talk HTTPS to the router directly, so a 3xx is unexpected
and would otherwise slip through raise_for_status (which ignores 3xx) as a bodyless success.
_request
async
¶
_request(
method: Literal["GET", "POST", "PUT", "DELETE"],
endpoint: str,
*,
json: dict | None = None
) -> httpx.Response | None
Perform an authenticated request, refreshing the token if needed.
add_wifi_client_network
async
¶
add_wifi_client_network(
ssid: str, password: str, *, enabled: bool = False
) -> bool
Add a MultiAP candidate network, appended with the next free priority.
Refreshes the list on success.
:param ssid: the network name to join.
:param password: the pre-shared key.
:param enabled: whether the entry is active right after creation (default False).
:return: True if the router accepted the new network, False on failure.
check_dns
async
¶
check_dns(
hostnames: Iterable[str] = DNS_CHECK_HOSTNAMES,
timeout: float = 2.0,
) -> bool
Check DNS resolution by resolving hostnames concurrently.
check_internet
async
¶
check_internet(
hosts: Iterable[str] = INTERNET_CHECK_HOSTS,
port: int = 53,
timeout: float = 2.0,
) -> bool
Check raw IP connectivity by probing hosts concurrently on port.
refresh_wifi_client_networks
async
¶
refresh_wifi_client_networks() -> None
Reload the MultiAP candidate networks from the router and emit WIFI_NETWORKS_CHANGED.
remove_wifi_client_network
async
¶
remove_wifi_client_network(network_id: str) -> bool
Delete a MultiAP candidate network by its config id, refreshing the list on success.
set_wifi_client_enabled
async
¶
set_wifi_client_enabled(
network_id: str, enabled: bool
) -> bool
Enable or disable a MultiAP candidate network by its config id, refreshing the list on success.
Events¶
| Name | Description |
|---|---|
CONNECTION_CHANGED |
Emitted when the connection status changes. |
INFO_UPDATED |
Emitted after modem, WiFi, and device info have been polled. |
WIFI_NETWORKS_CHANGED |
Emitted after the upstream WiFi client network list has been refreshed. |
TracksHardware ¶
TracksHardware(
config: TracksConfiguration,
robot_brain: RobotBrain,
*,
lizard_code: str,
core_message_fields: list[str]
)
Bases: Wheels, ModuleHardware
Base class for Feldfreund tracked wheels.
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
linear_acceleration |
float |
The maximum linear acceleration rate. |
linear_deceleration |
float |
The maximum linear deceleration rate. |
TracksSimulation ¶
TracksSimulation(
width: float = 0.5,
*,
linear_acceleration: float = 2.0,
linear_deceleration: float = 0.5
)
Bases: WheelsSimulation
Simulated tracks with acceleration and deceleration handling.
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
linear_acceleration |
float |
The maximum linear acceleration rate. |
linear_deceleration |
float |
The maximum linear deceleration rate. |
angular_acceleration |
float |
Calculated angular acceleration from linear acceleration using differential drive kinematics. |
angular_deceleration |
float |
Calculated angular deceleration from linear deceleration using differential drive kinematics. |
WifiClientNetwork
dataclass
¶
WifiClientNetwork(
*,
id: str,
ssid: str,
enabled: bool,
priority: int | None = None
)
A MultiAP candidate network the router can join as a client (one entry of the AP list).
Events¶
| Name | Description |
|---|---|
CONNECTION_CHANGED |
Emitted when the connection status changes. |
INFO_UPDATED |
Emitted after modem, WiFi, and device info have been polled. |
WIFI_NETWORKS_CHANGED |
Emitted after the upstream WiFi client network list has been refreshed. |
WifiInfo
dataclass
¶
WifiInfo(
*,
ap_ssid: str | None = None,
ap_clients: int | None = None,
sta_ssid: str | None = None,
sta_signal: int | None = None
)
WiFi interface status.
Events¶
| Name | Description |
|---|---|
CONNECTION_CHANGED |
Emitted when the connection status changes. |
INFO_UPDATED |
Emitted after modem, WiFi, and device info have been polled. |
WIFI_NETWORKS_CHANGED |
Emitted after the upstream WiFi client network list has been refreshed. |
WorkLightHardwareMosfet ¶
WorkLightHardwareMosfet(
config: WorkLightMosfetConfiguration,
robot_brain: RobotBrain,
*,
expander: ExpanderHardware | None
)
Bases: Light, ModuleHardware, SafetyMixin
Work light hardware implementation using a MOSFET switch.
Deprecated: only used on U4. Not built into any new robot; do not extend.
set_duty_cycle
async
¶
set_duty_cycle(duty_cycle: float) -> None
Reject a brightness the fixed mosfet output cannot run.
:param duty_cycle: ignored :raises RuntimeError: always
Attributes & Properties¶
| Name | Type | Description |
|---|---|---|
safety_managed |
Whether the robot's safety system force-disables this lamp on an e-stop or bumper trigger. |