CTRE Phoenix Pro C++ 23.0.12
ctre::phoenixpro::hardware::CANcoder Class Reference

Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along with filtered velocity. More...

#include <ctre/phoenixpro/CANcoder.hpp>

Inheritance diagram for ctre::phoenixpro::hardware::CANcoder:
ctre::phoenixpro::hardware::core::CoreCANcoder ctre::phoenixpro::hardware::ParentDevice

Public Member Functions

 CANcoder (int deviceId, std::string canbus="")
 Constructs a new CANcoder object. More...
 
 ~CANcoder ()
 
void InitSendable (wpi::SendableBuilder &builder) override
 
- Public Member Functions inherited from ctre::phoenixpro::hardware::core::CoreCANcoder
 CoreCANcoder (int deviceId, std::string canbus="")
 Constructs a new CANcoder object. More...
 
 CoreCANcoder (CoreCANcoder const &)=delete
 
CoreCANcoderoperator= (CoreCANcoder const &)=delete
 
bool HasResetOccurred ()
 
configs::CANcoderConfiguratorGetConfigurator ()
 Gets the configurator for this CANcoder. More...
 
configs::CANcoderConfigurator const & GetConfigurator () const
 Gets the configurator for this CANcoder. More...
 
sim::CANcoderSimStateGetSimState ()
 Get the simulation state for this device. More...
 
StatusSignalValue< int > & GetVersionMajor ()
 App Major Version number. More...
 
StatusSignalValue< int > & GetVersionMinor ()
 App Minor Version number. More...
 
StatusSignalValue< int > & GetVersionBugfix ()
 App Bugfix Version number. More...
 
StatusSignalValue< int > & GetVersionBuild ()
 App Build Version number. More...
 
StatusSignalValue< int > & GetVersion ()
 Full Version. More...
 
StatusSignalValue< int > & GetFaultField ()
 Integer representing all faults. More...
 
StatusSignalValue< int > & GetStickyFaultField ()
 Integer representing all sticky faults. More...
 
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetVelocity ()
 Velocity of device. More...
 
StatusSignalValue< units::angle::turn_t > & GetPosition ()
 Position of device. More...
 
StatusSignalValue< units::angle::turn_t > & GetAbsolutePosition ()
 Absolute Position of device. More...
 
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetUnfilteredVelocity ()
 The unfiltered velocity reported by CANcoder. More...
 
StatusSignalValue< units::angle::turn_t > & GetPositionSinceBoot ()
 The relative position reported by the CANcoder since boot. More...
 
StatusSignalValue< units::voltage::volt_t > & GetSupplyVoltage ()
 Measured supply voltage to the CANcoder. More...
 
StatusSignalValue< signals::MagnetHealthValue > & GetMagnetHealth ()
 Magnet health as measured by CANcoder. More...
 
StatusSignalValue< bool > & GetFault_Hardware ()
 Hardware fault occurred. More...
 
StatusSignalValue< bool > & GetStickyFault_Hardware ()
 Hardware fault occurred. More...
 
StatusSignalValue< bool > & GetFault_Undervoltage ()
 Device supply voltage dropped to near brownout levels. More...
 
StatusSignalValue< bool > & GetStickyFault_Undervoltage ()
 Device supply voltage dropped to near brownout levels. More...
 
StatusSignalValue< bool > & GetFault_BootDuringEnable ()
 Device boot while detecting the enable signal. More...
 
StatusSignalValue< bool > & GetStickyFault_BootDuringEnable ()
 Device boot while detecting the enable signal. More...
 
StatusSignalValue< bool > & GetFault_BadMagnet ()
 The magnet distance is not correct or magnet is missing. More...
 
StatusSignalValue< bool > & GetStickyFault_BadMagnet ()
 The magnet distance is not correct or magnet is missing. More...
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest &request)
 Control motor with generic control request object. More...
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest &&request)
 Control motor with generic control request object. More...
 
ctre::phoenix::StatusCode SetPosition (units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
 The position to set the sensor position to right now. More...
 
ctre::phoenix::StatusCode SetPosition (units::angle::turn_t newValue)
 The position to set the sensor position to right now. More...
 
ctre::phoenix::StatusCode ClearStickyFaults (units::time::second_t timeoutSeconds)
 Clear the sticky faults in the device. More...
 
ctre::phoenix::StatusCode ClearStickyFaults ()
 Clear the sticky faults in the device. More...
 
- Public Member Functions inherited from ctre::phoenixpro::hardware::ParentDevice
 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...
 

Additional Inherited Members

- Static Public Attributes inherited from ctre::phoenixpro::hardware::ParentDevice
static constexpr double kDefaultControlRatePeriodsSec = 0.010
 
- Protected Member Functions inherited from ctre::phoenixpro::hardware::ParentDevice
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 inherited from ctre::phoenixpro::hardware::ParentDevice
DeviceIdentifier deviceIdentifier
 

Detailed Description

Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along with filtered velocity.

Constructor & Destructor Documentation

◆ CANcoder()

ctre::phoenixpro::hardware::CANcoder::CANcoder ( int  deviceId,
std::string  canbus = "" 
)

Constructs a new CANcoder object.

Parameters
deviceIdID of the device, as configured in Phoenix Tuner.
canbusName of the CAN bus this device is on. Possible CAN bus strings are:
  • "rio" for the native roboRIO CAN bus
  • CANivore name or serial number
  • SocketCAN interface (non-FRC Linux only)
  • "*" for any CANivore seen by the program
  • empty string (default) to select the default for the system:
    • "rio" on roboRIO
    • "can0" on Linux
    • "*" on Windows

◆ ~CANcoder()

ctre::phoenixpro::hardware::CANcoder::~CANcoder ( )

Member Function Documentation

◆ InitSendable()

void ctre::phoenixpro::hardware::CANcoder::InitSendable ( wpi::SendableBuilder &  builder)
override

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