FTC SIM

Linear OpMode

public void runOpMode() {}
Description
Override this method and place your code here. Please do not swallow the InterruptedException, as it is used in cases where the op mode needs to be terminated early.
Parameters
No parameters
Return
No return

waitForStart();
Description
Pauses the Linear Op Mode until start has been pressed or until the current thread is interrupted.
Parameters
No parameters
Return
No return

opModeIsActive();
Description
Answer as to whether this opMode is active and the robot should continue onwards. If the opMode is not active, the OpMode should terminate at its earliest convenience. Note that internally this method calls idle()
Parameters
No parameters
Return
whether the OpMode is currently active. If this returns false, you should break out of the loop in your runOpMode() method and return to its caller.

sleep(float milliseconds);
Description
Sleeps for the given amount of milliseconds, or until the thread is interrupted. This is simple shorthand for the operating-system-provided sleep() method.
Parameters
milliseconds - amount of time to sleep, in milliseconds
Return
No return

GamePad

Actuators

 DcMotor

motorLeft.setPower(float power);
Description
Sets the power level of the motor, expressed as a fraction of the maximum possible power / speed supported according to the run mode in which the motor is operating.
Parameters
power - the new power level of the motor, a value in the interval [-1.0, 1.0]
Return
No return

motorLeft.getPower()
Description
Returns the current configured power level of the motor.
Parameters
No parameters
Return
the current level of the motor, a value in the interval [0.0, 1.0]

motorLeft.setDirection(DcMotorSimple.Direction direction);
Description
Sets the logical direction in which this motor operates.
Parameters
direction - the direction to set for this motor
Return
No return

motorLeft.getDirection()
Description
Returns the current logical direction in which this motor is set as operating.
Parameters
No parameters
Return
the current logical direction in which this motor is set as operating.

motorLeft.setTargetPosition(int position);
Description
Sets the desired encoder target position to which the motor should advance or retreat and then actively hold thereat. This behavior is similar to the operation of a servo. The maximum speed at which this advance or retreat occurs is governed by the power level currently set on the motor. While the motor is advancing or retreating to the desired taget position, isBusy() will return true. Note that adjustment to a target position is only effective when the motor is in RUN_TO_POSITION RunMode. Note further that, clearly, the motor must be equipped with an encoder in order for this mode to function properly.
Parameters
position - the desired encoder target position
Return
No return

motorLeft.getTargetPosition()
Description
Returns the current target encoder position for this motor.
Parameters
No parameters
Return
the current target encoder position for this motor.

DcMotor.RunMode.RUN_USING_ENCODER
Description
The motor is to do its best to run at targeted velocity. An encoder must be affixed to the motor in order to use this mode. This is a PID mode.
Parameters
No parameters
Return
Returns the specified run mode

motorLeft.setMode(DcMotor.RunMode mode);
Description
Sets the current run mode for this motor
Parameters
mode - the new current run mode for this motor
Return
No return

motorLeft.getMode()
Description
Returns the current run mode for this motor
Parameters
No parameters
Return
the current run mode for this motor

  Dual
motorLeft.setPower(float power1);
motorRight.setPower(float power2);
Description
Sets the power level of 2 specified motors, expressed as a fraction of the maximum possible power / speed supported according to the run mode in which the motor is operating.
Parameters
power1 - the new power level of the motor1, a value in the interval [-1.0, 1.0]
power2 - the new power level of the motor2, a value in the interval [-1.0, 1.0]
Return
No return

 Servo

grabber.setDirection(Servo.Direction direction);
Description
Sets the logical direction in which this servo operates.
Parameters
direction - the direction to set for this servo
Return
No return

grabber.getDirection()
Description
Returns the current logical direction in which this servo is set as operating.
Parameters
No parameters
Return
the current logical direction in which this servo is set as operating.

grabber.setPosition(float position);
Description
Sets the current position of the servo, expressed as a fraction of its available range. If PWM power is enabled for the servo, the servo will attempt to move to the indicated position.
Parameters
position - the position to which the servo should move, a value in the range [0.0, 1.0]
Return
No return

grabber.getPosition()
Description
Returns the position to which the servo was last commanded to move. Note that this method does NOT read a position from the servo through any electrical means, as no such electrical mechanism is, generally, available.
Parameters
No parameters
Return
the position to which the servo was last commanded to move, or Double.NaN if no such position is known

