phoenix6.hardware.traits.common_device

Module Contents

class phoenix6.hardware.traits.common_device.CommonDevice

Contains everything common between Phoenix 6 devices.

property device_id: int

Gets the ID of this device.

Returns:

ID of this device

Return type:

int

property network: phoenix6.canbus.CANBus

Gets the network this device is on.

Returns:

The network this device is on

Return type:

CANBus

property device_hash: int

Gets a number unique for this device’s hardware type and ID. This number is not unique across networks.

This can be used to easily reference hardware devices on the same network in collections such as maps.

Returns:

Hash of this device

Return type:

int

property control_request: phoenix6.hardware.parent_device.SupportsSendRequest

Get the latest applied control.

Returns:

Latest applied control

Return type:

SupportsSendRequest

property has_reset_occurred: bool

Check if the device has reset since the previous call to this routine

Returns:

True if device has reset

Return type:

bool

property is_connected: bool

Returns whether the device is still connected to the robot. This is equivalent to refreshing and checking the latency of the Version status signal.

Parameters:

max_latency_seconds (float) – The maximum latency of the Version status signal before the device is reported as disconnected

Returns:

True if the device is connected

Return type:

bool

Configuration: type

The configuration class for this device.

get_reset_occurred_checker() Callable[[], bool]

Get a lambda that checks for device resets.

Returns:

A lambda that checks for device resets

Return type:

Callable[[], bool]

optimize_bus_utilization(optimized_freq_hz: phoenix6.units.hertz = 4.0, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Optimizes the device’s bus utilization by reducing the update frequencies of its status signals.

All status signals that have not been explicitly gven an update frequency using BaseStatusSignal.set_update_frequency will be slowed down. Note that if other status signals in the same frame have been given an update frequency, the update frequency will be honored for the entire frame.

This function only needs to be called once on this device in the robot program. Additionally, this method does not necessarily need to be called after setting the update frequencies of other signals.

To restore the default status update frequencies, call reset_signal_frequencies. Alternatively, remove this method call, redeploy the robot application, and power-cycle the device on the bus. The user can also override individual status update frequencies using BaseStatusSignal.set_update_frequency.

Parameters:
  • optimized_freq_hz (hertz, optional) – The update frequency to apply to the optimized status signals. A frequency of 0 Hz will turn off the signals. Otherwise, the minimum supported signal frequency is 4 Hz (default).

  • timeout_seconds (second, optional) – Maximum amount of time to wait for each status frame when performing the action

Returns:

Status code of the first failed update frequency set call, or OK if all succeeded.

Return type:

StatusCode

reset_signal_frequencies(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Resets the update frequencies of all the device’s status signals to the defaults.

This restores the default update frequency of all status signals, including status signals explicitly given an update frequency using BaseStatusSignal.set_update_frequency and status signals optimized out using optimize_bus_utilization.

Parameters:

timeout_seconds (second, optional) – Maximum amount of time to wait for each status frame when performing the action

Returns:

Status code of the first failed update frequency set call, or OK if all succeeded.

Return type:

StatusCode