CTRE Phoenix 6 C++ 23.2.1
|
Represents a status signal with data of type T, and operations available to retrieve information about the signal. More...
#include <ctre/phoenix6/StatusSignal.hpp>
Public Member Functions | |
std::string | ToString () const |
T | GetValue () const |
Gets the cached value from this status signal. More... | |
StatusSignal< T > & | Refresh (bool ReportOnError=true) |
Refreshes the value of this status signal. More... | |
StatusSignal< T > & | WaitForUpdate (units::time::second_t timeoutSec, bool ReportOnError=true) |
Waits up to timeoutSec to get the up-to-date status signal value. More... | |
SignalMeasurement< T > | GetDataCopy () const |
Get a basic data-only container with this information, to be used for things such as data logging. More... | |
std::function< T()> | AsSupplier () |
Returns a lambda that calls Refresh and GetValue on this object. More... | |
![]() | |
virtual | ~BaseStatusSignal ()=0 |
ctre::phoenix::StatusCode | SetUpdateFrequency (units::frequency::hertz_t frequencyHz, units::time::second_t timeoutSeconds=50_ms) |
Sets the rate at which the device will publish this signal. More... | |
const std::string & | GetUnits () const |
Gets the units for this signal. More... | |
const AllTimestamps & | GetAllTimestamps () const |
Get the timestamps of this signals. More... | |
const Timestamp & | GetTimestamp () const |
Get the best timestamp available to this signal. More... | |
ctre::phoenix::StatusCode | GetError () const |
Get the error code from when we last received this signal. More... | |
Friends | |
class | hardware::ParentDevice |
std::ostream & | operator<< (std::ostream &os, const StatusSignal< T > &data) |
Additional Inherited Members | |
![]() | |
static ctre::phoenix::StatusCode | WaitForAll (units::time::second_t timeoutSeconds, std::initializer_list< BaseStatusSignal * > signals) |
Waits for new data on all provided signals up to timeout. More... | |
static ctre::phoenix::StatusCode | WaitForAll (units::time::second_t timeoutSeconds, const std::vector< BaseStatusSignal * > &signals) |
Waits for new data on all provided signals up to timeout. More... | |
template<typename U , typename U_PER_SEC > | |
static U | GetLatencyCompensatedValue (StatusSignal< U > &signal, StatusSignal< U_PER_SEC > &signalSlope) |
static ctre::phoenix::StatusCode | IsAllGood (std::initializer_list< BaseStatusSignal * > signals) |
Checks if all signals have an OK error code. More... | |
![]() | |
void | CopyFrom (const BaseStatusSignal &other) |
BaseStatusSignal (hardware::DeviceIdentifier deviceIdentifier, uint16_t spn, std::string signalName) | |
BaseStatusSignal (ctre::phoenix::StatusCode error) | |
ctre::phoenix::StatusCode | SetUpdateFrequency (const char *canbus, uint32_t deviceHash, uint16_t spn, units::frequency::hertz_t frequencyHz, units::time::second_t timeoutSeconds) |
![]() | |
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... | |
![]() | |
hardware::DeviceIdentifier | deviceIdentifier |
uint16_t | spn |
std::string | units |
AllTimestamps | timestamps {} |
int | timestampType |
double | baseValue = 0 |
ctre::phoenix::StatusCode | error = ctre::phoenix::StatusCode::SigNotUpdated |
std::string | signalName |
Represents a status signal with data of type T, and operations available to retrieve information about the signal.
|
inline |
Returns a lambda that calls Refresh and GetValue on this object.
This is useful for command-based programming.
|
inline |
Get a basic data-only container with this information, to be used for things such as data logging.
|
inline |
Gets the cached value from this status signal.
Gets the cached value. To make sure the value is up-to-date call Refresh()
or WaitForUpdate()
|
inline |
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-blocking refresh operation. If you want to wait until you receive the signal, call WaitForUpdate()
instead.
ReportOnError | Whether to report any errors to the Driver Station/stderr. |
|
inline |
|
inline |
Waits up to timeoutSec to get the up-to-date status signal value.
This performs a blocking refresh operation. If you want to non-blocking refresh the signal, call Refresh()
instead.
timeoutSec | Maximum time to wait for the signal to update |
ReportOnError | Whether to report any errors to the Driver Station/stderr. |
|
friend |
|
friend |