Class Compass

  • All Implemented Interfaces:
    edu.wpi.first.wpilibj.Sendable

    public class Compass
    extends java.lang.Object
    implements edu.wpi.first.wpilibj.Sendable
    • Constructor Summary

      Constructors 
      Constructor Description
      Compass()
      Create a Compass that points to the robot's location at time of creation
      Compass​(FieldPosition point)
      Create a Compass that points to a specific FieldPosition.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Error2D getError()
      Get an Error2D object for the position error from the robot's position to the Compass point
      Error2D getError​(FieldPosition robotPos)
      Get an Error2D object for the position error from the robot's position to the Compass point
      double getHeadingError()  
      FieldPosition getPoint()
      Get the Compass point
      void initSendable​(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder builder)
      Make WPIlib think this is a Gyroscope, so it can be displayed as a compass view in Shuffleboard
      void setPoint​(FieldPosition point)
      Set the Compass point
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface edu.wpi.first.wpilibj.Sendable

        addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem
    • Constructor Detail

      • Compass

        public Compass()
        Create a Compass that points to the robot's location at time of creation
      • Compass

        public Compass​(FieldPosition point)
        Create a Compass that points to a specific FieldPosition. The Compass requires the LocalizationEngine to be active.
        Parameters:
        point - FieldPosition to point to
    • Method Detail

      • getHeadingError

        public double getHeadingError()
      • getError

        public Error2D getError()
        Get an Error2D object for the position error from the robot's position to the Compass point
        Returns:
        Error2D
      • getError

        public Error2D getError​(FieldPosition robotPos)
        Get an Error2D object for the position error from the robot's position to the Compass point
        Parameters:
        robotPos - Robot's current FieldPosition
        Returns:
        Error2D
      • setPoint

        public void setPoint​(FieldPosition point)
        Set the Compass point
        Parameters:
        point - FieldPosition
      • getPoint

        public FieldPosition getPoint()
        Get the Compass point
        Returns:
        Point the Compass is pointing to
      • initSendable

        public void initSendable​(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder builder)
        Make WPIlib think this is a Gyroscope, so it can be displayed as a compass view in Shuffleboard
        Specified by:
        initSendable in interface edu.wpi.first.wpilibj.Sendable