Firmware¶
- class pyniryo_nate.components.Firmware(http_client: HttpClient, mqtt_client: MqttClient, correlation_id: str)[source]¶
Bases:
BaseAPIComponentFirmware component for accessing the state of the robot firmware and the PLC safety chain, and for controlling the firmware container.
Methods
Clear the current firmware errors.
closeClose the component and release any resources if needed.
Request the arming of the robot through the safety controller, the same path as the physical initialization button.
Get the current firmware error report.
Get the current state of the PLC safety chain.
Get the current state of the robot firmware.
Set a callback to be called when the PLC safety state changes.
Set a callback to be called when the firmware state changes.
Restart the firmware container.
Set the state of the PLC safety chain.
Start the firmware container.
Stop the firmware container.
Block until the safety module reports the robot armed.
- Parameters:
http_client (HttpClient)
mqtt_client (MqttClient)
correlation_id (str)
- get_state() FirmwareState[source]¶
Get the current state of the robot firmware.
- Returns:
The current firmware state.
- Return type:
- get_error_report() str[source]¶
Get the current firmware error report.
- Returns:
A human-readable message describing the current firmware error, if any.
- Return type:
str
- get_plc_safety_state() PlcSafetyState[source]¶
Get the current state of the PLC safety chain.
- Returns:
The current PLC safety state.
- Return type:
- set_plc_safety_state(state: PlcSafetyState) None[source]¶
Set the state of the PLC safety chain. Only available when safety is simulated: on a real robot the PLC state is owned by the wired safety chain and cannot be set through the API.
- Parameters:
state (PlcSafetyState) – The PLC safety state to set.
- Return type:
None
- enable() None[source]¶
Request the arming of the robot through the safety controller, the same path as the physical initialization button. Available while disarmed.
Acceptance is not arming: observe
safety.armedwithon_state()orget_state(), or callwait_armed(). The robot bounds the request to two seconds. Do not retry after a timeout, the impulse may already have been transmitted; this client retries connection failures only, never a response.- Raises:
ClientError – If the request is refused, an impulse already pending included.
ServerError – If the safety controller cannot be reached (503), did not answer in time (504), or failed.
- Return type:
None
- wait_armed(timeout: float = -1) None[source]¶
Block until the safety module reports the robot armed. The firmware state is retained, so a robot already armed returns at once.
- Parameters:
timeout (float) – Maximum time to wait, in seconds. Zero or a negative value waits indefinitely.
- Raises:
TimeoutError – If the timeout expires before the robot is armed.
- Return type:
None
- on_state(callback: Callable[[FirmwareState], None]) Callable[[], None][source]¶
Set a callback to be called when the firmware state changes.
- Parameters:
callback (Callable[[FirmwareState], None]) – The callback function that takes a FirmwareState parameter.
- Return type:
Callable[[], None]
- on_plc_safety_state(callback: Callable[[PlcSafetyState], None]) Callable[[], None][source]¶
Set a callback to be called when the PLC safety state changes.
- Parameters:
callback (Callable[[PlcSafetyState], None]) – The callback function that takes a PlcSafetyState parameter.
- Return type:
Callable[[], None]