Robot Class

Abstract

Route:

Teamcode/java/org.firsinspires.ftc.teamcode/common/Robot

Robot.java contains all robot modules and is used as a unified entry point for the code. This makes it possible to rewrite repetitive code into function calls and be more readable.

trails

common\Robot.java

introduction

initialization

In either manual or automatic code, the Robot object needs to be defined first:

Robot robot = new Robot();

Then,use robot.init(this)inrunOpMode() to initialize the Robot object:

@Override
public void runOpMode() {
    robot.init(this);
    /*Main Methods*/
}

Usage

As a unified entry point for the code,all controlling over the robot can be invoked fromrobot.\<module>.\<method>And part of the code supports chains, examples are as follows:

robot.drivetrain.driveStrafe(-65.0, 0, DRIVESPEED);//drivetrain module
robot.subsystem.slamDunker.grab();//subsystem invocation
robot.gamepad1.update();//gamepadex Module
/*Other Methods*/

Detials

Robot.javaContains all the module entries for the machine, some of the commonly used modules are described below:

HardwareMap

Get the hardware via the hardware name edited on Driver Hub.

Telemetry

Telemetry on the Driver Hub for displaying information.

drivetrain

For chassis movement, see: drivetrain

subsystem

The subsystem of robot, including the control of arms.

gamepad

Operations of gamepadex, see:gamepadex

Last updated