Package com.pocolifo.robobase.motor
Class DoubleMotor
java.lang.Object
com.pocolifo.robobase.motor.DoubleMotor
- All Implemented Interfaces:
AutoCloseable
Represents a synchronized two-motor assembly, such as an intake, an outtake, linear slides, etc.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDoubleMotor
(Motor motor1, Motor motor2, double motor1Coefficient, double motor2Coefficient) Instantiate aDoubleMotor
. -
Method Summary
-
Field Details
-
motor1
TheDcMotor
s associated with this motor. -
motor2
-
-
Constructor Details
-
DoubleMotor
Instantiate aDoubleMotor
. Also uses an encoder.- Parameters:
motor1
- The firstMotor
that is associated with thisDoubleMotor
.motor2
- The secondMotor
that is associated with thisDoubleMotor
. MUST BE THE SAME KIND OF MOTOR!motor1Coefficient
- Coefficient of power for motor1motor2Coefficient
- 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 internalMotor
devices. THIS SHOULD BE CALLED WHEN MOTORS ARE DONE BEING USED!- Specified by:
close
in interfaceAutoCloseable
-