NOTICE
This repository contains the public FTC SDK for the Freight Frenzy (2021-2022) competition season.
Welcome!
This GitHub repository contains the source code that is used to build an Android app to control a FIRST Tech Challenge competition robot. To use this SDK, download/clone the entire project to your local computer.
Getting Started
If you are new to robotics or new to the FIRST Tech Challenge, then you should consider reviewing the FTC Blocks Tutorial to get familiar with how to use the control system:
FTC Blocks Online Tutorial
Even if you are an advanced Java programmer, it is helpful to start with the FTC Blocks tutorial, and then migrate to the OnBot Java Tool or to Android Studio afterwards.
Downloading the Project
If you are an Android Studio programmer, there are several ways to download this repo. Note that if you use the Blocks or OnBot Java Tool to program your robot, then you do not need to download this repository.
- If you are a git user, you can clone the most current version of the repository:
git clone https://github.com/FIRST-Tech-Challenge/FtcRobotController.git
-
Or, if you prefer, you can use the "Download Zip" button available through the main repository page. Downloading the project as a .ZIP file will keep the size of the download manageable.
-
You can also download the project folder (as a .zip or .tar.gz archive file) from the Downloads subsection of the Releases page for this repository.
-
The Releases page also contains prebuilt APKs.
Once you have downloaded and uncompressed (if needed) your folder, you can use Android Studio to import the folder ("Import project (Eclipse ADT, Gradle, etc.)").
Getting Help
User Documentation and Tutorials
FIRST maintains online documentation with information and tutorials on how to use the FIRST Tech Challenge software and robot control system. You can access this documentation using the following link:
FtcRobotController Online Documentation
Note that the online documentation is an "evergreen" document that is constantly being updated and edited. It contains the most current information about the FIRST Tech Challenge software and control system.
Javadoc Reference Material
The Javadoc reference documentation for the FTC SDK is now available online. Click on the following link to view the FTC SDK Javadoc documentation as a live website:
FTC Javadoc Documentation
Online User Forum
For technical questions regarding the Control System or the FTC SDK, please visit the FTC Technology forum:
FTC Technology Forum
Sample OpModes
This project contains a large selection of Sample OpModes (robot code examples) which can be cut and pasted into your /teamcode folder to be used as-is, or modified to suit your team's needs.
Samples Folder: /FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples
The readme.md file located in the /TeamCode/src/main/java/org/firstinspires/ftc/teamcode folder contains an explanation of the sample naming convention, and instructions on how to copy them to your own project space.
Release Information
Version 8.0 (20220907-131644)
Breaking Changes
- Increases the Robocol version.
- This means an 8.0 or later Robot Controller or Driver Station will not be able to communicate with a 7.2 or earlier Driver Station or Robot Controller.
- If you forget to update both apps at the same time, an error message will be shown explaining which app is older and should be updated.
- Initializing I2C devices now happens when you retrieve them from the
HardwareMap for the first time.
- Previously, all I2C devices would be initialized before the Op Mode even began executing,
whether you were actually going to use them or not. This could result in reduced performance and
unnecessary warnings.
- With this change, it is very important for Java users to retrieve all needed devices from the
HardwareMap during the Init phase of the Op Mode. Namely, declare a variable for each hardware
device the Op Mode will use, and assign a value to each. Do not do this during the Run phase, or your
Op Mode may briefly hang while the devices you are retrieving get initialized.
- Op Modes that do not use all of the I2C devices specified in the configuration file should take
less time to initialize. Op Modes that do use all of the specified I2C devices should take the
same amount of time as previously.
- Fixes issue #251 by changing the order in which axis rotation rates are read from the angular velocity vector in the BNO055 IMU driver.
- Deprecates
pitchMode in BNO055IMU.Parameters.
- Setting
pitchMode to PitchMode.WINDOWS would break the coordinate conventions used by the driver.
- Moves
OpModeManagerImpl to the com.qualcomm.robotcore.eventloop.opmode package.
- This breaks third party libraries EasyOpenCV (version 1.5.1 and earlier) and FTC Dashboard (version 0.4.4 and earlier).
- Deletes the deprecated
OpMode method resetStartTime() (use resetRuntime() instead).
- Deletes the protected
LinearOpMode.LinearOpModeHelper class (which was not meant for use by Op Modes).
- Removes I2C Device (Synchronous) config type (deprecated since 2018)
Enhancements
- Uncaught exceptions in Op Modes no longer require a Restart Robot
- A blue screen popping up with a stacktrace is not an SDK error; this replaces the red text in the telemetry area.
- Since the very first SDK release, Op Mode crashes have put the robot into "EMERGENCY STOP" state, only showing the first line of the exception, and requiring the user to press "Restart Robot" to continue
- Exceptions during an Op Mode now open a popup window with the same color scheme as the log viewer, containing 15 lines of the exception stacktrace to allow easily tracing down the offending line without needing to connect to view logs over ADB or scroll through large amounts of logs in the log viewer.
- The exception text in the popup window is both zoomable and scrollable just like a webpage.
- Pressing the "OK" button in the popup window will return to the main screen of the Driver Station and allow an Op Mode to be run again immediately, without the need to perform a "Restart Robot"
- Adds new Java sample to demonstrate using a hardware class to abstract robot actuators, and share them across multiple Op Modes.
- Sample Op Mode is /FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptExternalHardwareClass.java
- Abstracted hardware class is /FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/RobotHardware.java)
- Updates RobotAutoDriveByGyro_Linear Java sample to use REV Control/Expansion hub IMU.
- Updates Vuforia samples to reference PowerPlay assets and have correct names and field locations of image targets.
- Updates TensorFlow samples to reference PowerPlay assets.
- Adds opt-in support for Java 8 language features to the OnBotJava editor.
- To opt in, open the OnBotJava Settings, and check
Enable beta Java 8 support.
- Note that Java 8 code will only compile when the Robot Controller runs Android 7.0 Nougat or later.
- Please report issues here.
- In OnBotJava, clicking on build errors now correctly jumps to the correct location.
- Improves OnBotJava autocomplete behavior, to provide better completion options in most cases.
- Adds a QR code to the Robot Controller Inspection Report when viewed from the Driver Station for scanning by inspectors at competition.
- Improves I2C performance and reliability in some scenarios.
Version 7.2 (20220723-130006)
Breaking Changes
- Updates the build tooling. For Android Studio users, this change requires Android Studio Chipmunk 2021.2.1.
- Removes support for devices that are not competition legal, including Modern Robotics Core Control Modules, the Matrix Controller, and HiTechnic/NXT controllers and sensors. Support remains for Modern Robotics I2C sensors.
Enhancements
- Increases the height of the 3-dots Landscape menu touch area on the Driver Station, making it much easier to select.
- Adds
terminateOpModeNow() method to allow OpModes to cleanly self-exit immediately.
- Adds
opModeInInit() method to LinearOpMode to facilitate init-loops. Similar to opModeIsActive() but for the init phase.
- Warns user if they have a Logitech F310 gamepad connected that is set to DirectInput mode.
- Allows SPARKmini motor controllers to react more quickly to speed changes.
- Hides the version number of incorrectly installed sister app (i.e. DS installed on RC device or vice-versa) on inspection screen.
- Adds support for allowing the user to edit the comment for the runOpMode block.
- Adds parameterDefaultValues field to @ExportToBlocks. This provides the ability for a java method with an @ExportToBlocks annotation to specify default values for method parameters when it is shown in the block editor.
- Make LinearOpMode blocks more readable. The opmode name is displayed on the runOpMode block, but not on the other LinearOpMode blocks.
- Added support to TensorFlow Object Detection for using a different frame generator, instead of Vuforia.
Using Vuforia to pass the camera frame to TFOD is still supported.
- Removes usage of Renderscript.
- Fixes logspam on app startup of repeated stacktraces relating to
"Failed resolution of: Landroid/net/wifi/p2p/WifiP2pManager$DeviceInfoListener"
- Allows disabling bluetooth radio from inspection screen
- Improves warning messages when I2C devices are not responding
- Adds support for controlling the RGB LED present on PS4/Etpark gamepads from OpModes
- Removes legacy Pushbot references from OpMode samples. Renames "Pushbot" samples to "Robot". Motor directions reversed to be compatible with "direct Drive" drive train.
Bug fixes
- Fixes issue #316 (MatrixF.inverted() returned an incorrectly-sized matrix for 1x1 and 2x2 matrixes).
- Self inspect now allows for Driver Station and Robot Controller compatibility between point releases.
- Fixes bug where if the same
RumbleEffect object instance was queued for multiple gamepads, it
could happen that both rumble commands would be sent to just one gamepad.
- Fixes bug in Driver Station where on the Driver Hub, if Advanced Gamepad Features was disabled and
an officially supported gamepad was connected, then opening the Advanced Gamepad Features or
Gamepad Type Overrides screens would cause the gamepad to be rebound by the custom USB driver even
though advanced gamepad features was disabled.
- Protects against (unlikely) null pointer exception in Vuforia Localizer.
- Harden OnBotJava and Blocks saves to protect against save issues when disconnecting from Program and Manage
- Fixes issue where the RC app would hang if a REV Hub I2C write failed because the previous I2C
operation was still in progress. This hang most commonly occurred during REV 2M Distance Sensor initialization
- Removes ConceptWebcam.java sample program. This sample is not compatible with OnBotJava.
- Fixes bug where using html tags in an @ExportToBlocks comment field prevented the blocks editor from loading.
- Fixes blocks editor so it doesn't ask you to save when you haven't modified anything.
- Fixes uploading a very large blocks project to offline blocks editor.
- Fixes bug that caused blocks for DcMotorEx to be omitted from the blocks editor toolbox.
- Fixes Blocks Programs Stripped of Blocks (due to using TensorFlow Label block)
Version 7.1 (20211223-120805)
- Fixes crash when calling
isPwmEnabled() (issue #223).
- Fixes lint error (issue #4).
- Fixes Driver Station crash when attempting to use DualShock4 v1 gamepad with Advanced Gamepad Features enabled (issue #173).
- Fixes possible (but unlikely) Driver Station crash when connecting gamepads of any type.
- Fixes bug where Driver Station would use generic 20% deadzone for Xbox360 and Logitech F310 gamepads when Advanced Gamepad Features was disabled.
- Added SimpleOmniDrive sample OpMode.
- Adds UVC white balance control API.
- Fixes issue #259 Most blocks samples for TensorFlow can't be used for a different model.
- The blocks previously labeled TensorFlowObjectDetectionFreig