Class TiltSensor


  • public class TiltSensor
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TiltSensor​(edu.wpi.first.wpilibj.interfaces.Accelerometer accel)
      Converts an accelerometer reading to tilt.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void calibrate()
      Calibrate the tilt sensor by setting the current pitch and roll as the zero position.
      double getPitch()
      Calculates the pitch.
      double getRoll()
      Calculates the roll.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TiltSensor

        public TiltSensor​(edu.wpi.first.wpilibj.interfaces.Accelerometer accel)
        Converts an accelerometer reading to tilt.
        Parameters:
        accel - The accelerometer to base tilt off of.
    • Method Detail

      • calibrate

        public void calibrate()
        Calibrate the tilt sensor by setting the current pitch and roll as the zero position.
      • getRoll

        public double getRoll()
        Calculates the roll.
        Returns:
        The roll in degrees.
      • getPitch

        public double getPitch()
        Calculates the pitch.
        Returns:
        The pitch in degrees.