CTRE Phoenix Pro C++ 23.0.12
ctre::phoenixpro::hardware::ParentDevice Class Referenceabstract

Parent class for all devices. More...

#include <ctre/phoenixpro/hardware/ParentDevice.hpp>

Inheritance diagram for ctre::phoenixpro::hardware::ParentDevice:
ctre::phoenixpro::hardware::core::CoreCANcoder ctre::phoenixpro::hardware::core::CorePigeon2 ctre::phoenixpro::hardware::core::CoreTalonFX ctre::phoenixpro::hardware::CANcoder ctre::phoenixpro::hardware::Pigeon2 ctre::phoenixpro::hardware::TalonFX

Public Member Functions

 ParentDevice (int deviceID, std::string model, std::string canbus)
 
int GetDeviceID () const
 
const std::string & GetCANBus () const
 
std::shared_ptr< const controls::ControlRequestGetAppliedControl () const
 Get the latest applied control. More...
 
std::shared_ptr< controls::ControlRequestGetAppliedControl ()
 Get the latest applied control. More...
 

Static Public Attributes

static constexpr double kDefaultControlRatePeriodsSec = 0.010
 

Protected Member Functions

virtual void ReportIfTooOld ()=0
 
virtual ctre::phoenix::StatusCode SetControlPrivate (controls::ControlRequest &request)
 
template<typename T >
StatusSignalValue< T > & LookupStatusSignalValue (uint16_t spn, std::string signalName, bool reportOnConstruction)
 
template<typename T >
StatusSignalValue< T > & LookupStatusSignalValue (uint16_t spn, uint16_t mapper_iter, std::function< std::map< int, StatusSignalValue< T > >()> map_filler, std::string signalName, bool reportOnConstruction)
 
template<typename T , typename U >
StatusSignalValue< T > LookupDimensionlessStatusSignalValue (uint16_t spn, std::string signalName)
 Returns a unitless version of the StatusSignalValue by value. More...
 
void ReportIfTooOld (int minMajor, int minMinor, int minBugfix, int minBuild)
 

Protected Attributes

DeviceIdentifier deviceIdentifier
 

Detailed Description

Parent class for all devices.

Constructor & Destructor Documentation

◆ ParentDevice()

ctre::phoenixpro::hardware::ParentDevice::ParentDevice ( int  deviceID,
std::string  model,
std::string  canbus 
)
inline

Member Function Documentation

◆ GetAppliedControl() [1/2]

std::shared_ptr< controls::ControlRequest > ctre::phoenixpro::hardware::ParentDevice::GetAppliedControl ( )
inline

Get the latest applied control.

This returns a shared pointer to avoid becoming a dangling pointer due to parallel operations changing the underlying data.

Returns
Latest applied control

◆ GetAppliedControl() [2/2]

std::shared_ptr< const controls::ControlRequest > ctre::phoenixpro::hardware::ParentDevice::GetAppliedControl ( ) const
inline

Get the latest applied control.

This returns a shared pointer to avoid becoming a dangling pointer due to parallel operations changing the underlying data.

Returns
Latest applied control

◆ GetCANBus()

const std::string & ctre::phoenixpro::hardware::ParentDevice::GetCANBus ( ) const
inline
Returns
name of the CAN bus this device is on.

◆ GetDeviceID()

int ctre::phoenixpro::hardware::ParentDevice::GetDeviceID ( ) const
inline
Returns
the device ID of this device [0,62].

◆ LookupDimensionlessStatusSignalValue()

template<typename T , typename U >
StatusSignalValue< T > ctre::phoenixpro::hardware::ParentDevice::LookupDimensionlessStatusSignalValue ( uint16_t  spn,
std::string  signalName 
)
inlineprotected

Returns a unitless version of the StatusSignalValue by value.

Do not store the result in a reference.

◆ LookupStatusSignalValue() [1/2]

template<typename T >
StatusSignalValue< T > & ctre::phoenixpro::hardware::ParentDevice::LookupStatusSignalValue ( uint16_t  spn,
std::string  signalName,
bool  reportOnConstruction 
)
inlineprotected

◆ LookupStatusSignalValue() [2/2]

template<typename T >
StatusSignalValue< T > & ctre::phoenixpro::hardware::ParentDevice::LookupStatusSignalValue ( uint16_t  spn,
uint16_t  mapper_iter,
std::function< std::map< int, StatusSignalValue< T > >()>  map_filler,
std::string  signalName,
bool  reportOnConstruction 
)
inlineprotected

◆ ReportIfTooOld() [1/2]

virtual void ctre::phoenixpro::hardware::ParentDevice::ReportIfTooOld ( )
protectedpure virtual

◆ ReportIfTooOld() [2/2]

void ctre::phoenixpro::hardware::ParentDevice::ReportIfTooOld ( int  minMajor,
int  minMinor,
int  minBugfix,
int  minBuild 
)
protected

◆ SetControlPrivate()

virtual ctre::phoenix::StatusCode ctre::phoenixpro::hardware::ParentDevice::SetControlPrivate ( controls::ControlRequest request)
protectedvirtual

Member Data Documentation

◆ deviceIdentifier

DeviceIdentifier ctre::phoenixpro::hardware::ParentDevice::deviceIdentifier
protected

◆ kDefaultControlRatePeriodsSec

constexpr double ctre::phoenixpro::hardware::ParentDevice::kDefaultControlRatePeriodsSec = 0.010
staticconstexpr

The documentation for this class was generated from the following file: