hardware
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. |
Flashlight ¶
Flashlight(**kwargs)
Bases: Module, ABC
Base class for flashlight modules with on/off and duty cycle control.
set_duty_cycle
async
¶
set_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of the flashlight.
:param duty_cycle: float between 0 and 1 :raises ValueError: if duty cycle is not between 0 and 1
FlashlightHardware ¶
FlashlightHardware(
config: FlashlightConfiguration,
robot_brain: RobotBrain,
*,
expander: ExpanderHardware | None
)
Bases: Flashlight, ModuleHardware, SafetyMixin
Flashlight hardware implementation using PWM outputs.
set_duty_cycle
async
¶
set_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of the flashlight if the robot brain is ready.
FlashlightHardwareMosfet ¶
FlashlightHardwareMosfet(
config: FlashlightMosfetConfiguration,
robot_brain: RobotBrain,
bms: Bms,
*,
expander: ExpanderHardware | None
)
Bases: Flashlight, ModuleHardware, SafetyMixin
Flashlight hardware implementation using a MOSFET switch.
Deprecated: only used on U4. Not built into any new robot; do not extend.
FlashlightSimulation ¶
FlashlightSimulation(**kwargs)
Headlights ¶
Headlights(config: HeadlightsConfiguration, **kwargs)
Bases: Module, ABC
Base class for headlights modules with on/off and duty cycle control.
set_duty_cycles
async
¶
set_duty_cycles(
left_duty_cycle: float, right_duty_cycle: float
) -> None
Set the duty cycles of the headlights.
:param left_duty_cycle: float between 0 and 1 :param right_duty_cycle: float between 0 and 1 :raises ValueError: if duty cycle is not between 0 and 1
set_left_duty_cycle
async
¶
set_left_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of the left headlight.
:param duty_cycle: float between 0 and 1 :raises ValueError: if duty cycle is not between 0 and 1
set_right_duty_cycle
async
¶
set_right_duty_cycle(duty_cycle: float) -> None
Set the duty cycle of the right headlight.
:param duty_cycle: float between 0 and 1 :raises ValueError: if duty cycle is not between 0 and 1
HeadlightsHardware ¶
HeadlightsHardware(
config: HeadlightsConfiguration,
robot_brain: RobotBrain,
*,
expander: ExpanderHardware | None
)
Bases: Headlights, ModuleHardware
Headlights hardware implementation using PWM outputs.
set_duty_cycles
async
¶
set_duty_cycles(
left_duty_cycle: float, right_duty_cycle: float
) -> None
Set the duty cycle of the headlights if the robot brain is ready.
HeadlightsSimulation ¶
HeadlightsSimulation(
config: HeadlightsConfiguration, **kwargs
)
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, **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 - E-stop and bumper released while disabled →
enable()called - No messages for 1s → wheels stop
- No messages for 20s → full disable (watchdog)
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. |