Class DoubleCRServo

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

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

    Fields
    Modifier and Type
    Field
    Description
    final com.qualcomm.robotcore.hardware.CRServo
    The DcMotors associated with this motor.
    final com.qualcomm.robotcore.hardware.CRServo
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DoubleCRServo(com.qualcomm.robotcore.hardware.CRServo servo1, com.qualcomm.robotcore.hardware.CRServo servo2, double servoPowerCoefficient)
    Instantiate a DoubleCRServo.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the internal CRServo devices.
    void
    spin(com.qualcomm.robotcore.hardware.DcMotorSimple.Direction direction)
    Starts moving the motor at a given speed.
    void
    Stop the movement of the motor.

    Methods inherited from class java.lang.Object

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

    • servo1

      public final com.qualcomm.robotcore.hardware.CRServo servo1
      The DcMotors associated with this motor.
    • servo2

      public final com.qualcomm.robotcore.hardware.CRServo servo2
  • Constructor Details

    • DoubleCRServo

      public DoubleCRServo(com.qualcomm.robotcore.hardware.CRServo servo1, com.qualcomm.robotcore.hardware.CRServo servo2, double servoPowerCoefficient)
      Instantiate a DoubleCRServo. Also uses an encoder.
      Parameters:
      servo1 - The first CRServo that is associated with this DoubleCRServo.
      servo2 - The second CRServo that is associated with this DoubleCRServo. MUST BE THE SAME KIND OF MOTOR!
      servoPowerCoefficient - Coefficient of power for servos
  • Method Details

    • spin

      public void spin(com.qualcomm.robotcore.hardware.DcMotorSimple.Direction direction)
      Starts moving the motor at a given speed.
      Parameters:
      direction - Determines the direction the motor should rotate.
    • stopMoving

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

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