Class Wheel

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class Wheel
    extends Motor
    Represents a single wheel on the robot.
    See Also:
    CarWheels
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double circumferenceCm
      The circumference of this wheel, in centimeters.
      int targetPosition
      The target encoder position
      double wheelDiameterCm
      The diameter of this wheel, in centimeters.
    • Constructor Summary

      Constructors 
      Constructor Description
      Wheel​(com.qualcomm.robotcore.hardware.DcMotor motor, int tickCount, double wheelDiameterCm)
      Instantiate a Wheel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setDriveTarget​(double centimeters)
      Sets how far the motor should move (in centimeters).
      • Methods inherited from class java.lang.Object

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

      • wheelDiameterCm

        public final double wheelDiameterCm
        The diameter of this wheel, in centimeters.
      • circumferenceCm

        public final double circumferenceCm
        The circumference of this wheel, in centimeters.
      • targetPosition

        public int targetPosition
        The target encoder position
    • Constructor Detail

      • Wheel

        public Wheel​(com.qualcomm.robotcore.hardware.DcMotor motor,
                     int tickCount,
                     double wheelDiameterCm)
        Instantiate a Wheel.
        Parameters:
        motor - The DcMotor that is associated with this Motor.
        tickCount - The number of ticks for a full revolution of this motor.
        wheelDiameterCm - The diameter of the wheel in real life, in centimeters.
    • Method Detail

      • setDriveTarget

        public void setDriveTarget​(double centimeters)
        Sets how far the motor should move (in centimeters).
        Parameters:
        centimeters - How far the motor should move, in centimeters. Negative values move the wheel in reverse, and positive values move the wheel forward.