Getting Started with Robot Development
This chapter details what software you need to install to write software for our robots provides starting points for learning on your own.
What you need to install
Git
Git is a popular version control system (VCS) for developing software. If you are interested in becoming a Software Engineer or writing code in general, learning to use git is an extremely important skill. You can download git here. When installing, just choose all the default recommended options.
We use GitHub to host and collaborate on our software projects, so you will need to make a GitHub account on github.com. Once you have an account, post your GitHub username in the #controls channel of our discord and we can add you to our GitHub organization which you can find here along with every software project our team has ever worked on.
WPILib
WPILib is the suite of software, known as a library that we use to actually control the components on the robots. WPILib has their own guide for setting up your development environment, however since their guide is designed for everybody across FRC, it has a lot of information not relevant to our team. Following the guide below should get you set up for developing robot programs for YETI. If you run into any issues in your setup, you can ask questions in the #controls channel of the YETI discord, and check out the WPILib guide as it may have the solution to your problem.
NOTE: This guide is for Windows, macOS, and Linux computers. You will NOT be able to write robot programs with ChromeOS.
Download the latest version of the installer from the WPILib Github. Scroll down to Downloads and download the appropriate installer for your operating system.
Read this if you use a mac
Before installing WPILib, mac users will need to install XCode Command Line Tools. These are tools developed by Apple for C++ development which WPILib requires to run. To do so, open the Terminal app on your mac and run the following command
xcode-select --install
You may need to run this command administrator privileges, in which case run the following command and enter your password when prompted. Note: When typing in your password in the terminal, it will look like nothing is happening, but this is just the terminal version of how websites show dots instead of letters in password fields.
sudo xcode-select --install
Next, you need to install the appropriate installer for the processor your mac uses, either an Intel or M series (arm64) chip. If you are unsure which your mac uses, do the following:
- Click the apple logo menu in the top left of your screen
- Click about this mac
- If it says you have an Apple M1/M2/etc. chip, download the arm64 installer. otherwise download the Intel version
- Open the file you downloaded
- Run the WPILibInstaller
- Click Start
- Choose Everything
- Select the top right option that says Skip and don't use VS Code
Why the option that says not recommended?
Selecting Everything will install all the development tools you need to code an FRC robot. The way you actually use those tools to write your code is up to you. All the other options will install a dedicated instance of VS Code, a very popular code editor that can be used to write just about any kind of program. If you already have VS Code installed, it will still install a new version. This is one reason I do not recommend this path, as it can be confusing what version of VS Code you are using.
The other reason is because here on Yeti, we use IntelliJ to write our robot code. This is because IntelliJ is specifically designed for developing Java programs, and so has many useful features that VS Code lacks out of the box. Additionally, I have found that Java development in VS Code is simply much buggier because it is not specifically designed for it while IntelliJ is.
Install for this User or Install for all Users? (doesn't apply to mac)
If you share your computer with anyone else, for example a parent, you should install for this user. If your computer is just yours, you should install for all users. The reason being is that installing for all users requires administrator privileges, which you may not have if this is not your computer. The difference does not matter too much, but installing for all users may create less problems in the future in terms of other software dependencies or updates.
IntelliJ
Here on YETI, we use IntelliJ to write our robot code. This is because IntelliJ is specifically designed for developing Java programs, and so has many useful features that VS Code lacks out of the box. Additionally, I have found that Java development in VS Code is simply much buggier because it is not specifically designed for it while IntelliJ is.
Install
- Download IntelliJ Community Edition (NOT Ultimate)
- Scroll down a little on this page to get to the community edition install
- Run the installer and install IntelliJ
- Open IntelliJ
- When you open IntelliJ, it will begin processing your workspace. The progress bar is in the bottom left.
Setup
Java
- Open settings
- Expand Build, Execution, and Deployment on the left
- Expand Build Tools
- Select Gradle
- Set Distribution to Wrapper
- In the Gradle JVM dropdown, select Download JDK
- Set Version to 17
- Set Vendor to Amazon Corretto
- Click Download
FRC Plugin
- Open settings
- Select Plugins on the left
- Select the Marketplace tab at the top
- Search for and install the FRC plugin
Next steps
You can view a list of additional resources here, including links to learn Java. For a guide for learning robot code, we have a roadmap for the FRC Ladder series here.
If you are interested in getting started developing for a Romi robot to practice robot code, we have a guide for setting that up here.
Learning Robot Code
FRCLadder
FRCLadder provides a series of videos that together serve as a great introduction into robot code. We've selected some below that are particularly relevant to the programming YETI does.
Note: The hardware and APIs available have changed quite a bit since some of these videos were published. However, the concepts and theory behind them remain the same.
Introduction to FRC Programming and Basic Drivetrain Code
How PIDs Work and How to Implement Them
Part 1: Dead Reckoning, Bang Bang, and using kP
Part 2: Using kI and kD
Supplemental: A practical example of tuning a PID loop and how each value affects movement
Resources
Java
Java is the programming language we use to write the code that enables the robot to do anything useful or interesting. You have know how to write software in Java to be able to program our robots.
If you don't have any experience programming, it can feel daunting. You have to learn how to think in a specific way using a language that you don't know yet. Fortunately, there are many resources available. The free Java course on CodeAcademy is a great way to learn Java at your own pace. You'll start from the basics and learn everything you need to know to program effectively.
Git
Git is a version control system for tracking changes across files in a project (aka repository). It is what enables collaborative software development and is used by every programmer. Github is a website that hosts git repositories. There a lots of programs and apps to manage git for you, but my preferred way is the command line. CodeAcademy has a good course on git as well.
You can access all of the code YETI has ever written on our GitHub page.
Some repositories worth looking at:
WPILib
Also highly recommended is the Command-Based Programming for getting familiar with the concepts and APIs. Specifically these pages;
My presentation on some basic WPILib concepts
A textbook on robot development by team TER3M Robotics
Control Theory
Teaching Rocks to Think is a great blog about Programming applied to FRC.
There are five blog posts pertaining to control theory.
- Systems & Control Engineering
- Mathematical Models of the World
- PID & Controller Design
- Tuning PID - This one is really cool! It has an interactive guide to tuning a PID loop
- Supplemental - Vertical Arm
Getting started with a Romi
Romis are small robots that you program the same way you program the big robots we build for the season. they are a great way to get familiar with how commands and subsystems work. you can read more about romis here.
to get started programming a romi, make sure you have installed all the tools you need for robot development.
we have a starting template for programming the romi on our github here. to get started with it, follow these steps:
- click the use this template dropdown in the top right, then Create a new repository
- make sure your personal github account is selected as the owner
- give the repository a name. anything your heart desires
- click create repository
- you now have your own personal romi project
setting up on your computer
- you should now be on the page for your own romi repository. copy the url of this page
- open intellij
- open the file menu in the top left
- under the new dropdown, select Project from Version Control
- paste in the url of your repository
- choose where you want your project to be on your computer
- click clone
- in the new window, wait for the project to finish loading. the loading bar is in the bottom right
- test that your project is set up correctly by clicking the dropdown in the top right next to the green play button and selecting Build & Run Romi via Simulate Java
- click the green play button
- a new purple and black window should open up. if it doesn't or you see an error message, put a message in the #controls channel to ask for help