Class that provides operations to retrieve information about a status signal.
More...
#include <ctre/phoenix6/StatusSignal.hpp>
|
static ctre::phoenix::StatusCode | Status_WaitForAll (std::initializer_list< BaseStatusSignal * > signals, const char *network, units::time::second_t timeoutSeconds) |
| Wait for multiple signals to arrive. More...
|
|
static ctre::phoenix::StatusCode | Status_WaitForAll (const std::vector< BaseStatusSignal * > &signals, const char *network, units::time::second_t timeoutSeconds) |
| Wait for multiple signals to arrive. More...
|
|
static std::string | Status_GetUnits (uint32_t signal) |
| Gets signal units. More...
|
|
static ctre::phoenix::StatusCode | Status_Get (const char *network, int deviceHash, uint32_t signal, bool bWaitForUpdate, units::time::second_t timeoutSeconds, double *outValue, double *hwtimestamp, double *swtimestamp, double *ecutimestamp, int32_t *timestampType) |
| Get signal update. More...
|
|
Class that provides operations to retrieve information about a status signal.
◆ BaseStatusSignal() [1/2]
ctre::phoenix6::BaseStatusSignal::BaseStatusSignal |
( |
hardware::DeviceIdentifier |
deviceIdentifier, |
|
|
uint16_t |
spn, |
|
|
std::string |
signalName |
|
) |
| |
|
inlineprotected |
◆ BaseStatusSignal() [2/2]
ctre::phoenix6::BaseStatusSignal::BaseStatusSignal |
( |
ctre::phoenix::StatusCode |
error | ) |
|
|
inlineprotected |
◆ ~BaseStatusSignal()
virtual ctre::phoenix6::BaseStatusSignal::~BaseStatusSignal |
( |
| ) |
|
|
pure virtual |
◆ CopyFrom()
void ctre::phoenix6::BaseStatusSignal::CopyFrom |
( |
const BaseStatusSignal & |
other | ) |
|
|
inlineprotected |
◆ GetAllTimestamps()
const AllTimestamps & ctre::phoenix6::BaseStatusSignal::GetAllTimestamps |
( |
| ) |
const |
|
inline |
Get the timestamps of this signals.
- Returns
- All timestamps for this signal
◆ GetError()
ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::GetError |
( |
| ) |
const |
|
inline |
Get the error code from when we last received this signal.
- Returns
- Last cached Error Code
◆ GetLatencyCompensatedValue()
template<typename U , typename U_PER_SEC >
static U ctre::phoenix6::BaseStatusSignal::GetLatencyCompensatedValue |
( |
StatusSignal< U > & |
signal, |
|
|
StatusSignal< U_PER_SEC > & |
signalSlope |
|
) |
| |
|
inlinestatic |
◆ GetTimestamp()
const Timestamp & ctre::phoenix6::BaseStatusSignal::GetTimestamp |
( |
| ) |
const |
|
inline |
Get the best timestamp available to this signal.
- Returns
- Best available timestamp for this signal
◆ GetUnits()
const std::string & ctre::phoenix6::BaseStatusSignal::GetUnits |
( |
| ) |
const |
|
inline |
Gets the units for this signal.
- Returns
- String representation of units for this signal
◆ IsAllGood()
static ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::IsAllGood |
( |
std::initializer_list< BaseStatusSignal * > |
signals | ) |
|
|
inlinestatic |
Checks if all signals have an OK error code.
- Parameters
-
signals | Signals to check error code of. |
- Returns
- True if all signals are OK, false otherwise
◆ SetUpdateFrequency() [1/2]
ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::SetUpdateFrequency |
( |
const char * |
canbus, |
|
|
uint32_t |
deviceHash, |
|
|
uint16_t |
spn, |
|
|
units::frequency::hertz_t |
frequencyHz, |
|
|
units::time::second_t |
timeoutSeconds |
|
) |
| |
|
protected |
◆ SetUpdateFrequency() [2/2]
ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::SetUpdateFrequency |
( |
units::frequency::hertz_t |
frequencyHz, |
|
|
units::time::second_t |
timeoutSeconds = 50_ms |
|
) |
| |
|
inline |
Sets the rate at which the device will publish this signal.
The minimum supported signal frequency is 4 Hz, and the maximum is 1000 Hz.
- Parameters
-
frequencyHz | Rate to publish the signal in Hz. |
timeoutSeconds | Maximum amount of time to wait when performing the action |
- Returns
- Status code of setting the update frequency
◆ Status_Get()
static ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::Status_Get |
( |
const char * |
network, |
|
|
int |
deviceHash, |
|
|
uint32_t |
signal, |
|
|
bool |
bWaitForUpdate, |
|
|
units::time::second_t |
timeoutSeconds, |
|
|
double * |
outValue, |
|
|
double * |
hwtimestamp, |
|
|
double * |
swtimestamp, |
|
|
double * |
ecutimestamp, |
|
|
int32_t * |
timestampType |
|
) |
| |
|
staticprotected |
Get signal update.
Caller either get last received, or wait for an update.
- Parameters
-
network | Name of bus (can, canfd, canivore-name, future protocols) |
deviceHash | Hash id of the device (based on device id and model) |
signal | Signal to get |
bWaitForUpdate | If true, API will wait up to timeoutSeconds for an update. If false, routine will poll last received and use timeoutSeconds to return error code if too old. |
timeoutSeconds | How long to wait or how old the signal can be before error'ing |
outValue | Value of the signal |
hwtimestamp | Timestamp of the signal |
swtimestamp | Timestamp of the signal |
ecutimestamp | Timestamp of the signal |
timestampType | Which type of timestamp was gotten |
- Returns
- Status of the get
◆ Status_GetUnits()
static std::string ctre::phoenix6::BaseStatusSignal::Status_GetUnits |
( |
uint32_t |
signal | ) |
|
|
staticprotected |
Gets signal units.
- Parameters
-
- Returns
- Units of the signal
◆ Status_WaitForAll() [1/2]
static ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::Status_WaitForAll |
( |
const std::vector< BaseStatusSignal * > & |
signals, |
|
|
const char * |
network, |
|
|
units::time::second_t |
timeoutSeconds |
|
) |
| |
|
staticprotected |
Wait for multiple signals to arrive.
- Parameters
-
signals | Signals to wait for |
network | Network to wait for the signals on |
timeoutSeconds | Maximum time to wait for all these signals |
- Returns
- Status of the wait
◆ Status_WaitForAll() [2/2]
static ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::Status_WaitForAll |
( |
std::initializer_list< BaseStatusSignal * > |
signals, |
|
|
const char * |
network, |
|
|
units::time::second_t |
timeoutSeconds |
|
) |
| |
|
staticprotected |
Wait for multiple signals to arrive.
- Parameters
-
signals | Signals to wait for |
network | Network to wait for the signals on |
timeoutSeconds | Maximum time to wait for all these signals |
- Returns
- Status of the wait
◆ WaitForAll() [1/2]
static ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::WaitForAll |
( |
units::time::second_t |
timeoutSeconds, |
|
|
const std::vector< BaseStatusSignal * > & |
signals |
|
) |
| |
|
inlinestatic |
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.
- Parameters
-
timeoutSeconds | Maximum time to wait for all the signals to arrive. Pass zero to refresh all signals without blocking. |
signals | Signals to wait on, passed as vector of signal addresses. |
- 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. Call GetError() on each signal to determine which ones failed.
◆ WaitForAll() [2/2]
static ctre::phoenix::StatusCode ctre::phoenix6::BaseStatusSignal::WaitForAll |
( |
units::time::second_t |
timeoutSeconds, |
|
|
std::initializer_list< BaseStatusSignal * > |
signals |
|
) |
| |
|
inlinestatic |
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.
- Parameters
-
timeoutSeconds | Maximum time to wait for all the signals to arrive. Pass zero to refresh all signals without blocking. |
signals | Signals to wait on, passed as initializer list of signal addresses. |
- 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. Call GetError() on each signal to determine which ones failed.
◆ StatusSignal
◆ baseValue
double ctre::phoenix6::BaseStatusSignal::baseValue = 0 |
|
protected |
◆ deviceIdentifier
◆ error
◆ signalName
std::string ctre::phoenix6::BaseStatusSignal::signalName |
|
protected |
◆ spn
uint16_t ctre::phoenix6::BaseStatusSignal::spn |
|
protected |
◆ timestamps
◆ timestampType
int ctre::phoenix6::BaseStatusSignal::timestampType |
|
protected |
◆ units
std::string ctre::phoenix6::BaseStatusSignal::units |
|
protected |
The documentation for this class was generated from the following file: