33namespace motorcontrol {
64 std::string
toString(std::string prependString) {
548 enum MotionDriverState {
559 ConfigCompass_5 = 10,
560 SelfTestCompass = 11,
561 WaitForGyroStable = 12,
562 AdditionalAccelAdjust = 13,
570 SetValue = 0x00, AddOffset = 0x01, MatchCompass = 0x02, SetOffset = 0xFF,
579 ResetStats _resetStats = { 0, 0, 0,
false };
582 uint32_t _usageHist = 0;
587 const uint32_t EXPECTED_RESPONSE_TIMEOUT_MS = (200);
589 int PrivateSetParameter(
ParamEnum paramEnum, TareType tareType,
590 double angleDeg,
int timeoutMs = 0);
593 double GetTemp(
const uint64_t & statusFrame);
CTRE Talon SRX Motor Controller when used on CAN Bus.
Definition: TalonSRX.h:145
Pigeon IMU Class.
Definition: BasePigeon.h:101
double GetTemp() const
Gets the temperature of the pigeon.
Pigeon IMU Class.
Definition: PigeonIMU.h:85
virtual ErrorCode ConfigFactoryDefault(int timeoutMs=50)
Configures all persistent settings to defaults.
int EnterCalibrationMode(CalibrationMode calMode, int timeoutMs=0)
Enters the Calbration mode.
ErrorCode GetFaults(PigeonIMU_Faults &toFill)
Gets the fault status.
int SetFusedHeading(double angleDeg, int timeoutMs=0)
Sets the Fused Heading to the specified value.
ErrorCode ClearStickyFaults(int timeoutMs=0)
Clears the Sticky Faults.
int SetCompassAngle(double angleDeg, int timeoutMs=0)
Sets the compass angle.
int SetFusedHeadingToCompass(int timeoutMs=0)
Sets the Fused Heading register to match the current compass value.
PigeonIMU(int deviceNumber)
Create a Pigeon object that communicates with Pigeon on CAN Bus.
ErrorCode SetControlFramePeriod(PigeonIMU_ControlFrame frame, int periodMs)
Sets the period of the given control frame.
ErrorCode GetStickyFaults(PigeonIMU_StickyFaults &toFill)
Gets the sticky fault status.
double GetFusedHeading() const
Gets the Fused Heading.
int GetAccelerometerAngles(double tiltAngles[3])
Get Accelerometer tilt angles.
PigeonIMU(ctre::phoenix::motorcontrol::can::TalonSRX &talonSrx)
Create a Pigeon object that communciates with Pigeon through the Gadgeteer ribbon cable connected to ...
int SetCompassDeclination(double angleDegOffset, int timeoutMs=0)
Set the declination for compass.
static std::string ToString(CalibrationMode cm)
Gets the string representation of a CalibrationMode.
ErrorCode SetStatusFramePeriod(PigeonIMU_StatusFrame statusFrame, uint8_t periodMs, int timeoutMs=0)
Sets the period of the given status frame.
int ConfigGetCustomParam(int paramIndex, int timeoutMs=0)
Gets the value of a custom parameter.
double GetFusedHeading(FusionStatus &status)
Get the current Fusion Status (including fused heading)
CalibrationMode
Various calibration modes supported by Pigeon.
Definition: PigeonIMU.h:116
@ BootTareGyroAccel
Boot-Calibrate the pigeon.
Definition: PigeonIMU.h:120
@ Magnetometer360
Magnetometer-Calibrate the pigeon using 360 turns.
Definition: PigeonIMU.h:132
@ Magnetometer12Pt
Magnetometer-Calibrate the pigeon using the 12pt process.
Definition: PigeonIMU.h:128
@ Accelerometer
Calibrate the pigeon accelerometer.
Definition: PigeonIMU.h:136
@ Temperature
Temperature-Calibrate the pigeon.
Definition: PigeonIMU.h:124
PigeonState
Overall state of the Pigeon.
Definition: PigeonIMU.h:139
@ NoComm
No communications with Pigeon.
Definition: PigeonIMU.h:143
@ Initializing
Pigeon is initializing.
Definition: PigeonIMU.h:147
@ UserCalibration
Pigeon is calibrating due to user.
Definition: PigeonIMU.h:155
@ Ready
Pigeon is ready.
Definition: PigeonIMU.h:151
int SetTemperatureCompensationDisable(bool bTempCompDisable, int timeoutMs=0)
Disable/Enable Temp compensation.
int GetGeneralStatus(PigeonIMU::GeneralStatus &statusToFill)
Get the status of the current (or previousley complete) calibration.
ErrorCode ConfigSetCustomParam(int newValue, int paramIndex, int timeoutMs=0)
Sets the value of a custom parameter.
int GetStatusFramePeriod(PigeonIMU_StatusFrame frame, int timeoutMs=0)
Gets the period of the given status frame.
virtual ctre::phoenix::ErrorCode ConfigAllSettings(const PigeonIMUConfiguration &allConfigs, int timeoutMs=50)
Configures all persistent settings.
virtual void GetAllConfigs(PigeonIMUConfiguration &allConfigs, int timeoutMs=50)
Gets all persistant settings.
int GetFirmwareVersion()
Gets the firmware version of the device.
PigeonState GetState()
Gets the current Pigeon state.
PigeonIMU(ctre::phoenix::motorcontrol::can::TalonSRX *talonSrx)
Create a Pigeon object that communciates with Pigeon through the Gadgeteer ribbon cable connected to ...
int AddFusedHeading(double angleDeg, int timeoutMs=0)
Atomically add to the Fused Heading register.
static std::string ToString(PigeonIMU::PigeonState state)
Gets the string representation of a PigeonState.
PigeonIMU_StatusFrame
Enumerated type for status frame types.
Definition: PigeonIMU_StatusFrame.h:9
PigeonIMU_ControlFrame
Enumerated type for status frame types.
Definition: PigeonIMU_ControlFrame.h:9
ParamEnum
Signal enumeration for generic signal access.
Definition: paramEnum.h:13
ErrorCode
Definition: ErrorCode.h:13
namespace ctre
Definition: paramEnum.h:5
Util class to help with Pigeon configurations.
Definition: BasePigeon.h:82
Configurables available to Pigeon.
Definition: BasePigeon.h:57
std::string toString()
Definition: BasePigeon.h:63
Data object for holding fusion information.
Definition: PigeonIMU.h:88
bool bIsValid
Whether the fusion is valid.
Definition: PigeonIMU.h:96
bool bIsFusing
Whether the pigeon is fusing.
Definition: PigeonIMU.h:100
int lastError
Same as GetLastError()
Definition: PigeonIMU.h:108
double heading
Fused Heading.
Definition: PigeonIMU.h:92
std::string description
Description of fusion status.
Definition: PigeonIMU.h:104
Data object for status on current calibration and general status.
Definition: PigeonIMU.h:187
bool bCalIsBooting
After caller requests a calibration mode, pigeon will perform a boot-cal before entering the requeste...
Definition: PigeonIMU.h:209
int noMotionBiasCount
Number of times the Pigeon has automatically rebiased the gyro.
Definition: PigeonIMU.h:228
int tempCompensationCount
Number of times the Pigeon has temperature compensated the various signals.
Definition: PigeonIMU.h:233
std::string description
general string description of current status
Definition: PigeonIMU.h:213
int lastError
Same as GetLastError()
Definition: PigeonIMU.h:237
PigeonIMU::CalibrationMode currentMode
The currently applied calibration mode if state is in UserCalibration or if bCalIsBooting is true.
Definition: PigeonIMU.h:197
int calibrationError
The error code for the last calibration mode.
Definition: PigeonIMU.h:204
PigeonIMU::PigeonState state
The current state of the motion driver.
Definition: PigeonIMU.h:192
double tempC
Temperature in Celsius.
Definition: PigeonIMU.h:217
int upTimeSec
Number of seconds Pigeon has been up (since boot).
Definition: PigeonIMU.h:223
Sticky faults available to Pigeon.
Definition: PigeonIMU_Faults.h:13
Sticky faults available to Pigeon.
Definition: PigeonIMU_StickyFaults.h:13
Util class to help with Pigeon configurations.
Definition: PigeonIMU.h:74
Configurables available to Pigeon.
Definition: PigeonIMU.h:49
PigeonIMUConfiguration()
Definition: PigeonIMU.h:50
std::string toString(std::string prependString)
Definition: PigeonIMU.h:64
std::string toString()
Definition: PigeonIMU.h:55