Parent class for all devices.
More...
#include <ctre/phoenix6/hardware/ParentDevice.hpp>
|
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>> |
static ctre::phoenix::StatusCode | OptimizeBusUtilizationForAll (Devices &... devices) |
| Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals. More...
|
|
static ctre::phoenix::StatusCode | OptimizeBusUtilizationForAll (const std::vector< ParentDevice * > &devices) |
| Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals. More...
|
|
template<size_t N> |
static ctre::phoenix::StatusCode | OptimizeBusUtilizationForAll (const std::array< ParentDevice *, N > &devices) |
| Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals. More...
|
|
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>> |
static ctre::phoenix::StatusCode | OptimizeBusUtilizationForAll (units::frequency::hertz_t optimizedFreqHz, Devices &... devices) |
| Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals. More...
|
|
static ctre::phoenix::StatusCode | OptimizeBusUtilizationForAll (units::frequency::hertz_t optimizedFreqHz, const std::vector< ParentDevice * > &devices) |
| Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals. More...
|
|
template<size_t N> |
static ctre::phoenix::StatusCode | OptimizeBusUtilizationForAll (units::frequency::hertz_t optimizedFreqHz, const std::array< ParentDevice *, N > &devices) |
| Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals. More...
|
|
Parent class for all devices.
◆ ParentDevice() [1/2]
ctre::phoenix6::hardware::ParentDevice::ParentDevice |
( |
int |
deviceID, |
|
|
std::string |
model, |
|
|
std::string |
canbus |
|
) |
| |
|
inline |
◆ ~ParentDevice()
virtual ctre::phoenix6::hardware::ParentDevice::~ParentDevice |
( |
| ) |
|
|
virtualdefault |
◆ ParentDevice() [2/2]
ctre::phoenix6::hardware::ParentDevice::ParentDevice |
( |
ParentDevice && |
| ) |
|
|
default |
◆ GetAppliedControl() [1/2]
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.
- Returns
- Latest applied control
◆ GetAppliedControl() [2/2]
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.
- Returns
- Latest applied control
◆ GetDeviceHash()
uint64_t ctre::phoenix6::hardware::ParentDevice::GetDeviceHash |
( |
| ) |
const |
|
inline |
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.
◆ GetDeviceID()
int ctre::phoenix6::hardware::ParentDevice::GetDeviceID |
( |
| ) |
const |
|
inline |
- Returns
- The device ID of this device [0,62].
◆ GetGenericSignal()
StatusSignal< double > & ctre::phoenix6::hardware::ParentDevice::GetGenericSignal |
( |
uint32_t |
signal | ) |
|
|
inline |
This is a reserved routine for internal testing.
Use the other get routines to retrieve signal values.
- Parameters
-
- Returns
- StatusSignalValue holding value
◆ GetNetwork()
const std::string & ctre::phoenix6::hardware::ParentDevice::GetNetwork |
( |
| ) |
const |
|
inline |
- Returns
- Name of the network this device is on.
◆ GetResetOccurredChecker()
std::function< bool()> ctre::phoenix6::hardware::ParentDevice::GetResetOccurredChecker |
( |
| ) |
const |
|
inline |
- Returns
- a function that checks for device resets.
◆ HasResetOccurred()
bool ctre::phoenix6::hardware::ParentDevice::HasResetOccurred |
( |
| ) |
|
|
inline |
- Returns
- true if device has reset since the previous call of this routine.
◆ LookupDimensionlessStatusSignal()
template<typename T , typename U >
StatusSignal< T > ctre::phoenix6::hardware::ParentDevice::LookupDimensionlessStatusSignal |
( |
uint16_t |
spn, |
|
|
std::string |
signalName |
|
) |
| |
|
inlineprotected |
Returns a unitless version of the StatusSignal by value.
Do not store the result in a reference.
◆ LookupStatusSignal() [1/2]
template<typename T >
StatusSignal< T > & ctre::phoenix6::hardware::ParentDevice::LookupStatusSignal |
( |
uint16_t |
spn, |
|
|
std::string |
signalName, |
|
|
bool |
reportOnConstruction |
|
) |
| |
|
inlineprotected |
◆ LookupStatusSignal() [2/2]
template<typename T >
StatusSignal< T > & ctre::phoenix6::hardware::ParentDevice::LookupStatusSignal |
( |
uint16_t |
spn, |
|
|
uint16_t |
mapper_iter, |
|
|
std::function< std::map< int, StatusSignal< T > >()> |
map_filler, |
|
|
std::string |
signalName, |
|
|
bool |
reportOnConstruction |
|
) |
| |
|
inlineprotected |
◆ operator=()
◆ OptimizeBusUtilization()
ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilization |
( |
units::frequency::hertz_t |
optimizedFreqHz = 0_Hz , |
|
|
units::time::second_t |
timeoutSeconds = 50_ms |
|
) |
| |
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 disabled. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
- Parameters
-
optimizedFreqHz | The update frequency to apply to the optimized status signals. A frequency of 0 Hz (default) will turn off the signals. Otherwise, the minimum supported signal frequency is 4 Hz. |
timeoutSeconds | 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
◆ OptimizeBusUtilizationForAll() [1/6]
template<size_t N>
static ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilizationForAll |
( |
const std::array< ParentDevice *, N > & |
devices | ) |
|
|
inlinestatic |
Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be disabled. 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 in the robot program for the provided devices. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
This will wait up to 0.050 seconds (50ms) for each status frame.
- Parameters
-
devices | Devices for which to optimize bus utilization, passed as an array of device addresses. |
- Returns
- Status code of the first failed optimize call, or OK if all succeeded
◆ OptimizeBusUtilizationForAll() [2/6]
static ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilizationForAll |
( |
const std::vector< ParentDevice * > & |
devices | ) |
|
|
inlinestatic |
Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be disabled. 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 in the robot program for the provided devices. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
This will wait up to 0.050 seconds (50ms) for each status frame.
- Parameters
-
devices | Devices for which to optimize bus utilization, passed as a vector or initializer list of device addresses. |
- Returns
- Status code of the first failed optimize call, or OK if all succeeded
◆ OptimizeBusUtilizationForAll() [3/6]
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>>
static ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilizationForAll |
( |
Devices &... |
devices | ) |
|
|
inlinestatic |
Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be disabled. 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 in the robot program for the provided devices. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
This will wait up to 0.050 seconds (50ms) for each status frame.
- Parameters
-
devices | Devices for which to optimize bus utilization, passed as a comma-separated list of device references. |
- Returns
- Status code of the first failed optimize call, or OK if all succeeded
◆ OptimizeBusUtilizationForAll() [4/6]
template<size_t N>
static ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilizationForAll |
( |
units::frequency::hertz_t |
optimizedFreqHz, |
|
|
const std::array< ParentDevice *, N > & |
devices |
|
) |
| |
|
inlinestatic |
Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be disabled. 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 in the robot program for the provided devices. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
This will wait up to 0.050 seconds (50ms) for each status frame.
- Parameters
-
optimizedFreqHz | The update frequency to apply to the optimized status signals. A frequency of 0 Hz (default) will turn off the signals. Otherwise, the minimum supported signal frequency is 4 Hz. |
devices | Devices for which to optimize bus utilization, passed as an array of device addresses. |
- Returns
- Status code of the first failed optimize call, or OK if all succeeded
◆ OptimizeBusUtilizationForAll() [5/6]
static ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilizationForAll |
( |
units::frequency::hertz_t |
optimizedFreqHz, |
|
|
const std::vector< ParentDevice * > & |
devices |
|
) |
| |
|
inlinestatic |
Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be disabled. 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 in the robot program for the provided devices. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
This will wait up to 0.050 seconds (50ms) for each status frame.
- Parameters
-
optimizedFreqHz | The update frequency to apply to the optimized status signals. A frequency of 0 Hz (default) will turn off the signals. Otherwise, the minimum supported signal frequency is 4 Hz. |
devices | Devices for which to optimize bus utilization, passed as a vector or initializer list of device addresses. |
- Returns
- Status code of the first failed optimize call, or OK if all succeeded
◆ OptimizeBusUtilizationForAll() [6/6]
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>>
static ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::OptimizeBusUtilizationForAll |
( |
units::frequency::hertz_t |
optimizedFreqHz, |
|
|
Devices &... |
devices |
|
) |
| |
|
inlinestatic |
Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
All status signals that have not been explicitly given an update frequency using BaseStatusSignal::SetUpdateFrequency will be disabled. 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 in the robot program for the provided devices. 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, remove this method call, redeploy the robot application, and power-cycle the devices on the bus. Alternatively, the user can override individual status update frequencies using BaseStatusSignal::SetUpdateFrequency.
This will wait up to 0.050 seconds (50ms) for each status frame.
- Parameters
-
optimizedFreqHz | The update frequency to apply to the optimized status signals. A frequency of 0 Hz (default) will turn off the signals. Otherwise, the minimum supported signal frequency is 4 Hz. |
devices | Devices for which to optimize bus utilization, passed as a comma-separated list of device references. |
- Returns
- Status code of the first failed optimize call, or OK if all succeeded
◆ SetControlPrivate()
virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::ParentDevice::SetControlPrivate |
( |
controls::ControlRequest & |
request | ) |
|
|
protectedvirtual |
◆ _emptyControl
◆ deviceIdentifier
◆ is_all_device_v
template<typename... Devices>
constexpr bool ctre::phoenix6::hardware::ParentDevice::is_all_device_v = is_all_device<Devices...>::value |
|
staticconstexprprotected |
The documentation for this class was generated from the following file: