Advanced Robotics Programming

Advanced Robotics Programming

This section focuses on our Titan Robotics Framework (TRC Library). The target audience is for students who already know the Java language. The Titan Robotics Framework is designed for both FTC and FRC. After finishing this section, you should be able to write code for both FTC and FRC robots with minimal platform specific changes using our Framework Library.

Titan Robotics Framework Architecture

image name

Framework Library JavaDoc

Programming Software Installation

Before you can start coding, you need to install the required software on your computer. Please take some time to do this at home. Software installation could be time consuming and requires downloading gigabytes of data from the Internet. Follow the instructions below for the software you need.

Code Development Process

Before diving into code development, you need to learn about ‘‘Code Development Process’’.

TeleOp Driving Your Robot Right Out-Of-The-Box

At this point, you should have installed all necessary software for developing robot code and also clone the robot template code from the GitHub repo. Since the template already contains basic code for three different kinds of robot base (Differential Drive, Mecanum Drive and Swerve Drive), it takes very few modifications to make it work with any of the three types of robots.

Basic Subsystems Provided by Titan Robotics Framework

Once the drive base is fully operational, the next step is to create subsystems for the robot. Titan Robotics Framework provides supports for many basic simple subsystems as well as more complex subsystems.

Simple Subsystems

Complex Subsystems

such as Elevator, Arm, Intake, Grabber etc. Even though the game of each season changes, a lot of subsystems repeat themselves season after season. Therefore, the Framework Library provides generalized basic subsystems to handle most of the scenarios. Here are some typical subsystems provided by the Framework Library.



Creating Complex Subsystems

The above section talked about how to create simple subsystems using Basic Subsystems provided by the Framework Library. In this section, we will talk about creating complex subsystems that consist of multiple Basic subsystems and will support complex operations.

It is a good practice to create subsystems as separate Java classes that encapsulate all hardware related to those subsystems. To create a subsystem, you need to answer the following questions:

Since complex subsystems are very specific on their restrictions and what they can do, we are …

Tuning Subsystems

Scale and Offset

Gravity Compensation

PID

Tuning Drive Base

Odometry

PID

Operating Subsystems In TeleOp Mode

Creating Auto-Assist Tasks

Creating Autonomous Code

Miscellaneous

Analog Control Response

Gamepad provides a number of analog controls (e.g. joysticks and triggers). These controls give you a continuous value between -1.0 to 1.0 (or between 0.0 to 1.0) depending on how hard you pushed the control. These controls will return to their neutral positions when you let go. However, some of them such as joysticks, may not quite return to zero position. They may leave a small residual value (e.g. 0.1). As a result, if the joystick is controlling the robot drive train, you may notice the robot is still slowly creeping forward when you let go the joystick. To deal with this, we typically define a dead band within which we will return a zero value. For example, if we define a dead band of 0.2 and the joystick reads a value of 0.12 at its neutral position, we will return a zero value instead.

Typically, to move a mechanism with an analog control, one would read the value and directly apply it as the motor power of the mechanism linearly. However, there are times when you want to have more precise control of the mechanism when it is in the slow range of motion. Therefore, instead of applying the value linearly, it may be beneficial to apply it with an exponential decay curve such as a squared response curve. This gives you a wider low range and will accelerate in the narrower high range. The following diagram shows the joystick input to output response curve incorporating dead band and square response.

image name

Increase the number of available buttons on your Gamepad

Gamepad buttons are scarce resources, but there is a trick to give us more buttons. This is basically similar to a computer keyboard or calculator keypad where you have the Alt button (or 2nd Func button). By pressing and holding the Alt button down, other buttons on the keyboard can have other functions.

Different ways of using Gamepad buttons