public abstract class OpMode
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
Gamepad |
gamepad1
Gamepad 1
|
Gamepad |
gamepad2
Gamepad 2
|
HardwareMap |
hardwareMap
Hardware Mappings
|
Telemetry |
telemetry
The
telemetry field contains an object in which a user may accumulate data which
is to be transmitted to the driver station. |
double |
time
number of seconds this op mode has been running, this is
updated before every call to loop.
|
| Constructor and Description |
|---|
OpMode()
OpMode constructor
|
| Modifier and Type | Method and Description |
|---|---|
double |
getRuntime()
Get the number of seconds this op mode has been running
|
void |
init_loop()
User defined init_loop method
|
abstract void |
init()
User defined init method
|
abstract void |
loop()
User defined loop method
|
void |
requestOpModeStop()
Requests that this OpMode be shut down if it the currently active opMode, much as if the stop
button had been pressed on the driver station; if this is not the currently active OpMode,
then this function has no effect.
|
void |
resetStartTime()
Reset the start time to zero.
|
void |
start()
User defined start method.
|
void |
stop()
User defined stop method
|
void |
updateTelemetry(Telemetry telemetry)
Refreshes the user's telemetry on the driver station with the contents of the provided telemetry
object if a nominal amount of time has passed since the last telemetry transmission.
|
void |
updateTelemetryNow(Telemetry telemetry)
Refreshes the user's telemetry on the driver station with the contents of the provided telemetry
object irregardless of the interval since the last telemetry transmission.
|
public Gamepad gamepad1
public Gamepad gamepad2
public Telemetry telemetry
telemetry field contains an object in which a user may accumulate data which
is to be transmitted to the driver station. This data is automatically transmitted to the
driver station on a regular, periodic basis.public HardwareMap hardwareMap
public double time
public OpMode()
The op mode name should be unique. It will be the name displayed on the driver station. If multiple op modes have the same name, only one will be available.
public final void updateTelemetry(Telemetry telemetry)
telemetry object is automatically transmitted to the driver station periodically;
calling updateTelemetry() on that Telemetry object
is thus entirely optional.telemetry - the telemetry data to transmittelemetry,
Telemetry.clearData()public final void updateTelemetryNow(Telemetry telemetry)
This method must be used with caution, as its indiscriminate use can consume
network bandwidth. It's actually extraordinarily rare that calling updateTelemetryNow()
is necessary; almost always a simple updateTelemetry() is a more
appropriate choice.
telemetry - the telemetry data to transmittelemetry,
updateTelemetry(Telemetry)public abstract void init()
This method will be called once when the INIT button is pressed.
public void init_loop()
This method will be called repeatedly when the INIT button is pressed. This method is optional. By default this method takes no action.
public void start()
This method will be called once when the PLAY button is first pressed. This method is optional. By default this method takes not action. Example usage: Starting another thread.
public abstract void loop()
This method will be called repeatedly in a loop while this op mode is running
public void stop()
This method will be called when this op mode is first disabled The stop method is optional. By default this method takes no action.
public final void requestOpModeStop()
stop()
method will be called, as that is part of the usual shutdown logic. Note that requestOpModeStop()
may be called from any thread.stop()public double getRuntime()
This method has sub millisecond accuracy.
public void resetStartTime()