Package trclib.robotcore
Interface TrcRobot.RobotCommand
- All Known Implementing Classes:
CmdDriveMotorsTest
,CmdPidDrive
,CmdPurePursuitDrive
,CmdTimedDrive
,CmdWaltzTurn
- Enclosing class:
- TrcRobot
public static interface TrcRobot.RobotCommand
This interface is used to implement a robot command. A robot command consists of a sequence of actions
typically executed using a state machine. It can be used to implement an entire autonomous strategy or
it can implement a subset of an autonomous strategy that can be reused as a common portion of multiple
autonomous strategies. This helps to reduce code duplication and improves code maintenance.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
This method is called to cancel the RobotCommand prematurely.boolean
cmdPeriodic
(double elapsedTime) This method is call periodically to perform the robot command.boolean
isActive()
This method checks if the current RobotCommand is running.
-
Method Details
-
cmdPeriodic
boolean cmdPeriodic(double elapsedTime) This method is call periodically to perform the robot command. Typically, it is implemented by using a state machine.- Parameters:
elapsedTime
- specifies the elapsed time of the period in seconds.- Returns:
- true if the command is done, false otherwise.
-
isActive
boolean isActive()This method checks if the current RobotCommand is running.- Returns:
- True if the command is running, false otherwise.
-
cancel
void cancel()This method is called to cancel the RobotCommand prematurely.
-