phoenix6.status_signal_collection

Module Contents

class phoenix6.status_signal_collection.StatusSignalCollection(*signals: phoenix6.base_status_signal.BaseStatusSignal | list[phoenix6.base_status_signal.BaseStatusSignal])

Class to manage bulk refreshing device status signals.

Creates a new collection of status signals, optionally adding the provided signals to the collection.

Parameters:

signals (tuple[BaseStatusSignal | list[BaseStatusSignal], ...]) – Signals to add

add_signals(*signals: phoenix6.base_status_signal.BaseStatusSignal | list[phoenix6.base_status_signal.BaseStatusSignal])

Adds the provided signals to the collection.

Parameters:

signals (tuple[BaseStatusSignal | list[BaseStatusSignal], ...]) – Signals to add

wait_for_all(timeout_seconds: phoenix6.units.second) phoenix6.status_code.StatusCode

Waits for new data on all signals up to timeout. This API is typically used with CANivore Bus signals as they will be synced using the CANivore Timesync feature and arrive simultaneously. Signals on a roboRIO bus cannot be synced and may require a significantly longer blocking call to receive all signals.

Note that CANivore Timesync requires Phoenix Pro.

This can also be used with a timeout of zero to refresh many signals at once, which is faster than calling refresh() on every signal. This is equivalent to calling self.refresh_all.

If a signal arrives multiple times while waiting, such as when not using CANivore Timesync, the newest signal data is fetched. Additionally, if this function times out, the newest signal data is fetched for all signals (when possible). We recommend checking the individual status codes using self.status when this happens.

Parameters:

timeout_seconds (second) – Maximum time to wait for new data in seconds. Pass zero to refresh all signals without blocking.

Returns:

An InvalidParamValue if this signal collection is empty, InvalidNetwork if signals are on different CAN bus networks, RxTimeout if it took longer than timeoutSeconds to receive all the signals, MultiSignalNotSupported if using the roboRIO bus with more than one signal and a non-zero timeout. An OK status code means that all signals arrived within timeoutSeconds and they are all OK.

Any other value represents the StatusCode of the first failed signal. Check the status of each signal to determine which ones failed.

Return type:

StatusCode

refresh_all() phoenix6.status_code.StatusCode

Performs a non-blocking refresh on all signals.

This provides a performance improvement over separately calling refresh() on each signal.

Returns:

An InvalidParamValue if this signal collection is empty, InvalidNetwork if signals are on different CAN bus networks. An OK status code means that all signals are OK.

Any other value represents the StatusCode of the first failed signal. Check the status of each signal to determine which ones failed.

Return type:

StatusCode

set_update_frequency_for_all(frequency_hz: phoenix6.units.hertz) phoenix6.status_code.StatusCode

Sets the update frequency of all status signals to the provided common frequency.

A frequency of 0 Hz will turn off the signal. Otherwise, the minimum supported signal frequency is 4 Hz, and the maximum is 1000 Hz.

If other StatusSignals in the same status frame have been set to an update frequency, the fastest requested update frequency will be applied to the frame.

This will wait up to 0.100 seconds (100ms) for each signal.

Parameters:

frequency_hz (hertz) – Rate to publish the signal in Hz

Returns:

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

Return type:

StatusCode

is_all_good() bool

Checks if all signals have an OK error code.

Returns:

True if all are good, False otherwise

Return type:

bool