This assignment will get a programming environment installed on your computer. That is the environment that we'll write code in to run and drive our robot. At the end of the assigment, hopefully you'll have the environment installed and ready to work, and have executed a Java program.
Install the WPILib application. This will install VSCode and WPILib libraries for Java and C++ development. Follow instructions in zero-to-robot/step-2.
Some things to note:
- You do want to install VS Code, so use "Download for this computer only"
- You do not need "Additional C++ Installation"
- If you have previously installed a 2021 version you may want to remove that.
Once you have installed, then launch VS Code ("FRC VS Code 2022").e
The goal of this step is simply to write and run a program that says "Hello world" using VS Code. There is some useful doc at VS Code Overview.
The basic path is:
- Launch VS Code (the first thing you launch VS code you will likely have to walk through a "Getting Started" wizard).
- Hit 'ctrl shift p', to bring up the menu bar. Type 'create java project' and select the entry.
- Give VS code a path for your projects. This can really be anywhere.
- Name your project (
HelloWorld
would be good).
Now you're ready to start.
- Navigate in the file explorer pane (left side) to
src
->App.java
. - Run the program through the menu 'Run -> Run without Debugging'. That should open a
TERMINAL
window below your code which will say 'Hello World'.
Now lets make a change, instead of 'World', lets say hello to the other robots.
-
In App.java change the line:
System.out.println("Hello, World!")
to a good robot greeting like:
System.out.println("Hello Robots!")
The point of this excercise is to create a Romi roject so that we can execute the code on our team Romi.
Create a new project (ctrl shift p
). Select Project type as 'Example', and select 'Java' for the language. .Select 'RomiReference' as the project base. You do not need to select Enable desktop support
.
This will create the project and if you have a romi you could then run that code with Run
.
We have run the autonomus code before on the Romi. It basically runs around in a circle a bit. The goal of this step is to modify the code in some way so that you can see the difference and run your modified code.
Before reading further, see if you can poke around in the project for where the autonomus code lives.
OK, if you didn't cheat, did you find src/main/commands/AutonomousTime.java
and AutonomousDistance.java
?
These are the files you will want to change in order to change what autonomous routine the Romi runs. Can you make sense of what is going to happen in AutonomousTime
?
You can email me (email provided) the src/main/commands/AutonomousTime and src/main/commands/AutonomousDistance.java files, or bring them with you next meeting.
The point of this excercise is just to get the robot template code ready to go. We won't run this code right away, but hopefully soon we'll be able to use it on either last year robot or this years.
Just hit ctrl shift p
again and find Wpilib: Create a new project
.
Select example
, java
. You can select any of the other options for the "project base", but Getting Started
seems like a good place to get started. :-). We are team 7660
.