CTRE Phoenix 6 C++ 25.3.1
|
Class for CANrange, a CAN based Time of Flight (ToF) sensor that measures the distance to the front of the device. More...
#include <ctre/phoenix6/core/CoreCANrange.hpp>
Public Types | |
using | Configuration = configs::CANrangeConfiguration |
Public Member Functions | |
CoreCANrange (int deviceId, std::string canbus="") | |
Constructs a new CANrange object. | |
CoreCANrange (int deviceId, CANBus canbus) | |
Constructs a new CANrange object. | |
configs::CANrangeConfigurator & | GetConfigurator () |
Gets the configurator for this CANrange. | |
configs::CANrangeConfigurator const & | GetConfigurator () const |
Gets the configurator for this CANrange. | |
sim::CANrangeSimState & | GetSimState () |
Get the simulation state for this device. | |
StatusSignal< int > & | GetVersionMajor (bool refresh=true) |
App Major Version number. | |
StatusSignal< int > & | GetVersionMinor (bool refresh=true) |
App Minor Version number. | |
StatusSignal< int > & | GetVersionBugfix (bool refresh=true) |
App Bugfix Version number. | |
StatusSignal< int > & | GetVersionBuild (bool refresh=true) |
App Build Version number. | |
StatusSignal< int > & | GetVersion (bool refresh=true) |
Full Version of firmware in device. | |
StatusSignal< int > & | GetFaultField (bool refresh=true) |
Integer representing all fault flags reported by the device. | |
StatusSignal< int > & | GetStickyFaultField (bool refresh=true) |
Integer representing all (persistent) sticky fault flags reported by the device. | |
StatusSignal< bool > & | GetIsProLicensed (bool refresh=true) |
Whether the device is Phoenix Pro licensed. | |
StatusSignal< units::voltage::volt_t > & | GetSupplyVoltage (bool refresh=true) |
Measured supply voltage to the CANrange. | |
StatusSignal< units::length::meter_t > & | GetDistance (bool refresh=true) |
Distance to the nearest object in the configured field of view of the CANrange. | |
StatusSignal< units::time::second_t > & | GetMeasurementTime (bool refresh=true) |
Timestamp of the most recent measurements. | |
StatusSignal< units::dimensionless::scalar_t > & | GetSignalStrength (bool refresh=true) |
Approximate signal strength of the measurement. | |
StatusSignal< bool > & | GetIsDetected (bool refresh=true) |
Whether the CANrange detects an object using the configured proximity parameters. | |
StatusSignal< signals::MeasurementHealthValue > & | GetMeasurementHealth (bool refresh=true) |
Health of the distance measurement. | |
StatusSignal< units::dimensionless::scalar_t > & | GetAmbientSignal (bool refresh=true) |
The amount of ambient infrared light that the sensor is detecting. | |
StatusSignal< units::length::meter_t > & | GetDistanceStdDev (bool refresh=true) |
Standard Deviation of the distance measurement. | |
StatusSignal< units::angle::degree_t > & | GetRealFOVCenterX (bool refresh=true) |
The actual center of the FOV in the X direction. | |
StatusSignal< units::angle::degree_t > & | GetRealFOVCenterY (bool refresh=true) |
The actual center of the FOV in the Y direction. | |
StatusSignal< units::angle::degree_t > & | GetRealFOVRangeX (bool refresh=true) |
The actual range of the FOV in the X direction. | |
StatusSignal< units::angle::degree_t > & | GetRealFOVRangeY (bool refresh=true) |
The actual range of the FOV in the Y direction. | |
StatusSignal< bool > & | GetFault_Hardware (bool refresh=true) |
Hardware fault occurred. | |
StatusSignal< bool > & | GetStickyFault_Hardware (bool refresh=true) |
Hardware fault occurred. | |
StatusSignal< bool > & | GetFault_Undervoltage (bool refresh=true) |
Device supply voltage dropped to near brownout levels. | |
StatusSignal< bool > & | GetStickyFault_Undervoltage (bool refresh=true) |
Device supply voltage dropped to near brownout levels. | |
StatusSignal< bool > & | GetFault_BootDuringEnable (bool refresh=true) |
Device boot while detecting the enable signal. | |
StatusSignal< bool > & | GetStickyFault_BootDuringEnable (bool refresh=true) |
Device boot while detecting the enable signal. | |
StatusSignal< bool > & | GetFault_UnlicensedFeatureInUse (bool refresh=true) |
An unlicensed feature is in use, device may not behave as expected. | |
StatusSignal< bool > & | GetStickyFault_UnlicensedFeatureInUse (bool refresh=true) |
An unlicensed feature is in use, device may not behave as expected. | |
ctre::phoenix::StatusCode | SetControl (const controls::ControlRequest &request) |
Control device with generic control request object. | |
ctre::phoenix::StatusCode | ClearStickyFaults (units::time::second_t timeoutSeconds) |
Clear the sticky faults in the device. | |
ctre::phoenix::StatusCode | ClearStickyFaults () |
Clear the sticky faults in the device. | |
ctre::phoenix::StatusCode | ClearStickyFault_Hardware (units::time::second_t timeoutSeconds) |
Clear sticky fault: Hardware fault occurred. | |
ctre::phoenix::StatusCode | ClearStickyFault_Hardware () |
Clear sticky fault: Hardware fault occurred. | |
ctre::phoenix::StatusCode | ClearStickyFault_Undervoltage (units::time::second_t timeoutSeconds) |
Clear sticky fault: Device supply voltage dropped to near brownout levels. | |
ctre::phoenix::StatusCode | ClearStickyFault_Undervoltage () |
Clear sticky fault: Device supply voltage dropped to near brownout levels. | |
ctre::phoenix::StatusCode | ClearStickyFault_BootDuringEnable (units::time::second_t timeoutSeconds) |
Clear sticky fault: Device boot while detecting the enable signal. | |
ctre::phoenix::StatusCode | ClearStickyFault_BootDuringEnable () |
Clear sticky fault: Device boot while detecting the enable signal. | |
ctre::phoenix::StatusCode | ClearStickyFault_UnlicensedFeatureInUse (units::time::second_t timeoutSeconds) |
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected. | |
ctre::phoenix::StatusCode | ClearStickyFault_UnlicensedFeatureInUse () |
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected. | |
![]() | |
ParentDevice (int deviceID, std::string model, std::string canbus) | |
virtual | ~ParentDevice ()=default |
ParentDevice (ParentDevice const &)=delete | |
ParentDevice & | operator= (ParentDevice const &)=delete |
int | GetDeviceID () const |
const std::string & | GetNetwork () const |
uint64_t | GetDeviceHash () const |
Gets a number unique for this device's hardware type and ID. | |
std::shared_ptr< const controls::ControlRequest > | GetAppliedControl () const |
Get the latest applied control. | |
std::shared_ptr< controls::ControlRequest > | GetAppliedControl () |
Get the latest applied control. | |
bool | HasResetOccurred () |
std::function< bool()> | GetResetOccurredChecker () const |
bool | IsConnected (units::second_t maxLatencySeconds=500_ms) |
Returns whether the device is still connected to the robot. | |
StatusSignal< double > & | GetGenericSignal (uint32_t signal, bool refresh=true) |
This is a reserved routine for internal testing. | |
ctre::phoenix::StatusCode | OptimizeBusUtilization (units::frequency::hertz_t optimizedFreqHz=0_Hz, units::time::second_t timeoutSeconds=100_ms) |
Optimizes the device's bus utilization by reducing the update frequencies of its status signals. | |
ctre::phoenix::StatusCode | ResetSignalFrequencies (units::time::second_t timeoutSeconds=100_ms) |
Resets the update frequencies of all the device's status signals to the defaults. | |
Additional Inherited Members | |
![]() | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>> | |
static ctre::phoenix::StatusCode | ResetSignalFrequenciesForAll (Devices &... devices) |
Resets the update frequencies of all the devices' status signals to the defaults. | |
static ctre::phoenix::StatusCode | ResetSignalFrequenciesForAll (const std::vector< ParentDevice * > &devices) |
Resets the update frequencies of all the devices' status signals to the defaults. | |
template<size_t N> | |
static ctre::phoenix::StatusCode | ResetSignalFrequenciesForAll (const std::array< ParentDevice *, N > &devices) |
Resets the update frequencies of all the devices' status signals to the defaults. | |
![]() | |
virtual ctre::phoenix::StatusCode | SetControlPrivate (const controls::ControlRequest &request) |
template<typename T > | |
StatusSignal< T > & | LookupStatusSignal (uint16_t spn, std::string signalName, bool reportOnConstruction, bool refresh) |
template<typename T > | |
StatusSignal< T > & | LookupStatusSignal (uint16_t spn, std::function< std::map< uint16_t, std::string >()> mapFiller, std::string signalName, bool reportOnConstruction, bool refresh) |
template<typename T , typename U > | |
StatusSignal< T > | LookupDimensionlessStatusSignal (uint16_t spn, std::string signalName, bool refresh) |
Returns a unitless version of the StatusSignal by value. | |
![]() | |
DeviceIdentifier | deviceIdentifier |
![]() | |
static controls::EmptyControl | _emptyControl {} |
template<typename... Devices> | |
static constexpr bool | is_all_device_v = is_all_device<Devices...>::value |
Whether all types passed in are subclasses of ParentDevice. | |
Class for CANrange, a CAN based Time of Flight (ToF) sensor that measures the distance to the front of the device.
ctre::phoenix6::hardware::core::CoreCANrange::CoreCANrange | ( | int | deviceId, |
std::string | canbus = "" ) |
Constructs a new CANrange object.
deviceId | ID of the device, as configured in Phoenix Tuner. |
canbus | Name of the CAN bus this device is on. Possible CAN bus strings are:
|
|
inline |
Constructs a new CANrange object.
deviceId | ID of the device, as configured in Phoenix Tuner. |
canbus | The CAN bus this device is on. |
|
inline |
Clear sticky fault: Device boot while detecting the enable signal.
This will wait up to 0.100 seconds (100ms) by default.
|
inline |
Clear sticky fault: Device boot while detecting the enable signal.
timeoutSeconds | Maximum time to wait up to in seconds. |
|
inline |
Clear sticky fault: Hardware fault occurred.
This will wait up to 0.100 seconds (100ms) by default.
|
inline |
Clear sticky fault: Hardware fault occurred.
timeoutSeconds | Maximum time to wait up to in seconds. |
|
inline |
Clear sticky fault: Device supply voltage dropped to near brownout levels.
This will wait up to 0.100 seconds (100ms) by default.
|
inline |
Clear sticky fault: Device supply voltage dropped to near brownout levels.
timeoutSeconds | Maximum time to wait up to in seconds. |
|
inline |
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
This will wait up to 0.100 seconds (100ms) by default.
|
inline |
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
timeoutSeconds | Maximum time to wait up to in seconds. |
|
inline |
Clear the sticky faults in the device.
This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.
This will wait up to 0.100 seconds (100ms) by default.
|
inline |
Clear the sticky faults in the device.
This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.
timeoutSeconds | Maximum time to wait up to in seconds. |
StatusSignal< units::dimensionless::scalar_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetAmbientSignal | ( | bool | refresh = true | ) |
The amount of ambient infrared light that the sensor is detecting.
For ideal operation, this should be as low as possible.
Short-range mode reduces the influence of ambient infrared light.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
|
inline |
|
inline |
StatusSignal< units::length::meter_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetDistance | ( | bool | refresh = true | ) |
Distance to the nearest object in the configured field of view of the CANrange.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::length::meter_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetDistanceStdDev | ( | bool | refresh = true | ) |
Standard Deviation of the distance measurement.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetFault_BootDuringEnable | ( | bool | refresh = true | ) |
Device boot while detecting the enable signal.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetFault_Hardware | ( | bool | refresh = true | ) |
Hardware fault occurred.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetFault_Undervoltage | ( | bool | refresh = true | ) |
Device supply voltage dropped to near brownout levels.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetFault_UnlicensedFeatureInUse | ( | bool | refresh = true | ) |
An unlicensed feature is in use, device may not behave as expected.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetFaultField | ( | bool | refresh = true | ) |
Integer representing all fault flags reported by the device.
These are device specific and are not used directly in typical applications. Use the signal specific GetFault_*() methods instead.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetIsDetected | ( | bool | refresh = true | ) |
Whether the CANrange detects an object using the configured proximity parameters.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetIsProLicensed | ( | bool | refresh = true | ) |
Whether the device is Phoenix Pro licensed.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< signals::MeasurementHealthValue > & ctre::phoenix6::hardware::core::CoreCANrange::GetMeasurementHealth | ( | bool | refresh = true | ) |
Health of the distance measurement.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::time::second_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetMeasurementTime | ( | bool | refresh = true | ) |
Timestamp of the most recent measurements.
This is not synchronized to any other clock source.
Users can use this to check when the measurements are updated.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::angle::degree_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetRealFOVCenterX | ( | bool | refresh = true | ) |
The actual center of the FOV in the X direction.
This takes into account the user-configured FOVCenterX and FOVRangeX.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::angle::degree_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetRealFOVCenterY | ( | bool | refresh = true | ) |
The actual center of the FOV in the Y direction.
This takes into account the user-configured FOVCenterY and FOVRangeY.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::angle::degree_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetRealFOVRangeX | ( | bool | refresh = true | ) |
The actual range of the FOV in the X direction.
This takes into account the user-configured FOVRangeX.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::angle::degree_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetRealFOVRangeY | ( | bool | refresh = true | ) |
The actual range of the FOV in the Y direction.
This takes into account the user-configured FOVRangeY.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::dimensionless::scalar_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetSignalStrength | ( | bool | refresh = true | ) |
Approximate signal strength of the measurement.
A higher value indicates a higher strength of signal.
A value of ~2500 is typical when detecting an object under short-range conditions.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
|
inline |
Get the simulation state for this device.
This function reuses an allocated simulation state object, so it is safe to call this function multiple times in a robot loop.
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetStickyFault_BootDuringEnable | ( | bool | refresh = true | ) |
Device boot while detecting the enable signal.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetStickyFault_Hardware | ( | bool | refresh = true | ) |
Hardware fault occurred.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetStickyFault_Undervoltage | ( | bool | refresh = true | ) |
Device supply voltage dropped to near brownout levels.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANrange::GetStickyFault_UnlicensedFeatureInUse | ( | bool | refresh = true | ) |
An unlicensed feature is in use, device may not behave as expected.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetStickyFaultField | ( | bool | refresh = true | ) |
Integer representing all (persistent) sticky fault flags reported by the device.
These are device specific and are not used directly in typical applications. Use the signal specific GetStickyFault_*() methods instead.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< units::voltage::volt_t > & ctre::phoenix6::hardware::core::CoreCANrange::GetSupplyVoltage | ( | bool | refresh = true | ) |
Measured supply voltage to the CANrange.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetVersion | ( | bool | refresh = true | ) |
Full Version of firmware in device.
The format is a four byte value.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetVersionBugfix | ( | bool | refresh = true | ) |
App Bugfix Version number.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetVersionBuild | ( | bool | refresh = true | ) |
App Build Version number.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetVersionMajor | ( | bool | refresh = true | ) |
App Major Version number.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANrange::GetVersionMinor | ( | bool | refresh = true | ) |
App Minor Version number.
Default Rates:
This refreshes and returns a cached StatusSignal object.
refresh | Whether to refresh the StatusSignal before returning it; defaults to true |
|
inline |
Control device with generic control request object.
User must make sure the specified object is castable to a valid control request, otherwise this function will fail at run-time and return the NotSupported StatusCode
request | Control object to request of the device |