Class ImuMountCheck
- All Implemented Interfaces:
Check
Check, a reversed yaw sense fails, any other wrong mount warns, and a robot
that has not driven enough since boot to judge anything is skipped.
- Pigeon level: at rest, mount-corrected pitch and roll near 0.
- Pigeon forward: while the wheels accelerate hard, the Pigeon's X/Y acceleration points the same way. A Pigeon turned on its mount reads the turn here.
- Yaw sense, both gyros: the heading turns the way the wheels turn the robot.
- Onboard IMU orientation: at rest, gravity on the axis its mount setting implies. WPILib applies the mount orientation to yaw only, so the raw accelerometer shows how SystemCore really sits.
Evidence counts only when the gyro and the wheels move together. Wheels spinning on a cart, pushing a wall, or a robot carried by hand give none, so a gyro that simply does not follow the wheels is never called wrong. Rests count only shortly after such driving, so the robot is on the floor. A check reads wrong only on clear contrary evidence: a reversed yaw, a consistent acceleration direction far from the wheels', a pitch, roll or gravity axis a mount error away.
Each rest is judged on its own, and a rest-based check reads wrong only when every rest does. A mount error tilts every rest alike, while a robot tipped on a bump or lifted with its wheels still tilts only that rest.
Call update(ImuMountCheck.Inputs) every loop, enabled or not: most evidence comes from driving.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne loop's readings.static enumstatic final classHow a gyro's heading follows the wheels' turning, while both are turning. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluate(double nowSeconds) A reversed yaw sense fails: the heading, and so field-relative driving, turns the wrong way.doubleGravity's share on the onboard IMU's Z axis, 0 to 1, over the rest closest to its mount setting; NaN before a rest that read gravity.double1 when every sample put the Pigeon at the same angle from the wheels, near 0 if random.doubleHow far the Pigeon's X axis sits from the robot's forward, degrees CCW; NaN before data.doubleMean pitch over the most level rest; NaN before a rest.doubleMean roll over the most level rest; NaN before a rest.void
-
Constructor Details
-
ImuMountCheck
public ImuMountCheck(boolean imuFlat, double pigeonMountYawDeg) - Parameters:
imuFlat- the onboard IMU's mount setting is flat (gravity on its Z), else verticalpigeonMountYawDeg- the Pigeon's MountPoseYaw, for the reason a wrong forward gives
-
-
Method Details
-
update
-
pigeonYawSense
-
imuYawSense
-
pigeonRestPitchDeg
public double pigeonRestPitchDeg()Mean pitch over the most level rest; NaN before a rest. -
pigeonRestRollDeg
public double pigeonRestRollDeg()Mean roll over the most level rest; NaN before a rest. -
pigeonLevel
-
pigeonForwardErrorDeg
public double pigeonForwardErrorDeg()How far the Pigeon's X axis sits from the robot's forward, degrees CCW; NaN before data. -
pigeonForwardConsistency
public double pigeonForwardConsistency()1 when every sample put the Pigeon at the same angle from the wheels, near 0 if random. -
pigeonForward
-
imuOrientation
-
evaluate
A reversed yaw sense fails: the heading, and so field-relative driving, turns the wrong way. Any other wrong mount warns, naming the setting to look at with the measured numbers.
-