Class AbstractPositionEstimator

    • Field Detail

      • GRAVITATIONAL_ACCELERATION

        public static final double GRAVITATIONAL_ACCELERATION
        Acceleration due to gravity, in meters per second.
        See Also:
        Constant Field Values
      • x

        protected double x
      • y

        protected double y
      • theta

        protected double theta
      • theta0

        protected double theta0
      • dx

        protected double dx
      • dy

        protected double dy
      • dtheta

        protected double dtheta
      • px

        protected double px
      • py

        protected double py
      • ptheta

        protected double ptheta
      • pAx

        protected double pAx
      • pAy

        protected double pAy
      • mudx

        protected double mudx
      • mudy

        protected double mudy
      • mudtheta

        protected double mudtheta
      • time

        protected long time
      • pt

        protected long pt
      • dt

        protected long dt
      • vx

        protected double vx
      • vy

        protected double vy
      • dw

        protected double dw
      • e1

        protected double e1
      • e2

        protected double e2
      • e3

        protected double e3
      • accelerometer

        protected final edu.wpi.first.wpilibj.interfaces.Accelerometer accelerometer
      • gyro

        protected final edu.wpi.first.wpilibj.interfaces.Gyro gyro
      • frontLeftEncoder

        protected final edu.wpi.first.wpilibj.Encoder frontLeftEncoder
      • frontRightEncoder

        protected final edu.wpi.first.wpilibj.Encoder frontRightEncoder
      • backLeftEncoder

        protected final edu.wpi.first.wpilibj.Encoder backLeftEncoder
      • backRightEncoder

        protected final edu.wpi.first.wpilibj.Encoder backRightEncoder
      • w1

        protected double w1
      • w2

        protected double w2
      • w3

        protected double w3
      • w4

        protected double w4
    • Constructor Detail

      • AbstractPositionEstimator

        public AbstractPositionEstimator​(ChassisParameters chassisParameters,
                                         edu.wpi.first.wpilibj.interfaces.Accelerometer accelerometer,
                                         edu.wpi.first.wpilibj.interfaces.Gyro gyro,
                                         edu.wpi.first.wpilibj.Encoder frontLeftEncoder,
                                         edu.wpi.first.wpilibj.Encoder frontRightEncoder,
                                         edu.wpi.first.wpilibj.Encoder backLeftEncoder,
                                         edu.wpi.first.wpilibj.Encoder backRightEncoder)
        Construct a new PositionEstimator. Requires physical parameters of the robot and a collection of sensors from which to pull various data.
        Parameters:
        chassisParameters - physical parameters of the robot
        accelerometer - an accelerometer to measure acceleration
        gyro - a gyroscope to measure rotation
        frontLeftEncoder - an encoder to measure movement of the front left wheel
        frontRightEncoder - an encoder to measure movement of the front right wheel
        backLeftEncoder - an encoder to measure movement of the back left wheel
        backRightEncoder - an encoder to measure movement of the back right wheel
    • Method Detail

      • setInitialTheta

        public void setInitialTheta​(double theta0)
        Set the initial rotation of the robot. If the robot's initial heading is not to be interpreted as an angle of 0, use this method to set the correct offset (for example, if your robot begins matches rotated).
        Parameters:
        theta0 - the initial angle
      • task

        public void task()
                  throws java.lang.Exception
        The background task to run.
        Throws:
        java.lang.Exception - in case the defined task throws any Exceptions
      • updateSteerSpecificParameters

        protected abstract void updateSteerSpecificParameters()
      • updateTime

        protected void updateTime()
      • updateEstimate

        protected void updateEstimate()
      • reset

        public void reset()
      • getEstimate

        public Position getEstimate()
        Get the current estimate of the robot's on-field position.
        Returns:
        the position estimate