grabber.scaleRange(float min, float max);
Description
Scales the available movement range of the servo to be a subset of its maximum range. Subsequent positioning calls will operate within that subset range. This is useful if your servo has only a limited useful range of movement due to the physical hardware that it is manipulating (as is often the case) but you don't want to have to manually scale and adjust the input to setPosition() each time.
For example, if scaleRange(0.2, 0.8) is set; then servo positions will be scaled to fit in that range:
setPosition(0.0) scales to 0.2
setPosition(1.0) scales to 0.8
setPosition(0.5) scales to 0.5
setPosition(0.25) scales to 0.35
setPosition(0.75) scales to 0.65
Note the parameters passed here are relative to the underlying full range of motion of the servo, not its currently scaled range, if any. Thus, scaleRange(0.0, 1.0) will reset the servo to its full range of movement.
Parameters
min - the lower limit of the servo movement range, a value in the interval [0.0, 1.0]
max - the upper limit of the servo movement range, a value in the interval [0.0, 1.0]
Return
No return

Sensors

 IMU-BNO055

imu.getAngularOrientation(AxesReference reference, AxesOrder order, AngleUnit angleUnit)
Description
Returns the absolute orientation of the sensor
Parameters
reference - the axes reference in which the result will be expressed
order - the axes order in which the result will be expressed
angleUnit - the angle units in which the result will be expressed
Return
Robot angle

imu.initialize(BNO055IMU.Parameters parameters);
Description
Initialize the sensor using the indicated set of parameters.
Parameters
parameters - the parameters with which to initialize the device
Return
No return

imu.getAngularOrientation()
Description
Returns the absolute orientation of the sensor
Parameters
No parameters
Return
the absolute orientation of the sensor

 IMU-BNO055.Parameters

new BNO055IMU.Parameters()
Description
Instances of Parameters contain data indicating how a BNO055 absolute orientation sensor is to be initialized.
Parameters
No parameters
Return
BNO055IMU.Parameters

BNO055IMU.Parameters.setAngleUnit(BNO055IMU.Parameters parameters, BNO055IMU.AngleUnit angleUnit);
Description
Set unit in which angles and angular rates are measured.
Parameters
parameters - BNO055IMU.Parameters to set acceleration unit
angleUnit- unit to set
Return
No return

BNO055IMU.Parameters.setAccelUnit(BNO055IMU.Parameters parameters, BNO055IMU.AccelUnit accelUnit);
Description
Set unit in which accelerations are measured.
Parameters
parameters - BNO055IMU.Parameters to set acceleration unit
accelUnit - unit to set
Return
No return

BNO055IMU.Parameters.setSensorMode(BNO055IMU.Parameters parameters, BNO055IMU.SensorMode sensorMode);
Description
Set the mode we wish to use the sensor in
Parameters
parameters - BNO055IMU.Parameters to set acceleration unit
sensorMode - mode to set
Return
No return

BNO055IMU.SensorMode.IMU
Description
A mode to use in the sensor
Parameters
No parameters
Return
IMU mode to use in the sensor

 Color Sensor

color1.red()
Description
Get the Red values detected by the sensor as an int.
Parameters
No parameters
Return
reading, unscaled.

color1.green()
Description
Get the Green values detected by the sensor as an int.
Parameters
No parameters
Return
reading, unscaled.

color1.blue()
Description
Get the Blue values detected by the sensor as an int.
Parameters
No parameters
Return
reading, unscaled.

 DistanceSensor

distance1.getDistance(DistanceUnit.CM))
Description
Returns the current distance in the indicated distance units
Parameters
unit - the unit of distance in which the result should be returned
Return
the current distance sas measured by the sensor. If no reading is available (perhaps the sensor is out of range), then distanceOutOfRange is returned;

DistanceUnit.CM
Description
DistanceUnit represents a unit of measure of distance.
Parameters
No parameters
Return
DistanceUnit (centimeter) a unit of measure of distance.

Utilities

 Acceleration

BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC
Description
units in which accelerations are measured. (MPS)
Parameters
No parameters
Return
units in which accelerations are measured.

 AngleUnit

BNO055IMU.AngleUnit.DEGREES
Description
units in which angles and angular rates are measured.(Degrees)
Parameters
No parameters
Return
units in which angles and angular rates are measured.

 Axis

AxesReference.INTRINSIC
Description
AxesReference indicates whether we have intrinsic rotations, where the axes move with the object that is rotating, or extrinsic rotations, where they remain fixed in the world around the object.
Parameters
No parameters
Return
AxesReference Intrinsic

