Training materials for new robot software members.
If you don't know how to program in Java, or haven't installed WPILib and reviewed its documentation, talk to a manager before getting started with these materials.
⚠️ In these materials, we assume that you have at least some experience programming in Java and know how to competently use a computer. If this is not the case, speak with a manager to plan out your next steps
The first thing that you will want to do is set up your workspace. We don't have a standard development environment, but we do use Git and Github for collaboration and code version control. Git is a tool that allows you to track changes in your code, upload code to the web, and allows us to manage our projects efficiently. Github is an online tool that allows us to store and share code, and collaborate on our projects.
If you already have experience with Git and Github and know what you are doing, proceed to this section. Otherwise, if you don't know how to use Git, proceed to the next section.
First, check if you already have Git installed. Open up your terminal app, and enter the
command git --version
and hit enter. If the terminal outputs something like
git version *version number*
, you already have Git installed and you can move on to
the next section.
If the terminal instead gives you an error when you try to run the command, you do not have Git installed, and should proceed to the proper install page for your operating system, and follow the relevant instructions:
If there are any problems with the installation, feel free to contact a manager or another member of the department.
Now that you have installed Git, you can now set up your workspace for robot
software. First, open your file browser ("File explorer" on Windows, "Finder" on
MacOS) and create a new folder called something like "RobotCode
" in a place that
you'll be able to get to later (your Documents
folder is a great place!). Make
sure that this isn't your Downloads
folder, since you may accidentally
delete all your work when you clean your disk!
Now that you have set up your workspace and Git correctly, you can now get started on robot software!
First, you'll want to navigate to the folder that you created earlier in your file explorer. Right click on the folder and choose the option to "Copy address" on Windows or "Copy *folder name* as Pathname" on MacOS to copy the address of the folder.
Next, open up your terminal and run the command cd *paste the folder address here*
, so that all of your future commands will be run in this folder. Then,
enter the command git clone https://github.com/flamingchickens1540/RobotSoftwareTraining.git
This copies, or "clones " the contents of this repository onto your computer.
When you navigate back to your workspace folder, you should find that there is
now a new folder in it called "RobotSoftwareTraining". This will be the folder
where you will write your code for your first two certifications.
However, you aren't done yet. What you have on your computer right now is the
main
branch of that repository, which only contains these instructions here.
Each branch of a Git repository contains a different version of the code that
allow you to test different features and ideas without affecting the main
version of the code. To get the template code for your certifications, you will
have to change your Git branch to the branch with the relavant template.
To do this, you will first have to type the command cd RobotSoftwareTraining
in order to have all your future commands be run in your project folder. Then,
type git checkout c1Template
to switch to the branch with the template code for
a Robot SW 1 certification.
Of course, you don't want to be working directly on the template code, because
other people will want to still have a blank template! Thus, you will be copying
the template code into a new branch specifically for your code. To do this, run
the command git checkout -b *yourName*C1
, replacing "*yourName*
" with your
name. This command will create a new branch with the given name, and automatically
switch to it. Edits on this branch will not affect any other branches, giving you
your own working environment.
Now that you have properly set up your code template in your personal branch, all that remains is to open it up in WPILib VSCode. First, open up WPILib VSCode (make sure this isn't normal VSCode, since it won't have the proper features necessary for robot software), and click File > Open Folder, and navigate to your project folder and select it. Now, your robot code template should be open in VSCode and you should be ready to start coding.
Now that you've finished all of the setup and configuration, you can start programming robots! To get started in the best department on the team, you can now proceed to the instuctions for getting a Robot SW 1 cert.
- WPILib documentation (very helpful)
- Git tutorial (also very helpful)