|
CTRE Phoenix 6 C++ 26.0.0-beta-1
|
Contains everything common between Phoenix 6 devices. More...
#include <ctre/phoenix6/hardware/traits/CommonDevice.hpp>
Public Member Functions | |
| virtual | ~CommonDevice ()=default |
| virtual int | GetDeviceID () const =0 |
| virtual CANBus | GetNetwork () const =0 |
| virtual uint64_t | GetDeviceHash () const =0 |
| Gets a number unique for this device's hardware type and ID. | |
| virtual std::shared_ptr< controls::ControlRequest const > | GetAppliedControl () const =0 |
| Get the latest applied control. | |
| virtual std::shared_ptr< controls::ControlRequest > | GetAppliedControl ()=0 |
| Get the latest applied control. | |
| virtual bool | HasResetOccurred ()=0 |
| virtual std::function< bool()> | GetResetOccurredChecker () const =0 |
| virtual bool | IsConnected (units::second_t maxLatencySeconds=500_ms)=0 |
| Returns whether the device is still connected to the robot. | |
| virtual ctre::phoenix::StatusCode | OptimizeBusUtilization (units::frequency::hertz_t optimizedFreqHz=4_Hz, units::time::second_t timeoutSeconds=100_ms)=0 |
| Optimizes the device's bus utilization by reducing the update frequencies of its status signals. | |
| virtual ctre::phoenix::StatusCode | ResetSignalFrequencies (units::time::second_t timeoutSeconds=100_ms)=0 |
| Resets the update frequencies of all the device's status signals to the defaults. | |
Contains everything common between Phoenix 6 devices.
|
virtualdefault |
|
pure virtual |
Get the latest applied control.
Caller can cast this to the derived class if they know its type. Otherwise, use controls::ControlRequest::GetControlInfo to get info out of it.
This returns a shared pointer to avoid becoming a dangling pointer due to parallel operations changing the underlying data. Make sure to save the shared_ptr to a variable before chaining function calls, otherwise the data may be freed early.
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Get the latest applied control.
Caller can cast this to the derived class if they know its type. Otherwise, use controls::ControlRequest::GetControlInfo to get info out of it.
This returns a shared pointer to avoid becoming a dangling pointer due to parallel operations changing the underlying data. Make sure to save the shared_ptr to a variable before chaining function calls, otherwise the data may be freed early.
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
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.
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Returns whether the device is still connected to the robot.
This is equivalent to refreshing and checking the latency of the Version status signal.
| maxLatencySeconds | The maximum latency of the Version status signal before the device is reported as disconnected |
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
Optimizes the device's bus utilization by reducing the update frequencies of its status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be slowed down. Note that if other status signals in the same status 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 ResetSignalFrequencies. 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::SetUpdateFrequency.
| optimizedFreqHz | 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). |
| timeoutSeconds | Maximum amount of time to wait for each status frame when performing the action |
Implemented in ctre::phoenix6::hardware::ParentDevice.
|
pure virtual |
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::SetUpdateFrequency and status signals optimized out using OptimizeBusUtilization.
| timeoutSeconds | Maximum amount of time to wait for each status frame when performing the action |
Implemented in ctre::phoenix6::hardware::ParentDevice.