Package trclib.command
Class CmdDriveMotorsTest
java.lang.Object
trclib.command.CmdDriveMotorsTest
- All Implemented Interfaces:
TrcRobot.RobotCommand
This class implements the drive base motors test. This test will spin each of the drive base motors at the
specified drive power for the specified period of time.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TrcDashboardprivate final doubleprivate final doubleprivate final TrcEventprivate intprivate final TrcMotor[]private final TrcStateMachine<CmdDriveMotorsTest.State>private final TrcTimerprivate final TrcDbgTrace -
Constructor Summary
ConstructorsConstructorDescriptionCmdDriveMotorsTest(TrcMotor[] motors, double driveTime, double drivePower) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()This method cancels the command if it is active.booleancmdPeriodic(double elapsedTime) This method must be called periodically by the caller to drive the command sequence forward.booleanisActive()This method checks if the current RobotCommand is running.private voidThis method stops all motors on the drive base.
-
Field Details
-
dashboard
-
tracer
-
motors
-
driveTime
private final double driveTime -
drivePower
private final double drivePower -
event
-
timer
-
sm
-
motorIndex
private int motorIndex
-
-
Constructor Details
-
CmdDriveMotorsTest
Constructor: Create an instance of the object.- Parameters:
motors- specifies the array of motors on the drive base.driveTime- specifies the amount of drive time in seconds.drivePower- specifies the motor power.
-
-
Method Details
-
isActive
public boolean isActive()This method checks if the current RobotCommand is running.- Specified by:
isActivein interfaceTrcRobot.RobotCommand- Returns:
- true if the command is running, false otherwise.
-
cancel
public void cancel()This method cancels the command if it is active.- Specified by:
cancelin interfaceTrcRobot.RobotCommand
-
cmdPeriodic
public boolean cmdPeriodic(double elapsedTime) This method must be called periodically by the caller to drive the command sequence forward.- Specified by:
cmdPeriodicin interfaceTrcRobot.RobotCommand- Parameters:
elapsedTime- specifies the elapsed time in seconds since the start of the robot mode.- Returns:
- true if the command sequence is completed, false otherwise.
-
stopAllWheels
private void stopAllWheels()This method stops all motors on the drive base.
-