Skip to content

Instantly share code, notes, and snippets.

@smoser
Last active January 11, 2022 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smoser/49dde9d160d8e4e8ab00c21a0335082a to your computer and use it in GitHub Desktop.
Save smoser/49dde9d160d8e4e8ab00c21a0335082a to your computer and use it in GitHub Desktop.
byting irish homework assignment 1

Byting Irish Programming Assignment 1.

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 WPILib 2022

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

Create a "hello world" java project

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!")
    

Create a new romi project

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.

make a change to romi automated code

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.

Create a new robot project.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment