Setting Up JAR Template
Installation
- If you haven't already, download Vexcode Pro V5 or the VEX VS Code Extension and follow the Install Wizard's instructions to install.
- Download JAR-Template by visiting the latest releases page and clicking the "JAR-Template.zip" file.
- Import the "JAR-Template.zip" file in either VS Code or Vexcode Pro V5.
- VexCode will prompt you to choose a name for your new JAR-Template project. The actual name is unimportant, just enter something memorable and click "Import".
Motor Setup
VS Code Extension
- Go to
\include\robot-config.h
and add all of your motors using the formatextern motor LeftFront;
without quotation marks, for each motor. The above line declares a motor named LeftFront. - Go to
\src\robot-config.cpp
and add all of your motors using the formatmotor LeftFront = motor(PORT1, ratio6_1, false);
. The above line defines a motor called LeftFront plugged into PORT1, with a 600 RPM cartridge, not reversed.
Vexcode Pro V5
- Click the port icon in the top right corner of the app.
- For each motor, choose "Add a Device" and choose a name, port, cartridge, and direction for your motor. Unlike in VS Code, this configurer will update
robot-config.cpp
androbot-config.h
automatically.
Chassis Setup
- Go to
\src\main.cpp
and follow the directions, starting at the top of the file, to set up your chassis. Importantly, do not add motor groups, ports, or sensors that are not in the file already.
User Control Programming
In
\src\main.cpp
, scroll down to thevoid usercontrol()
function and write your driver control code. JAR Template takes care of your chassis control, with a choice of tank, arcade, and holononmic drive, but you'll need to code any other motors, mechanisms, and sensors yourself.Test that your motors are set up and reversed properly by downloading and running the project and driving it around.
As a final check, run one or more of the example autons and check that they behave as expected.