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 TrcDashboard
private final double
private final double
private final TrcEvent
private int
private final TrcMotor[]
private final TrcStateMachine<CmdDriveMotorsTest.State>
private final TrcTimer
private final TrcDbgTrace
-
Constructor Summary
ConstructorsConstructorDescriptionCmdDriveMotorsTest
(TrcMotor[] motors, double driveTime, double drivePower) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
This method cancels the command if it is active.boolean
cmdPeriodic
(double elapsedTime) This method must be called periodically by the caller to drive the command sequence forward.boolean
isActive()
This method checks if the current RobotCommand is running.private void
This 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:
isActive
in 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:
cancel
in 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:
cmdPeriodic
in 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.
-