Learner

Hardware Mapping

Two more preparatory topics and then we can write some code!

A key function of the FTC SDK, and of any robotics API, is to provide software access to the physical hardware of a robot. A way must be provided to allow programmers to identify, in software, hardware devices on the robot so that they can write programs that interact with that hardware. On the Tetrix/REV platform, this is called hardware mapping.

The FTC SDK Library

The FTC SDK Library is a library of classes that allow your programs to access and control all aspects of the Tetrix robot control system and the hardware devices attached to it. This library is the API for the control system and robot hardware. The library is included in the FTC SDK. You can access the library with the following import statement in an OpMode class:

Linear OpModes

The Linear OpMode is much simpler than the regular OpMode. You extend LinearOpMode and there is only one method to override: runOpMode(). This method is called after the Init button is pressed on the DS. So how do you separate initialization from actually starting the program running? You use the waitForStart() method inherited from the base LinearOpMode class.
 

Regular OpModes

The regular OpMode type that you would write extends the OpMode class in the FTC SDK. To add functionality, your code will override one or more of the following methods that exist in the base OpMode class:

  • init()
  • init_loop()
  • start()
  • stop()
  • loop()

These methods are called at the appropriate time in response to button presses on the driver station (DS).

Start Programming

Now its time to get more familiar with OnBot or Android Studio and writing OpModes. All of the code samples in this curriculum will work in either OnBot or AS.

OpMode Basics

The term OpMode or Operational Mode (also Op Mode and opmode) refers to a class located within the FTC SDK (robot controller app source code). You create this class to add your code to the controller app. Your code is really just a part of the controller app, with the rest of the app supplied by the FTC source code. We don't modify that other part of the code, we just create the custom robot behavior we want by adding our own OpModes. Here is a quick video overview of OpModes.

Getting Started

This course will not delve into Tetrix/REV hardware details or discuss how to build the physical robot. It is assumed you will learn about these topics elsewhere. The code exercises for this unit can be run on the classic example robot "pushbot", build instructions here.

Introduction

This lesson is the first in the "off ramp" unit for RoboRio programmers. This unit contains a detailed exploration of writing Java programs for the RoboRio. Don't forget to complete the rest of the Java curriculum starting with Unit 12.

We have been learning a lot about the Java programming language. Now its time to explore how we actually write, compile and deploy Java programs for the RoboRio (FRC) robotics control system.

Introduction

This lesson is the first in the "off ramp" unit for Tetrix/REV programmers. This unit contains a detailed exploration of writing Java programs for the control system used on Tetrix/REV based robots. Don't forget to complete the rest of the Java curriculum starting with Unit 12.

We have been learning a lot about the Java programming language. Now its time to explore how we actually write, compile and deploy Java programs to the robotics control system.

leJOS Example Programs

leJOS provides a set of example programs you can download and install into Eclipse. The examples show how to do a number of things with the leJOS API and are valuable to have available to look at. These examples cover advanced topics and techniques so you should work through the exercises in this unit before looking at these examples.

You can download the examples here. Select the file leJOS_EV3_0.9.1-beta_samples.zip.

Pages