phoenix6
#
Subpackages#
phoenix6.configs
phoenix6.controls
phoenix6.controls.coast_out
phoenix6.controls.differential_duty_cycle
phoenix6.controls.differential_follower
phoenix6.controls.differential_motion_magic_duty_cycle
phoenix6.controls.differential_motion_magic_voltage
phoenix6.controls.differential_position_duty_cycle
phoenix6.controls.differential_position_voltage
phoenix6.controls.differential_strict_follower
phoenix6.controls.differential_velocity_duty_cycle
phoenix6.controls.differential_velocity_voltage
phoenix6.controls.differential_voltage
phoenix6.controls.duty_cycle_out
phoenix6.controls.dynamic_motion_magic_duty_cycle
phoenix6.controls.dynamic_motion_magic_torque_current_foc
phoenix6.controls.dynamic_motion_magic_voltage
phoenix6.controls.empty_control
phoenix6.controls.follower
phoenix6.controls.motion_magic_duty_cycle
phoenix6.controls.motion_magic_expo_duty_cycle
phoenix6.controls.motion_magic_expo_torque_current_foc
phoenix6.controls.motion_magic_expo_voltage
phoenix6.controls.motion_magic_torque_current_foc
phoenix6.controls.motion_magic_velocity_duty_cycle
phoenix6.controls.motion_magic_velocity_torque_current_foc
phoenix6.controls.motion_magic_velocity_voltage
phoenix6.controls.motion_magic_voltage
phoenix6.controls.music_tone
phoenix6.controls.neutral_out
phoenix6.controls.position_duty_cycle
phoenix6.controls.position_torque_current_foc
phoenix6.controls.position_voltage
phoenix6.controls.static_brake
phoenix6.controls.strict_follower
phoenix6.controls.torque_current_foc
phoenix6.controls.velocity_duty_cycle
phoenix6.controls.velocity_torque_current_foc
phoenix6.controls.velocity_voltage
phoenix6.controls.voltage_out
phoenix6.hardware
phoenix6.signals
phoenix6.sim
phoenix6.spns
Submodules#
Package Contents#
Attributes#
- class phoenix6.AllTimestamps#
A collection of timestamps for a received signal.
- update(system_timestamp_seconds: phoenix6.units.second, system_timestamp_source: phoenix6.timestamp.TimestampSource, system_timestamp_valid: bool, canivore_timestamp_seconds: phoenix6.units.second, canivore_timestamp_source: phoenix6.timestamp.TimestampSource, canivore_timestamp_valid: bool, device_timestamp_seconds: phoenix6.units.second, device_timestamp_source: phoenix6.timestamp.TimestampSource, device_timestamp_valid: bool)#
Update this timestamp with the new timestamps
- Parameters:
system_timestamp_seconds (second) – New system timestamp seconds
system_timestamp_source (TimestampSource) – New System timestamp source
system_timestamp_valid (bool) – Whether new System timestamp is valid
canivore_timestamp_seconds (second) – New CANivore timestamp seconds
canivore_timestamp_source (TimestampSource) – New CANivore timestamp source
canivore_timestamp_valid (bool) – Whether new CANivore timestamp is valid
device_timestamp_seconds (second) – New Device timestamp seconds
device_timestamp_source (TimestampSource) – New Device timestamp source
device_timestamp_valid (bool) – Whether new Device timestamp is valid
- get_best_timestamp() phoenix6.timestamp.Timestamp #
Gets the best timestamp available.
- Returns:
Best available timestamp
- Return type:
- get_system_timestamp() phoenix6.timestamp.Timestamp #
Get the timestamp as reported by the system
- Returns:
Timestamp as reported by system
- Return type:
- get_canivore_timestamp() phoenix6.timestamp.Timestamp #
Get the timestamp as reported by the CANivore.
- Returns:
Timestamp as reported by the CANivore
- Return type:
- get_device_timestamp() phoenix6.timestamp.Timestamp #
Get the timestamp as reported by the device.
- Returns:
Timestamp as reported by the device
- Return type:
- class phoenix6.Timestamp(time: phoenix6.units.second, source: TimestampSource, is_valid: bool = True)#
Information about the timestamp of a signal.
- property time: phoenix6.units.second#
Get the time of this timestamp
- Returns:
Time of this timestamp
- Return type:
second
- property source: TimestampSource#
Get the source of this timestamp
- Returns:
Source of this timestamp
- Return type:
- property is_valid: bool#
Get whether this timestamp is valid or not
- Returns:
True if this timestamp is valid
- Return type:
bool
- update(time: phoenix6.units.second, source: TimestampSource, valid: bool)#
Update this timestamp with provided information
- Parameters:
time (second) – Time in seconds
source (TimestampSource) – Timestamp source
valid (bool) – Whether the timestamp is valid or not
- get_latency() phoenix6.units.second #
Get the latency of this timestamp compared to now
- Returns:
Difference between now and this timestamp
- Return type:
second
- phoenix6.volt#
- phoenix6.ampere#
- phoenix6.rotation#
- phoenix6.rotations_per_second#
- phoenix6.rotations_per_second_squared#
- phoenix6.rotations_per_second_cubed#
- phoenix6.degree#
- phoenix6.degrees_per_second#
- phoenix6.celsius#
- phoenix6.microsecond#
- phoenix6.millisecond#
- phoenix6.second#
- phoenix6.microtesla#
- phoenix6.g#
- phoenix6.hertz#
- class phoenix6.BaseStatusSignal(device_identifer: phoenix6.hardware.device_identifier.DeviceIdentifier, spn: int, signal_name: str, report_if_old_func: Callable[[], None])#
Bases:
abc.ABC
Common parent type for the :ref:StatusSignal: object.
This can be used for a collection of :ref:StatusSignal: objects, but we recommend using the derived class instead when possible
- property name: str#
The name of this signal.
- Returns:
The name of this signal.
- Return type:
str
- property units: str#
The units associated with this signal.
- Returns:
Units associated with this signal
- Return type:
str
- property value_as_double: float#
Gets the value as a double instead of the generic type. This may be helpful when working with the base class.
- Returns:
Signal as a double
- Return type:
float
- property all_timestamps: phoenix6.all_timestamps.AllTimestamps#
All the timestamps associated with this signal.
- Returns:
All the timestamps associated with this signal.
- Return type:
- property timestamp: phoenix6.timestamp.Timestamp#
The most accurate timestamp associated with this signal
- Returns:
The most accurate timestamp associated with this signal.
- Return type:
- property status: phoenix6.status_code.StatusCode#
The status of the last time this signal was updated.
- Returns:
Status of the last time this signal was updated.
- Return type:
- property has_updated: bool#
Check whether the signal has been updated since the last check.
Note that the signal must be refreshed before calling this routine.
- Returns:
True if the signal has updated since the previous call of this routine
- Return type:
bool
- static wait_for_all(timeout_seconds: phoenix6.units.second, *signals: BaseStatusSignal | list[BaseStatusSignal]) phoenix6.status_code.StatusCode #
Waits for new data on all provided 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 refresh_all.
- Parameters:
timeout_seconds (second) – Maximum time to wait for new data in seconds. Pass zero to refresh all signals without blocking.
signals (tuple[BaseStatusSignal | list[BaseStatusSignal], ...]) – Signals to wait for new data against
- Returns:
An InvalidParamValue if signals array 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:
- static refresh_all(*signals: BaseStatusSignal | list[BaseStatusSignal]) phoenix6.status_code.StatusCode #
Performs a non-blocking refresh on all provided signals.
This provides a performance improvement over separately calling refresh() on each signal.
- Parameters:
signals (tuple[BaseStatusSignal | list[BaseStatusSignal], ...]) – Signals to refresh
- Returns:
An InvalidParamValue if signals array 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:
- static get_latency_compensated_value(signal: StatusSignal[float], signal_slope: StatusSignal[float], max_latency_seconds: phoenix6.units.second = 0.3) float #
Performs latency compensation on signal using the signalSlope and signal’s latency to determine the magnitude of compensation. The caller must refresh these StatusSignals beforehand; this function only does the math required for latency compensation.
Important: The signalSlope must be the rate of change of the signal. If it is not the latency compensation may not perform as expected.
Example: compensatedTurns = BaseStatusSignal.get_latency_compensated_value(fx.get_position(), fx.get_velocity())
- Parameters:
signal (StatusSignal[float]) – Signal to be latency compensated. Caller must make sure this signal is up to date either by calling StatusSignal.refresh() or StatusSignal.wait_for_update(double).
signal_slope – Derivative of signal that informs compensation magnitude. Caller must make sure this signal is up to date either by calling StatusSignal.refresh() or StatusSignal.wait_for_update(double).
max_latency_seconds (second) – The maximum amount of latency to compensate for in seconds. A negative or zero value disables the max latency cap. This is used to cap the contribution of latency compensation for stale signals, such as after the device has been disconnected from the CAN bus.
- Returns:
Latency compensated value from the signal StatusSignal.
- Return type:
float
- static is_all_good(*signals: BaseStatusSignal | list[BaseStatusSignal]) bool #
Checks if all signals have an OK error code. :param signals: Signals to check error code of :type signals: tuple[BaseStatusSignal | list[BaseStatusSignal], …] :returns: True if all are good, False otherwise :rtype: bool
- static set_update_frequency_for_all(frequency_hz: phoenix6.units.hertz, *signals: BaseStatusSignal | list[BaseStatusSignal]) phoenix6.status_code.StatusCode #
Sets the update frequency of all specified 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.050 seconds (50ms) for each signal.
- Parameters:
frequency_hz (hertz) – Rate to publish the signal in Hz
signals (tuple[BaseStatusSignal | list[BaseStatusSignal], ...]) – Signals to apply the update frequency to
- Returns:
Status code of the first failed update frequency set call, or OK if all succeeded
- Return type:
- abstract set_update_frequency(frequency_hz: phoenix6.units.hertz, timeout_seconds: phoenix6.units.second = 0.05) phoenix6.status_code.StatusCode #
Sets the rate at which the device will publish this signal.
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.
- Parameters:
frequency_hz (hertz) – Rate to publish the signal in Hz
timeout_seconds (second) – Maximum amount of time to wait when performing the action
- Returns:
Status code of setting the update frequency
- Return type:
- abstract get_applied_update_frequency() phoenix6.units.hertz #
Gets the rate at which the device will publish this signal.
This is typically the last value passed into set_update_frequency. The returned value may be higher if another StatusSignal in the same status frame has been set to a higher update frequency.
- Returns:
Applied update frequency of the signal in Hz
- Return type:
hertz
- class phoenix6.StatusSignal(error: phoenix6.status_code.StatusCode, device_identifier: phoenix6.hardware.device_identifier.DeviceIdentifier, spn: int, report_if_old_func: Callable[[], None], generator: Callable[[], dict[int, StatusSignal]], signal_name: str, signal_type: type)#
Bases:
phoenix6.base_status_signal.BaseStatusSignal
,Generic
[T
]Represents a status signal with data of type T, and operations available to retrieve information about the signal.
- property value: T#
Gets the value inside this StatusSignal
- Returns:
The value of this StatusSignal
- Return type:
T
- refresh(report_error: bool = True) StatusSignal[T] #
Refreshes the value of this status signal.
If the user application caches this StatusSignal object instead of periodically fetching it from the hardware device, this function must be called to fetch fresh data.
This performs a non-blockin refresh operation. If you want to wait until you receive data, call wait_for_update instead.
- Parameters:
report_error (bool, optional) – Whether to report any errors to the console, defaults to True
- Returns:
Reference to itself
- Return type:
StatusSignal[T]
- wait_for_update(timeout_seconds: phoenix6.units.second, report_error: bool = True) StatusSignal[T] #
Waits up to timeout_seconds to get up-to-date status signal value.
This performs a blocking refresh operation. If you want to non-blocking refresh the signal, call refresh instead.
- Parameters:
timeout_seconds (second) – Maximum time to wait for a signal to update
report_error (bool, optional) – Whether to report any errors to the console, defaults to True
- Returns:
Reference to itself
- Return type:
StatusSignal[T]
- set_update_frequency(frequency_hz: phoenix6.units.hertz, timeout_seconds: phoenix6.units.second = 0.05) phoenix6.status_code.StatusCode #
Sets the rate at which the device will publish this signal.
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.
- Parameters:
frequency_hz (hertz) – Rate to publish the signal in Hz
timeout_seconds (second) – Maximum amount of time to wait when performing the action
- Returns:
Status code of setting the update frequency
- Return type:
- get_applied_update_frequency() phoenix6.units.hertz #
Gets the rate at which the device will publish this signal.
This is typically the last value passed into set_update_frequency. The returned value may be higher if another StatusSignal in the same status frame has been set to a higher update frequency.
- Returns:
Applied update frequency of the signal in Hz
- Return type:
hertz
- as_supplier() Callable[[], T] #
Returns a lambda that calls refresh and value on this object. This is useful for command-based programming.
- Returns:
Lambda that refreshes this signal and returns it
- Return type:
Callable[[], T]
- class phoenix6.SignalLogger#
Static class for controlling the Phoenix 6 signal logger.
This logs all the signals from the CAN buses into .hoot files. Each file name starts with the CANivore serial number or “rio” for the roboRIO CAN bus, followed by the timestamp. In the header of a hoot file, the CANivore name and firmware version are logged in plain text.
During an FRC match, the log file will be renamed to include the event name, match type, and match number at the start of the file name. The match type will be ‘P’ for practice matches, ‘Q’ for qualification matches, and ‘E’ for elimination matches.
- static set_path(path: str) phoenix6.status_code.StatusCode #
Sets the destination for logging, restarting logger if the path changed.
If this is not called or the path is left empty, the default path will be used. The default path on the roboRIO is a logs folder on the first USB flash drive found, or /home/lvuser/logs if none is available. The default path on all other platforms is a logs folder in the current working directory.
Typical use for this routine is to use a removable USB flash drive for logging.
- Parameters:
path (str) – Folder path for the log files; path must exist
- Returns:
Status of setting the path and restarting the log
- Return type:
- static start() phoenix6.status_code.StatusCode #
Starts logging status signals. Starts regardless of auto logging status.
If using a roboRIO 1, we recommend setting the logging path to an external drive using SetPath to avoid running out of internal storage space.
If auto logging is enabled, the log will be stopped at the end of the match.
- Returns:
Status of starting the logger
- Return type:
- static stop() phoenix6.status_code.StatusCode #
Stops logging status signals. Stops regardless of auto logging status.
- Returns:
Status of stopping the logger
- Return type:
- static enable_auto_logging(enable: bool) phoenix6.status_code.StatusCode #
Enables or disables auto logging.
Auto logging is only supported on the roboRIO. When auto logging is enabled, logging is started at the beginning of an FRC match and stopped at the end.
- Parameters:
enable (bool) – Whether to enable auto logging
- Returns:
Status of auto logging enable/disable
- Return type:
- static write_raw(name: str, data: bytes, size: int, latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the raw data bytes to the log file. The data cannot exceed 64 bytes.
- Parameters:
name (str) – Name of the signal
data (bytes) – Raw data bytes
size (int) – Size of the raw data (in bytes)
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_boolean(name: str, value: bool, latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the boolean to the log file.
- Parameters:
name (str) – Name of the signal
value – Value to write
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_integer(name: str, value: int, units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the integer to the log file.
- Parameters:
name (str) – Name of the signal
value – Value to write
units (str) – Units of the signal
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_float(name: str, value: float, units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the float to the log file.
- Parameters:
name (str) – Name of the signal
value – Value to write
units (str) – Units of the signal
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_double(name: str, value: float, units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the double to the log file.
- Parameters:
name (str) – Name of the signal
value – Value to write
units (str) – Units of the signal
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_string(name: str, value: str, latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the string to the log file. The string cannot exceed 64 characters.
- Parameters:
name (str) – Name of the signal
value – Value to write
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_boolean_array(name: str, value: list[bool], latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the array of booleans to the log file. The array cannot exceed 64 elements.
- Parameters:
name (str) – Name of the signal
value – Array of values to write
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_integer_array(name: str, value: list[int], units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the array of integers to the log file. The array cannot exceed 8 elements.
- Parameters:
name (str) – Name of the signal
value – Array of values to write
units (str) – Units of the signal
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_float_array(name: str, value: list[float], units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the array of floats to the log file. The array cannot exceed 16 elements.
- Parameters:
name (str) – Name of the signal
value – Array of values to write
units (str) – Units of the signal
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- static write_double_array(name: str, value: list[float], units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode #
Writes the array of doubles to the log file. The array cannot exceed 8 elements.
- Parameters:
name (str) – Name of the signal
value – Array of values to write
units (str) – Units of the signal
latency_seconds (second) – Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log
- Returns:
Status of writing the data
- Return type:
- class phoenix6.Orchestra(instruments: list[phoenix6.hardware.parent_device.ParentDevice] = [], filepath: str = '')#
Orchestra is used to play music through devices. It uses a “Chirp” (.chrp) music file that can be generated using Phoenix Tuner. Chirp files are generated from standard MIDI files.
Any Chirp file located in the src/main/deploy directory of your FRC project will automatically be copied to the roboRIO on code deploy.
The robot must be enabled to play music. Additionally, devices playing in Orchestra will not run any other control requests while Orchestra is running. Users can :ref:pause: or :ref:stop: the Orchestra to re-enable device control.
Each device can only play a single track within the music file. For multi-track files, multiple devices are needed. Devices can be added with an explicit track number. Otherwise, the first track will be played through the first Talon FX added, the second track will be played through the second Talon FX added, etc.
To use Orchestra:
Add the Talon FXs to be used as instruments using :ref:add_instrument:.
Load the Chirp file to be played using :ref:load_music:. This can also
be done in the Orchestra constructor.
Both of these can also be done in the Orchestra constructor.
Once ready, the Orchestra can be controlled using :ref:play:/:ref:pause:/:ref:stop:. New music files can be loaded at any time.
- Parameters:
instruments (list[ParentDevice]) – A list of devices that will be used as instruments in the orchestra
filepath (str) – The path to the music file to immediately load into the orchestra
- add_instrument(instrument: phoenix6.hardware.parent_device.ParentDevice) phoenix6.status_code.StatusCode #
Adds an instrument to the orchestra.
- Parameters:
instrument (ParentDevice) – The device to add to the orchestra
- Returns:
Status code of adding the device
- Return type:
- add_instrument_with_track(instrument: phoenix6.hardware.parent_device.ParentDevice, track_number: int) phoenix6.status_code.StatusCode #
Adds an instrument to the orchestra on the given track.
- Parameters:
instrument (ParentDevice) – The device to add to the orchestra
track_number (int) – The track number the device should play, starting at 0
- Returns:
Status code of adding the device
- Return type:
- clear_instruments() phoenix6.status_code.StatusCode #
Clears all instruments in the orchestra.
- Returns:
Status code of clearing all devices
- Return type:
- load_music(filepath: str) phoenix6.status_code.StatusCode #
Loads a Chirp file at the specified file path.
If the Chirp file is inside your “src/main/deploy” directory, it will be automatically deployed to a default directory on the roboRIO when you deploy code. For these files, the name and file extension is sufficient.
A Chirp file can be created from a MIDI file using Phoenix Tuner.
- Parameters:
filepath (str) – The path to the Chirp file
- Returns:
Status code of loading the Chirp file
- Return type:
- play() phoenix6.status_code.StatusCode #
Plays the loaded music file. If the player is paused, this will resume the orchestra.
- Returns:
Status code of playing the orchestra
- Return type:
- pause() phoenix6.status_code.StatusCode #
Pauses the loaded music file. This saves the current position in the track so it can be resumed later.
- Returns:
Status code of pausing the orchestra
- Return type:
- stop() phoenix6.status_code.StatusCode #
Stops the loaded music file. This resets the current position in the track to the start.
- Returns:
Status code of stopping the orchestra
- Return type:
- is_playing() bool #
Gets whether the current track is actively playing.
- Returns:
True if Orchestra is playing the music file
- Return type:
bool
- get_current_time() phoenix6.units.second #
Gets the current timestamp of the music file. The timestamp will reset to zero whenever :ref:load_music: or :ref:stop: is called.
If :ref:isPlaying: returns false, this method can be used to determine if the music is stopped or paused.
- Returns:
The current timestamp of the music file, in seconds
- Return type:
second
- class phoenix6.CANBus#
Static class for getting information about available CAN buses.
- static is_network_fd(canbus: str) bool #
Gets whether the CAN bus is a CAN FD network.
- Parameters:
canbus (str) – Name of the CAN bus
- Returns:
True if the CAN bus is CAN FD
- Return type:
bool
- static get_status(canbus: str) CANBusStatus #
Gets the status of the CAN bus, including the bus utilization and the error counters.
- Parameters:
canbus (str) – Name of the CAN bus
- Returns:
Status of the CAN bus
- Return type:
- class phoenix6.StatusCode(*args, **kwds)#
Bases:
enum.Enum
Status codes reported by APIs, including OK, warnings, and errors.
- property name: str#
Gets the name of this StatusCode.
- Returns:
Name of this StatusCode
- Return type:
str
- property description: str#
Gets the description of this StatusCode.
- Returns:
Description of this StatusCode
- Return type:
str
- OK = 0#
No Error
- TASK_IS_BUSY#
Diagnostic Server is busy with another command.
- INVALID_DEVICE_SPEC#
InvalidDeviceSpec
- ECU_IS_NOT_PRESENT#
Device is not present. Verify the device is connected and powered, and that the CAN bus is terminated.
- COULD_NOT_ENTER_BL#
Could not put the device into bootloader mode.
- COULD_NOT_CONFIRM_BL#
Could not confirm the device has entered the bootloader.
- COULD_NOT_ERASE#
Could not erase flash.
- COULD_NOT_SEND_FLASH#
Could not field upgrade the device.
- COULD_NOT_VALIDATE#
Bootloader could not verify integrity of the flashed application.
- COULD_NOT_RUN_APP#
Could not run the device firmware application.
- COULD_NOT_REQ_SET_ID#
Unable to set ID to this device.
- COULD_NOT_CONFIRM_ID#
Could not verify that the changed ID took effect.
- FLASH_WAS_GOOD#
Device field upgrade was successful.
- APP_TOO_OLD#
Device firmware application is too old.
- COULD_NOT_REQ_SET_DESC#
Unable to set name to this device.
- COMPILE_SZ_IS_WRONG#
CompileSzIsWrong
- GADGETEER_DEVICE_NO_SET_ID#
Cannot set the ID of a gadgeteer device.
- INVALID_TASK#
This diagnostic action is not supported.
- NOT_IMPLEMENTED#
Not Implemented, check latest installer.
- NO_DEVICES_ON_BUS#
NoDevicesOnBus
- MORE_THAN_ONE_FILE#
MoreThanOneFile
- NODE_IS_INVALID#
Specified device was not found. Verify the device is connected and powered, and that the CAN bus is terminated.
- INVALID_DEVICE_DESCRIPTOR#
InvalidDeviceDescriptor
- COULD_NOT_SEND_CAN_FRAME#
CouldNotSendCanFrame
- NORMAL_MODE_MSG_NOT_PRESENT#
NormalModeMsgNotPresent
- FEATURE_NOT_SUPPORTED#
This feature is not supported.
- NOT_UPDATING#
The diagnostic server is not field upgrading any devices.
- CORRUPTED_POST#
CorruptedPOST
- NO_CONFIGS#
This device did not report any available configs. Verify firmware and diagnostics are up-to-date.
- CONFIG_FAILED#
ConfigFailed
- COULD_NOT_REQ_FACTORY_DEFAULT#
Unable to factory default this device.
- CUSTOM_NAME_NOT_SUPPORTED#
CustomNameNotSupported
- CONFIG_READ_WRITE_MISMATCH#
The configs read from the device do not match the configs that were written.
- COULD_NOT_REQ_SET_CONFIGS#
Could not apply the device configs.
- INSUFFICIENT_SZ#
InsufficientSz
- INVALID_MODEL#
This feature is not supported for this device model.
- COULD_NOT_REQ_DEV_INFO#
CouldNotReqDevInfo
- NO_CONTROLS#
This device does not support new controls.
- DEVICE_IS_NULL#
DeviceIsNull
- DEVICE_DID_NOT_RESPOND_TO_DIAG_REQ#
DeviceDidNotRespondToDiagReq
- ONLY_SUPPORTED_IN_TUNERX#
This feature requires Tuner X.
- CANIV_CLI_ERROR#
Command-line issue with caniv.
- INVALID_CRF_BAD_HEADER#
InvalidCrfBadHeader
- INVALID_CRF_FILE_SZ_INVALD#
InvalidCrfFileSzInvald
- INVALID_CRF_WRONG_PRODUCT#
Specified CRF is for the wrong product.
- INVALID_CRF_NO_SECTS#
InvalidCrfNoSects
- INVALID_CRF_BAD_SECT_HEADER#
InvalidCrfBadSectHeader
- INVALID_CRF_BAD_SECT_SIZE#
InvalidCrfBadSectSize
- NO_CRF_FILE#
Specified CRF file could not be found.
- COULD_NOT_FIND_DYNAMIC_ID#
CouldNotFindDynamicId
- DID_NOT_GET_DHCP#
DidNotGetDhcp
- DID_NOT_GET_FULL_DHCP#
DidNotGetFullDhcp
- INVALID_LICENSE_RESP#
InvalidLicenseResp
- INVALID_CANIV_CACHE#
InvalidCanivCache
- CANNOT_OPEN_SERIAL_PORT#
CannotOpenSerialPort
- CANNOT_WRITE_SERIAL_PORT#
CannotWriteSerialPort
- CANNOT_READ_SERIAL_PORT#
CannotReadSerialPort
- CANNOT_SERIAL_TO_DEVICE#
CannotSerialToDevice
- NO_SERIAL_CONTROL_FRAME_RESP#
NoSerialControlFrameResp
- CANNOT_OPEN_UDP_PORT#
CannotOpenUdpPort
- CANNOT_WRITE_UDP_PORT#
CannotWriteUdpPort
- CANNOT_READ_UDP_PORT#
CannotReadUdpPort
- CANNOT_UDP_TO_DEVICE#
CannotUdpToDevice
- NO_UDP_CONTROL_FRAME_RESP#
NoUdpControlFrameResp
- TIMEOUT_ISO15_RESPONSE#
TimeoutIso15Response
- INVALID_JSON#
InvalidJson
- APP_IS_TERMINATING#
The user application is shutting down.
- CAN_MESSAGE_STALE = 1000#
CAN Message is stale.
- BUFFER_FULL = 1006#
Buffer is full, cannot insert more data.
- PULSE_WIDTH_SENSOR_NOT_PRESENT = 1010#
PulseWidthSensorNotPresent
- GENERAL_WARNING = 1100#
General Warning Occurred.
- FIRM_VERSION_COULD_NOT_BE_RETRIEVED = 1103#
Firm Vers could not be retrieved. Use Phoenix Tuner X to check ID and firmware(CRF) version.
- FEATURES_NOT_AVAILABLE_YET = 1104#
This feature will be supported in a future update.
- CONTROL_MODE_NOT_VALID = 1105#
The control mode is not valid for this function.
- CONTROL_MODE_NOT_SUPPORTED_YET = 1106#
This control mode is not supported yet. A future release will supported this soon.
- MOT_PROF_FIRM_THRESHOLD = 1109#
Motor Controller must have >= 3.2 firmware for motion profile control mode.
- MOT_PROF_FIRM_THRESHOLD2 = 1110#
Motor Controller must have >= 3.4 firmware for advanced PID0/PID1 features.
- SIM_DEVICE_NOT_FOUND = 1200#
SimDeviceNotFound
- SIM_PHYSICS_TYPE_NOT_SUPPORTED = 1201#
SimPhysicsTypeNotSupported
- SIM_DEVICE_ALREADY_EXISTS = 1202#
SimDeviceAlreadyExists
- TX_FAILED#
Could not transmit CAN Frame.
- INVALID_PARAM_VALUE#
An invalid argument was passed into the function/VI, such as a null pointer.
- RX_TIMEOUT#
CAN frame not received/too-stale. Check the CAN bus wiring, CAN bus utilization, and power to the device.
- TX_TIMEOUT#
CAN Transmit timed out.
- UNEXPECTED_ARB_ID#
ArbID is incorrect.
- CAN_OVERFLOWED#
CanOverflowed
- SENSOR_NOT_PRESENT#
Sensor Not Present.
- FIRMWARE_TOO_OLD#
Firmware Too Old. Use Phoenix Tuner X to field upgrade your CTRE CAN device firmware(CRF). Then restart your robot application to clear this error.
- COULD_NOT_CHANGE_PERIOD#
Control Frame Period could not be changed. Most likely it is not being transmitted.
- BUFFER_FAILURE#
BufferFailure
- FIRMWARE_NON_FRC#
Firmware is legacy non-FRC version. Use Phoenix Tuner X to field upgrade your CTRE CAN device firmware(CRF). Firmware greater than 20.0 required.
- GENERAL_ERROR#
General Error Occurred.
- SIG_NOT_UPDATED#
No new response to update signal.
- NOT_ALL_PIDVALUES_UPDATED#
NotAllPIDValuesUpdated
- GEN_PORT_ERROR#
GEN_PORT_ERROR
- PORT_MODULE_TYPE_MISMATCH#
PORT_MODULE_TYPE_MISMATCH
- GEN_MODULE_ERROR#
GEN_MODULE_ERROR
- MODULE_NOT_INIT_SET_ERROR#
MODULE_NOT_INIT_SET_ERROR
- MODULE_NOT_INIT_GET_ERROR#
MODULE_NOT_INIT_GET_ERROR
- WHEEL_RADIUS_TOO_SMALL#
Wheel Radius is too small, cannot get distance traveled.
- TICKS_PER_REV_ZERO#
Ticks per revolution is 0, cannot get heading.
- DISTANCE_BETWEEN_WHEELS_TOO_SMALL#
Distance between wheels is too small, cannot get heading.
- GAINS_ARE_NOT_SET#
GainsAreNotSet
- WRONG_REMOTE_LIMIT_SWITCH_SOURCE#
Use RemoteLimitSwitchSource instead of LimitSwitchSource.
- DOUBLE_VOLTAGE_COMPENSATING_WPI#
Motor Controller Voltage Compensation should not be used with setVoltage(). This causes compensation to happen twice. Disable Voltage Compensation by calling enableVoltageCompensation(false) in order to use setVoltage().
- CANDLE_ANIM_SLOT_OUT_OF_BOUNDS#
CANdleAnimSlotOutOfBounds
- INCOMPATIBLE_MODE#
IncompatibleMode
- INVALID_HANDLE#
Handle passed into function is incorrect.
- FEATURE_REQUIRES_HIGHER_FIRM#
Features requires newer firmware version.
- CONFIG_FACTORY_DEFAULT_REQUIRES_HIGHER_FIRM#
Config factory default features require firmware >=3.10.
- CONFIG_MOTION_SCURVE_REQUIRES_HIGHER_FIRM#
Config Motion S Curve Strength features require firmware >=4.16.
- TALON_FXFIRMWARE_PRE_VBAT_DETECT#
Talon FX(Falcon 500) Firmware Too Old. Use Phoenix Tuner to field upgrade your CTRE CAN device firmware(CRF) to >=20.3. Then restart your robot application to clear this error.
- CANDLE_ANIMATIONS_REQUIRE_HIGHER_FIRM#
CANdleAnimationsRequireHigherFirm
- LIBRARY_COULD_NOT_BE_LOADED#
LibraryCouldNotBeLoaded
- MISSING_ROUTINE_IN_LIBRARY#
MissingRoutineInLibrary
- RESOURCE_NOT_AVAILABLE#
ResourceNotAvailable
- MUSIC_FILE_NOT_FOUND#
Could not find music file specified, try specifying an absolute path.
- MUSIC_FILE_WRONG_SIZE#
Music file size is incorrect, could not parse correctly. Ensure you’re using Tuner to generate file.
- MUSIC_FILE_TOO_NEW#
Music file version is too new, update Phoenix to utilize this file.
- MUSIC_FILE_INVALID#
Music file is invalid. Ensure you’re using Tuner to generate file.
- INVALID_ORCHESTRA_ACTION#
An invalid orchestra action occurred. Ensure a music file is loaded.
- MUSIC_FILE_TOO_OLD#
This music file version is too old. Regenerate file using Tuner.
- MUSIC_INTERRUPTED#
Music interrupted due to one of the instruments being commanded a different control mode. Press Play to resume music.
- MUSIC_NOT_SUPPORTED#
This device doesn’t support MusicTone control mode.
- INVALID_INTERFACE#
kInvalidInterface
- INVALID_GUID#
kInvalidGuid
- INVALID_CLASS#
kInvalidClass
- INVALID_PROTOCOL#
kInvalidProtocol
- INVALID_PATH#
kInvalidPath
- GENERAL_WIN_USB_ERROR#
kGeneralWinUsbError
- FAILED_SETUP#
kFailedSetup
- LISTEN_FAILED#
kListenFailed
- SEND_FAILED#
kSendFailed
- RECEIVE_FAILED#
kReceiveFailed
- INVALID_RESP_FORMAT#
kInvalidRespFormat
- WIN_USB_INIT_FAILED#
kWinUsbInitFailed
- WIN_USB_QUERY_FAILED#
kWinUsbQueryFailed
- WIN_USB_GENERAL_ERROR#
kWinUsbGeneralError
- ACCESS_DENIED#
kAccessDenied
- FIRMWARE_INVALID_RESPONSE#
kFirmwareInvalidResponse
- STATUS_CODE_NOT_INITIALIZED#
This StatusCode has not been initialized. Make sure the StatusCode is getting assigned to the return of a method.
- WARNING_NOT_INITIALIZED = 10000#
WarningNotInitialized
- HW_TIMESTAMP_OUT_OF_SYNC = 10001#
The timestamp reported by CANivore is at least 10ms older than the timestamp reported by the system, indicating it’s fallen out of sync. This does not impact the data of this message, only the timing.
- INVALID_NETWORK#
InvalidNetwork
- MULTI_SIGNAL_NOT_SUPPORTED#
The CAN bus does not support multi-signal synchronization.
- COULD_NOT_CAST#
Could not cast from base value to this particular signal’s type
- NOT_FOUND#
Could not find this value when searching for it
- NOT_SUPPORTED#
This is not supported
- MISSING_CONTEXT#
Could not determine context from this device hash
- MODEL_MISMATCH#
Model name in license file does not match model name of selected device.
- SERIAL_MISMATCH#
Serial Number in license file does not match model name of selected device.
- NO_FILE#
Could not find specified file.
- LICENSE_DOWNLOAD_FAILED#
License did not successfully download to Device.
- SELF_TEST_IS_EMPTY#
Self Test report does not have any values, is the firmware up to date?
- SIGNAL_LOOKUP_FAILED#
Failed to lookup signal properties. This can happen if the fimware is too new and supports signals that older APIs do not support.
- INVALID_MODE_TO_GET_SIGNAL#
The current mode of the device is invalid for getting this signal.
- UNLICENSED_DEVICE#
Device is not licensed. Cannot get any data from it.
- INVALID_SIZE#
Size is invalid.
- INVALID_LICENSE_RESPONSE#
InvalidLicenseResponse
- INVALID_CONTEXT#
InvalidContext
- INTERNAL_ERROR#
InternalError
- DEVICE_RESPONSE_INCORRECT#
kDeviceResponseIncorrect
- ERROR_POLLING_FOR_DEVICES#
kErrorPollingForDevices
- COULD_NOT_RETRIEVEV6_FIRMWARE#
Device firmware could not be retrieved. Check that the device is running v6 firmware, the device ID is correct, the specified CAN bus is correct, and the device is powered.
- COULD_NOT_DECODE_DEVICE_FIRMWARE#
Device firmware could not be decoded. Check that the device is running v6 firmware, the device ID is correct, the specified CAN bus is correct, and the device is powered.
- INVALID_IDTO_FOLLOW#
The values specified for master are in valid. Make sure the Device ID of master are correct.
- USING_PRO_FEATURE_ON_UNLICENSED_DEVICE#
Using a Pro only feature on an unlicensed device. The device may not behave as expected if it continues to operate while unlicensed.
- FIRMWARE_TOO_NEW#
Firmware Too New. Use Phoenix Tuner X to field upgrade your CTRE CAN device firmware(CRF) to a compatible version. Then restart your robot application to clear this error.
- COULD_NOT_SERIALIZE#
The data frame could not be serialized for transmit.
- MECHANISM_FAULTED#
The mechanism is disabled due to a fault in one of the devices.
- FIRMWARE_VERS_NOT_COMPATIBLE#
Firmware version is not compatible with this version of Phoenix. Make sure your firmware and API major versions match.
- DIRECTORY_MISSING#
Could not find specified directory.
- API_TOO_OLD#
This API version is too old for the firmware on the device. Either upgrade the API to a newer version or downgrade the device firmware to an older version for correct behavior.
- LOGGER_NOT_RUNNING#
The signal logger is not running. Start the signal logger before writing any signals.
- TIMEOUT_CANNOT_BE_ZERO#
Blocking operations, such as configs, cannot have a timeout of 0. Pass in a non-zero timeout (typically 0.050+ seconds) for normal operation.
- CANNOT_LICENSE_WHILE_ENABLED#
Device cannot be licensed while it is control enabled. Disable and neutral the device to apply the licenses.
- is_error() bool #
Gets whether this code is an error.
- Returns:
True if this code is an error
- Return type:
bool
- is_warning() bool #
Gets whether this code is a warning.
- Returns:
True if this code is a warning
- Return type:
bool
- is_ok() bool #
Gets whether this code is OK.
- Returns:
True if this code is OK
- Return type:
bool