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
|
OpModeServices |
internalOpModeServices
this is logically an internal field.
|
int |
msStuckDetectInit |
int |
msStuckDetectInitLoop |
int |
msStuckDetectLoop |
int |
msStuckDetectStart |
int |
msStuckDetectStop |
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
|
void |
internalPostInitLoop()
automatically update telemetry in a non-linear opmode
|
void |
internalPostLoop()
automatically update telemetry in a non-linear opmode
|
void |
internalPreInit() |
void |
internalUpdateTelemetryNow(TelemetryMessage telemetry)
This is an internal SDK method, not intended for use by user opmodes.
|
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.
|
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 int msStuckDetectInit
public int msStuckDetectInitLoop
public int msStuckDetectStart
public int msStuckDetectLoop
public int msStuckDetectStop
public OpModeServices internalOpModeServices
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 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()
public void updateTelemetry(Telemetry telemetry)
telemetry
- the telemetry data to transmittelemetry
,
Telemetry.update()
public void internalPreInit()
public void internalPostInitLoop()
public void internalPostLoop()
public final void internalUpdateTelemetryNow(TelemetryMessage telemetry)
telemetry
- the telemetry data to transmittelemetry
,
Telemetry.update()