Package frc.lib5k.components
Class Compass
- java.lang.Object
-
- frc.lib5k.components.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 creationCompass(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 pointError2D
getError(FieldPosition robotPos)
Get an Error2D object for the position error from the robot's position to the Compass pointdouble
getHeadingError()
FieldPosition
getPoint()
Get the Compass pointvoid
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 Shuffleboardvoid
setPoint(FieldPosition point)
Set the Compass point
-
-
-
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 interfaceedu.wpi.first.wpilibj.Sendable
-
-