PigeonIMU
- class phoenix5.sensors.PigeonIMU(*args, **kwargs)
Bases:
BasePigeon
Pigeon IMU Class. Class supports communicating over CANbus and over ribbon-cable (CAN Talon SRX).
Overloaded function.
__init__(self: phoenix5._ctre.sensors.PigeonIMU, deviceNumber: int) -> None
Create a Pigeon object that communicates with Pigeon on CAN Bus.
- Parameters:
deviceNumber – CAN Device Id of Pigeon [0,62]
__init__(self: phoenix5._ctre.sensors.PigeonIMU, talonSrx: phoenix5._ctre.TalonSRX) -> None
Create a Pigeon object that communciates with Pigeon through the Gadgeteer ribbon cable connected to a Talon on CAN Bus.
- Parameters:
talonSrx – Object for the TalonSRX connected via ribbon cable.
- class CalibrationMode(value: int)
Bases:
pybind11_object
Various calibration modes supported by Pigeon.
Note that you can instead use Phoenix Tuner to accomplish certain calibrations.
Members:
BootTareGyroAccel : Boot-Calibrate the pigeon
Temperature : Temperature-Calibrate the pigeon
Magnetometer12Pt : Magnetometer-Calibrate the pigeon using the 12pt process
Magnetometer360 : Magnetometer-Calibrate the pigeon using 360 turns
Accelerometer : Calibrate the pigeon accelerometer
- Accelerometer = <CalibrationMode.Accelerometer: 5>
- BootTareGyroAccel = <CalibrationMode.BootTareGyroAccel: 0>
- Magnetometer12Pt = <CalibrationMode.Magnetometer12Pt: 2>
- Magnetometer360 = <CalibrationMode.Magnetometer360: 3>
- Temperature = <CalibrationMode.Temperature: 1>
- property name
- property value
- class FusionStatus
Bases:
pybind11_object
Data object for holding fusion information.
- property bIsFusing
Whether the pigeon is fusing
- property bIsValid
Whether the fusion is valid
- property description
Description of fusion status
- property heading
Fused Heading
- property lastError
Same as GetLastError()
- class GeneralStatus
Bases:
pybind11_object
Data object for status on current calibration and general status.
Pigeon has many calibration modes supported for a variety of uses. The modes generally collects and saves persistently information that makes the Pigeon signals more accurate. This includes collecting temperature, gyro, accelerometer, and compass information.
For FRC use-cases, typically compass and temperature calibration is not required.
Additionally when motion driver software in the Pigeon boots, it will perform a fast boot calibration to initially bias gyro and setup accelerometer.
These modes can be enabled with the EnterCalibration mode.
When a calibration mode is entered, caller can expect…
PigeonState to reset to Initializing and bCalIsBooting is set to true. Pigeon LEDs will blink the boot pattern.
This is similar to the normal boot cal, however it can an additional ~30 seconds since calibration generally requires more information. currentMode will reflect the user’s selected calibration mode.
PigeonState will eventually settle to UserCalibration and Pigeon LEDs will show cal specific blink patterns.
bCalIsBooting is now false.
Follow the instructions in the Pigeon User Manual to meet the calibration specific requirements.
When finished calibrationError will update with the result. Pigeon will solid-fill LEDs with red (for failure) or green (for success) for ~5 seconds. Pigeon then perform boot-cal to cleanly apply the newly saved calibration data.
- property bCalIsBooting
After caller requests a calibration mode, pigeon will perform a boot-cal before entering the requested mode. During this period, this flag is set to true.
- property calibrationError
The error code for the last calibration mode. Zero represents a successful cal (with solid green LEDs at end of cal) and nonzero is a failed calibration (with solid red LEDs at end of cal). Different calibration
- property currentMode
The currently applied calibration mode if state is in UserCalibration or if bCalIsBooting is true. Otherwise it holds the last selected calibration mode (when calibrationError was updated).
- property description
general string description of current status
- property lastError
Same as GetLastError()
- property noMotionBiasCount
Number of times the Pigeon has automatically rebiased the gyro. This counter overflows from 15 -> 0 with no cap.
- property state
The current state of the motion driver. This reflects if the sensor signals are accurate. Most calibration modes will force Pigeon to reinit the motion driver.
- property tempC
Temperature in Celsius
- property tempCompensationCount
Number of times the Pigeon has temperature compensated the various signals. This counter overflows from 15 -> 0 with no cap.
- property upTimeSec
Number of seconds Pigeon has been up (since boot). This register is reset on power boot or processor reset. Register is capped at 255 seconds with no wrap around.
- class PigeonState(value: int)
Bases:
pybind11_object
Overall state of the Pigeon.
Members:
NoComm : No communications with Pigeon
Initializing : Pigeon is initializing
Ready : Pigeon is ready
UserCalibration : Pigeon is calibrating due to user
- Initializing = <PigeonState.Initializing: 1>
- NoComm = <PigeonState.NoComm: 0>
- Ready = <PigeonState.Ready: 2>
- UserCalibration = <PigeonState.UserCalibration: 3>
- property name
- property value
- addFusedHeading(angleDeg: float, timeoutMs: int = 0) int
Atomically add to the Fused Heading register.
- Parameters:
angleDeg – Degrees to add to the Fused Heading register.
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- clearStickyFaults(timeoutMs: int = 0) phoenix5._ctre.ErrorCode
Clears the Sticky Faults
- Returns:
Error Code generated by function. 0 indicates no error.
- configAllSettings(allConfigs: phoenix5._ctre.sensors.PigeonIMUConfiguration, timeoutMs: int = 50) phoenix5._ctre.ErrorCode
Configures all persistent settings.
- Parameters:
allConfigs – Object with all of the persistant settings
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- configFactoryDefault(timeoutMs: int = 50) phoenix5._ctre.ErrorCode
Configures all persistent settings to defaults.
- Parameters:
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- configSetCustomParam(newValue: int, paramIndex: int, timeoutMs: int = 0) phoenix5._ctre.ErrorCode
Sets the value of a custom parameter. This is for arbitrary use.
Sometimes it is necessary to save calibration/declination/offset information in the device. Particularly if the device is part of a subsystem that can be replaced.
- Parameters:
newValue – Value for custom parameter.
paramIndex – Index of custom parameter. [0-1]
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- enterCalibrationMode(calMode: phoenix5._ctre.sensors.PigeonIMU.CalibrationMode, timeoutMs: int = 0) int
Enters the Calbration mode. See the Pigeon IMU documentation for More information on Calibration.
Note that you can instead use Phoenix Tuner to accomplish this. Note you should NOT be calling this during normal robot operation.
- Parameters:
calMode – Calibration to execute
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- getAccelerometerAngles() tuple[int, Annotated[list[float], FixedSize(3)]]
Get Accelerometer tilt angles.
- Parameters:
tiltAngles – Array to fill with x[0], y[1], and z[2] angles in degrees.
- Returns:
The last ErrorCode generated.
- getAllConfigs(allConfigs: phoenix5._ctre.sensors.PigeonIMUConfiguration, timeoutMs: int = 50) None
Gets all persistant settings.
- Parameters:
allConfigs – Object with all of the persistant settings
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- getFaults(toFill: phoenix5._ctre.sensors.PigeonIMU_Faults) phoenix5._ctre.ErrorCode
Gets the fault status
- Parameters:
toFill – Container for fault statuses.
- Returns:
Error Code generated by function. 0 indicates no error.
- getFirmwareVersion() int
Gets the firmware version of the device.
- Returns:
param holds the firmware version of the device. Device must be powered cycled at least once.
- getFusedHeading(*args, **kwargs)
Overloaded function.
getFusedHeading(self: phoenix5._ctre.sensors.PigeonIMU, status: phoenix5._ctre.sensors.PigeonIMU.FusionStatus) -> float
Get the current Fusion Status (including fused heading)
- Parameters:
status – object reference to fill with fusion status flags. * Caller may pass null if flags are not needed.
- Returns:
The fused heading in degrees.
getFusedHeading(self: phoenix5._ctre.sensors.PigeonIMU) -> float
Gets the Fused Heading
- Returns:
The fused heading in degrees.
- getGeneralStatus(statusToFill: phoenix5._ctre.sensors.PigeonIMU.GeneralStatus) int
Get the status of the current (or previousley complete) calibration.
- Parameters:
out – statusToFill Container for the status information.
- Returns:
Error Code generated by function. 0 indicates no error.
- getResetCount() int
- Returns:
number of times Pigeon Reset
- getResetFlags() int
- Returns:
Reset flags for Pigeon
- getState() phoenix5._ctre.sensors.PigeonIMU.PigeonState
Gets the current Pigeon state
- Returns:
PigeonState enum
- getStatusFramePeriod(frame: phoenix5._ctre.sensors.PigeonIMU_StatusFrame, timeoutMs: int = 0) int
Gets the period of the given status frame.
- Parameters:
frame – Frame to get the period of.
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Period of the given status frame.
- getStickyFaults(toFill: phoenix5._ctre.sensors.PigeonIMU_StickyFaults) phoenix5._ctre.ErrorCode
Gets the sticky fault status
- Parameters:
toFill – Container for sticky fault statuses.
- Returns:
Error Code generated by function. 0 indicates no error.
- setCompassAngle(angleDeg: float, timeoutMs: int = 0) int
Sets the compass angle. Although compass is absolute [0,360) degrees, the continuous compass register holds the wrap-arounds.
- Parameters:
angleDeg – Degrees to set continuous compass angle to.
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- setCompassDeclination(angleDegOffset: float, timeoutMs: int = 0) int
Set the declination for compass. Declination is the difference between Earth Magnetic north, and the geographic “True North”.
- Parameters:
angleDegOffset – Degrees to set Compass Declination to.
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- setControlFramePeriod(frame: phoenix5._ctre.sensors.PigeonIMU_ControlFrame, periodMs: int) phoenix5._ctre.ErrorCode
Sets the period of the given control frame.
- Parameters:
frame – Frame whose period is to be changed.
periodMs – Period in ms for the given frame.
- Returns:
Error Code generated by function. 0 indicates no error.
- setFusedHeading(angleDeg: float, timeoutMs: int = 0) int
Sets the Fused Heading to the specified value.
- Parameters:
angleDeg – New fused-heading in degrees [+/- 23,040 degrees]
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- setFusedHeadingToCompass(timeoutMs: int = 0) int
Sets the Fused Heading register to match the current compass value.
- Parameters:
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- setStatusFramePeriod(statusFrame: phoenix5._ctre.sensors.PigeonIMU_StatusFrame, periodMs: int, timeoutMs: int = 0) phoenix5._ctre.ErrorCode
Sets the period of the given status frame.
- Parameters:
statusFrame – Frame whose period is to be changed.
periodMs – Period in ms for the given frame.
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- setTemperatureCompensationDisable(bTempCompDisable: bool, timeoutMs: int = 0) int
Disable/Enable Temp compensation. Pigeon has this on/False at boot.
- Parameters:
bTempCompDisable – Set to “False” to enable temperature compensation.
timeoutMs – Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
- Returns:
Error Code generated by function. 0 indicates no error.
- static toString(*args, **kwargs)
Overloaded function.
toString(state: phoenix5._ctre.sensors.PigeonIMU.PigeonState) -> str
Gets the string representation of a PigeonState
- Parameters:
state – PigeonState to get the string representation of
- Returns:
string representation of specified PigeonState
toString(cm: phoenix5._ctre.sensors.PigeonIMU.CalibrationMode) -> str
Gets the string representation of a CalibrationMode
- Parameters:
cm – CalibrationMode to get the string representation of
- Returns:
string representation of specified CalibrationMode