Class ThreeWheelChassisTracker

java.lang.Object
me.wobblyyyy.pathfinder.tracking.threeWheel.ThreeWheelChassisTracker
All Implemented Interfaces:
Odometry, Tracker

public class ThreeWheelChassisTracker
extends java.lang.Object
implements Tracker
Three-wheel odometry chassis tracking, provided as an alternative to more direct methods, such as Swerve or Tank tracking.

When compared to other methods of positional tracking, using three non-actuated wheels is significantly more accurate than, say, getting encoder positions from a swerve or tank drive.

This portion of code depends on Tejas Mehta's OdometryCore library, which handles most (all) of the math behind three-wheel positional tracking. Preceding the implementation of his OdometryCore library, it has been verified/confirmed to work accurately and effectively.

If you're interested in learning more about the OdometryCore library that serves as the very core of this tracker, you can go to either of these two links.

Since:
0.1.0
Author:
Colin Robertson
  • Field Summary

    Fields
    Modifier and Type Field Description
    private com.tejasmehta.OdometryCore.localization.EncoderPositions encoderPositions
    Locally-used encoder values.
    private Encoder left
    The left encoder.
    private double leftOffset
    The left encoder's offset.
    private Encoder middle
    The middle/front/back encoder.
    private double middleOffset
    The middle encoder's offset.
    private com.tejasmehta.OdometryCore.localization.OdometryPosition odometryPosition
    Locally-used odometry position implementation.
    private HeadingPoint position
    Locally-used positional information about the robot.
    private Encoder right
    The right encoder.
    private double rightOffset
    The right encoder's offset.
    private double wheelDiameter
    The diameter of each of the odometry wheels.
  • Constructor Summary

    Constructors
    Constructor Description
    ThreeWheelChassisTracker​(Encoder left, Encoder right, Encoder middle, double wheelDiameter, double leftOffset, double rightOffset, double middleOffset)
    Create a new ThreeWheelChassisTracker instance.
  • Method Summary

    Modifier and Type Method Description
    HeadingPoint getBlPos()
    This method is NOT implemented yet!
    HeadingPoint getBrPos()
    This method is NOT implemented yet!
    HeadingPoint getFlPos()
    This method is NOT implemented yet!
    HeadingPoint getFrPos()
    This method is NOT implemented yet!
    HeadingPoint getPos()
    Get the robot's position and heading.
    private void throwUnimplemented()
    Tell the user that the method they're attempting to invoke has not yet been implemented.
    void update()
    Update the odometry system.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • left

      private final Encoder left
      The left encoder.
    • middle

      private final Encoder middle
      The middle/front/back encoder.
    • wheelDiameter

      private final double wheelDiameter
      The diameter of each of the odometry wheels.
    • leftOffset

      private final double leftOffset
      The left encoder's offset.
    • rightOffset

      private final double rightOffset
      The right encoder's offset.
    • middleOffset

      private final double middleOffset
      The middle encoder's offset.
    • encoderPositions

      private com.tejasmehta.OdometryCore.localization.EncoderPositions encoderPositions
      Locally-used encoder values.
    • odometryPosition

      private com.tejasmehta.OdometryCore.localization.OdometryPosition odometryPosition
      Locally-used odometry position implementation.
    • position

      private HeadingPoint position
      Locally-used positional information about the robot.
  • Constructor Details

    • ThreeWheelChassisTracker

      public ThreeWheelChassisTracker​(Encoder left, Encoder right, Encoder middle, double wheelDiameter, double leftOffset, double rightOffset, double middleOffset)
      Create a new ThreeWheelChassisTracker instance.

      As a note, this tracker relies on math from Tejas Mehta's OdometryCore library. Links to important documentation and information about his library are available in the main JavaDoc for this class file.

      Parameters:
      left - the left encoder.
      right - the right encoder.
      middle - the front or back encoder. It's named "middle" as it's technically in the middle of the robot. It's important to mount this wheel as accurately as possible, otherwise some positional tracking math will/might be wrong.
      wheelDiameter - the diameter of each of the encoder's wheels, preferably (and hopefully) measured in inches.
      leftOffset - the left wheel's offset from the center of the robot. This is ONLY the horizontal offset.
      rightOffset - the right wheel's offset from the center of the robot. This is ONLY the horizontal offset.
      middleOffset - the center wheel's offset from the center of the robot. This is ONLY vertical offset.
  • Method Details

    • throwUnimplemented

      private void throwUnimplemented()
      Tell the user that the method they're attempting to invoke has not yet been implemented. Sucks for them, y'know?
    • getFrPos

      public HeadingPoint getFrPos()
      This method is NOT implemented yet!
      Specified by:
      getFrPos in interface Tracker
      Returns:
      null
    • getFlPos

      public HeadingPoint getFlPos()
      This method is NOT implemented yet!
      Specified by:
      getFlPos in interface Tracker
      Returns:
      null
    • getBrPos

      public HeadingPoint getBrPos()
      This method is NOT implemented yet!
      Specified by:
      getBrPos in interface Tracker
      Returns:
      null
    • getBlPos

      public HeadingPoint getBlPos()
      This method is NOT implemented yet!
      Specified by:
      getBlPos in interface Tracker
      Returns:
      null
    • getPos

      public HeadingPoint getPos()
      Get the robot's position and heading.

      As usual, heading is signified in degrees, not radians. Also, the measurements of position are measured in INCHES, not meters.

      Specified by:
      getPos in interface Odometry
      Returns:
      the robot's position and heading.
    • update

      public void update()
      Update the odometry system.

      This should be run as frequently as possible.

      Specified by:
      update in interface Odometry