Class DoubleMotor

java.lang.Object
com.pocolifo.robobase.motor.DoubleMotor
All Implemented Interfaces:
AutoCloseable

public class DoubleMotor extends Object implements AutoCloseable
Represents a synchronized two-motor assembly, such as an intake, an outtake, linear slides, etc.
  • Field Details

    • motor1

      public final Motor motor1
      The DcMotors associated with this motor.
    • motor2

      public final Motor motor2
  • Constructor Details

    • DoubleMotor

      public DoubleMotor(Motor motor1, Motor motor2, double motor1Coefficient, double motor2Coefficient)
      Instantiate a DoubleMotor. Also uses an encoder.
      Parameters:
      motor1 - The first Motor that is associated with this DoubleMotor.
      motor2 - The second Motor that is associated with this DoubleMotor. MUST BE THE SAME KIND OF MOTOR!
      motor1Coefficient - Coefficient of power for motor1
      motor2Coefficient - Coefficient of power for motor2
  • Method Details

    • spin

      public void spin(double speed)
      Starts moving the motor at a given speed.
      Parameters:
      speed - Determines the speed at which the motor should move.
    • stopMoving

      public void stopMoving()
      Stop the movement of the motor.
    • getPosition

      public int getPosition()
      Gets the current encoder position
    • getMotorRotations

      public double getMotorRotations()
      gets the number of motor rotations
    • close

      public void close()
      Closes the internal Motor devices. THIS SHOULD BE CALLED WHEN MOTORS ARE DONE BEING USED!
      Specified by:
      close in interface AutoCloseable