AxesOrder.ZYX
Description
AxesOrder indicates the chronological order of axes about which the three rotations of an Orientation take place. The geometry of three space is such that there are exactly twelve distinct rotational orders.
Parameters
No parameters
Return
AxesOrder ZYX

 Color

Color.rgb(int r, int g, int b)
Description
Create a color object
Parameters
r - red
g - green
b - blue
Return
Color object that contains (red, green, and blue)

JavaUtil.rgbToHue(int r, int g, int b)
Description
Return hue of the color
Parameters
r - red
g - green
b - blue
Return
Hue of the color

JavaUtil.rgbToSaturation(int r, int g, int b)
Description
Return saturation of the color
Parameters
r - red
g - green
b - blue
Return
Saturation of the color

JavaUtil.rgbToValue(int r, int g, int b)
Description
Return value of the color
Parameters
r - red
g - green
b - blue
Return
Value the color

Color.red(Color col)
Description
Get red value of the col parameter
Parameters
col - color to get red value
Return
Red value

Color.green(Color col)
Description
Get green value of the col parameter
Parameters
col - color to get green value
Return
Green value

Color.blue(Color col)
Description
Get blue value of the col parameter
Parameters
col - color to get blue value
Return
Blue value

JavaUtil.colorToHue(Color col)
Description
Get hue of the col parameter
Parameters
col - col to get hue
Return
Hue of the col parameter

JavaUtil.colorToSaturation(Color col)
Description
Get saturation of the col parameter
Parameters
col - col to get saturation
Return
Saturation of the col parameter

JavaUtil.colorToValue(Color col)
Description
Get value of the col parameter
Parameters
col - col to get value
Return
Value of the col parameter

 Telemetry

telemetry.addData(String key, float number);
Description
Adds an item to the end if the telemetry being built for driver station display.
Parameters
key - caption
number - value to display
Return
No return

telemetry.addData(String key, String text);
Description
Adds an item to the end if the telemetry being built for driver station display.
Parameters
key - caption
text - text to display
Return
No return

 TensorFlow Object Detection

vuforiaTensorFlow.initialize(String vuforiaLicenseKey, CameraName cameraName, boolean useExtendedTracking, boolean enableCameraMonitoring, VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback, float dx, float dy, float dz, float xAngle, float yAngle, float zAngle, boolean useCompetitionFieldTargetLocations);
Description
Initializes Vuforia, with a CameraName.
Parameters
vuforiaLicenseKey - vuforiaLicenseKey
cameraName - name of the camera
useExtendedTracking - true if wish to use tracking
enableCameraMonitoring - true if wish to use the camera
cameraMonitorFeedback - camera monitor feedback
dx - camera x offset
dy - camera y offset
dz - camera z offset
xAngle - camera x angle
yAngle - camera y angle
zAngle - camera z angle
useCompetitionFieldTargetLocations - true if wish to use competition field target locations
Return
No return

tensorFlowObjectDetection.initialize(VuforiaBase vuforiaBase, float minimumConfidence, boolean useObjectTracker, boolean enableCameraMonitoring);
Description
Initializes TensorFlow Object Detection.
Parameters
vuforiaBase - instance of VuforiaBase to initialze
minimumConfidence - minimum confidence value to detect the object
useObjectTracker - true if wish to use object tracker
enableCameraMonitoring - true if wish to enable camera monitoring
Return
No return

tensorFlowObjectDetection.activate();
Description
Activates object detection.
Parameters
No parameters
Return
No return

tensorFlowObjectDetection.getRecognitions()
Description
Returns the list of recognitions.
Parameters
No parameters
Return
List of recognitions

recognition.getLabel()
Description
Returns the label of the detected object.
Parameters
No parameters
Return
the label of the detected object.

recognition.getLeft()
Description
Returns the left coordinate of the rectangle bounding the detected object.
Parameters
No parameters
Return
the left coordinate of the rectangle bounding the detected object.

recognition.getRight()
Description
Returns the right coordinate of the rectangle bounding the detected object.
Parameters
No parameters
Return
the right coordinate of the rectangle bounding the detected object.

recognition.getTop()
Description
Returns the top coordinate of the rectangle bounding the detected object.
Parameters
No parameters
Return
the top coordinate of the rectangle bounding the detected object.

recognition.getBottom()
Description
Returns the bottom coordinate of the rectangle bounding the detected object.
Parameters
No parameters
Return
the bottom coordinate of the rectangle bounding the detected object