Package com.crossbotics.ftchelper.robot
Class Odometry
java.lang.Object
com.crossbotics.ftchelper.robot.Odometry
The robot's odometry, one line in
Robot.java: what tells the robot where it is on the field.
odometry(Odometry.pinpoint("pinpoint").offsetsMm(-84, -168)); // goBILDA Pinpoint, 4-bar pods
odometry(Odometry.otos("otos").mountIn(0, -3, 0)); // SparkFun OTOS
odometry(Odometry.threeWheels("par_left", "par_right", "perp") // three dead wheels
.trackWidthIn(13.2).perpForwardIn(-6));
odometry(Odometry.twoWheels("par", "perp").parallelLeftIn(5).perpForwardIn(-6)); // two + the IMU
Then robot.pose() is the robot's place every loop, autonomous can drive to a field point
(s.driveTo(...)), and TeleOp starts where autonomous ended. Its numbers (the OTOS scales, and
checked) are in Tunables.Odometry. The Odometry Tuner finds the offsets.
Docs: docs/modules/odometry.md
-
Method Summary
Modifier and TypeMethodDescriptionstatic Odometrycustom(Function<Devices, PoseTracker> make) Your own pose source (e.g.booleanisReversed(String which) True if this pod ("x"/"y" for a Pinpoint, a port name for dead wheels) is inreversed(...).kindName()"pinpoint", "otos", "threeWheels" or "twoWheels" (for the Odometry Tuner).mountIn(double forwardIn, double leftIn, double headingDeg) OTOS: where it sits: inches forward of the centre, inches left, and its arrow's direction (CCW deg).names()The configuration names, in the order written.offsetsMm(double xPodLeftMm, double yPodForwardMm) Pinpoint: where the pods sit, in mm (the Odometry Tuner measures them).static OdometryA SparkFun OTOS (I2C port).parallelLeftIn(double inches) Two dead wheels: how far LEFT of the centre the forward-measuring pod is, inches (right = negative).perpForwardIn(double inches) Dead wheels: how far FORWARD of the centre the sideways-measuring pod is, inches (back = negative).static OdometryA goBILDA Pinpoint (I2C port), with goBILDA 4-bar pods unless you say otherwise.goBILDA swingarm pods instead of 4-bar pods.doublePod encoder counts per mm.Pods that count the wrong way (the Odometry Tuner says which): for a Pinpoint "x" and/or "y"; for dead wheels the motor port names.static OdometrythreeWheels(String leftParallel, String rightParallel, String perpendicular) Three dead wheels on encoder ports: two that measure forward (left and right of the centre) and one that measures sideways.ticksPerMm(double ticks) Other pods: encoder counts per mm of wheel travel.trackWidthIn(double inches) Three dead wheels: the distance between the left and right forward-measuring pods, inches.static OdometryTwo dead wheels (one forward, one sideways) and the Control Hub's IMU for the heading.
-
Method Details
-
custom
Your own pose source (e.g. odometry fused with AprilTags, or another library's localizer), made at INIT from the robot's devices. It must use the library's frame (x right, y away, heading 0 = away, counterclockwise +). driveTo, robot.pose() and TeleOp use it like the built-in kinds. -
pinpoint
A goBILDA Pinpoint (I2C port), with goBILDA 4-bar pods unless you say otherwise. -
otos
A SparkFun OTOS (I2C port). -
threeWheels
Three dead wheels on encoder ports: two that measure forward (left and right of the centre) and one that measures sideways. The names are the motor ports' configuration names. -
twoWheels
Two dead wheels (one forward, one sideways) and the Control Hub's IMU for the heading. -
offsetsMm
Pinpoint: where the pods sit, in mm (the Odometry Tuner measures them).xPodLeftMm: how far LEFT of the robot's centre the forward-measuring pod is (right = negative);yPodForwardMm: how far FORWARD of the centre the sideways-measuring pod is (back = negative). -
podsSwingarm
goBILDA swingarm pods instead of 4-bar pods. -
ticksPerMm
Other pods: encoder counts per mm of wheel travel. -
reversed
Pods that count the wrong way (the Odometry Tuner says which): for a Pinpoint "x" and/or "y"; for dead wheels the motor port names. -
mountIn
OTOS: where it sits: inches forward of the centre, inches left, and its arrow's direction (CCW deg). -
trackWidthIn
Three dead wheels: the distance between the left and right forward-measuring pods, inches. -
parallelLeftIn
Two dead wheels: how far LEFT of the centre the forward-measuring pod is, inches (right = negative). -
perpForwardIn
Dead wheels: how far FORWARD of the centre the sideways-measuring pod is, inches (back = negative). -
kindName
"pinpoint", "otos", "threeWheels" or "twoWheels" (for the Odometry Tuner). -
names
The configuration names, in the order written. -
podTicksPerMm
public double podTicksPerMm()Pod encoder counts per mm. -
isReversed
True if this pod ("x"/"y" for a Pinpoint, a port name for dead wheels) is inreversed(...).
-