Package trclib.robotcore
Interface TrcRobot.RobotMode
- All Known Implementing Classes:
FtcOpMode
- Enclosing class:
- TrcRobot
public static interface TrcRobot.RobotMode
This interface is normally implemented by the main robot code. The methods in this interface is called by
the Cooperative Multitasking Scheduler.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
periodic
(double elapsedTime, boolean slowPeriodicLoop) This method is called on the main robot thread periodically at PERIODIC_INTERVAL.void
startMode
(TrcRobot.RunMode prevMode, TrcRobot.RunMode nextMode) This method is called on the main robot thread when the competition mode is about to start.void
stopMode
(TrcRobot.RunMode prevMode, TrcRobot.RunMode nextMode) This method is called on the main robot thread when competition mode is about to end.
-
Method Details
-
startMode
This method is called on the main robot thread when the competition mode is about to start. In FTC, this is called when the "Play" button on the Driver Station is pressed. Typically, you put code that will prepare the robot for start of competition here such as resetting the encoders/sensors and enabling some sensors to start sampling.- Parameters:
prevMode
- specifies the previous RunMode it is coming from.nextMode
- specifies the next RunMode it is going into.
-
stopMode
This method is called on the main robot thread when competition mode is about to end. Typically, you put code that will do clean up here such as disabling the sampling of some sensors.- Parameters:
prevMode
- specifies the previous RunMode it is coming from.nextMode
- specifies the next RunMode it is going into.
-
periodic
void periodic(double elapsedTime, boolean slowPeriodicLoop) This method is called on the main robot thread periodically at PERIODIC_INTERVAL. Typically, you put the competition code here that processes sensor/gamepad inputs and controls the movement of the robot. Code that doesn't require high frequency processing should observe the slowPeriodicLoop parameter and only runs when it is true (e.g. TeleOp control and robot status updates).- Parameters:
elapsedTime
- specifies the elapsed time since the mode started.slowPeriodicLoop
- specifies true if it is running the slow periodic loop on the main robot thread, false otherwise.
-