Installation
Download PROS​
PROS is an open-source project developed by students at Purdue that gives us functions to interact with our V5 brain and other devices that connect to it. Â If you don't have it installed, you can read their Getting Started page here.
Download EZ-Template​
Download the latest EZ-Template-Example-Project.zip
by clicking here and extract the zip file. Â Click here if you're unsure how to extract a zip file. Â
Open EZ-Template-Example-Project​
Add the folder to your workspace. Â You can do this by going to the very top of your screen and selecting File
-> Add Folder to Workspace
. Â This will bring up a window and you'll have to navigate to where you extracted the example project. Â If you're unsure where you extracted it, it's most likely in your Downloads
folder. Â
Open main.cpp
​
You'll find main.cpp
by selecting EZ-Template-Example-Project
and opening src
. Â main.cpp
is your main file where you can modify your user control code, the root of your autonomous routines, etc.
Configure the Drive Constructor​
Near the top of main.cpp
you'll see some code that looks like this. Â This is your drive constructor, and it gives EZ-Template your chassis motor ports, the IMU port, the size of your wheels, and the rpm your wheels go at. Â All of this information is needed so EZ-Template can make sure your robot is going the correct distances. Â Configure these numbers to your robot. Â
To figure out which motors are reversed and not reversed, open the devices menu on your brain. This is on your home screen. Select any motor and hold down the right button. Keep note if that motor is going forward or backwards, and if it's the left or right side. Repeat this for all of your drivetrain motors.
Input all of your left motors into the constructor first. If you have more/less motors, you can add/remove numbers from the curly braces. If any of the motors put the robot backwards, make that port negative. Repeat for the right side.
// Chassis constructor
ez::Drive chassis(
// These are your drive motors, the first motor is used for sensing!
{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)
{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)
7, // IMU Port
4.125, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
343.0); // Wheel RPM = cartridge * (motor gear / wheel gear)
Configure Tracking Wheels​
Are you using tracking wheels? You can configure them here!
Tracking wheels are not required for EZ-Template! Read below for more information.
The examples below show you how to create tracking wheels using ADI Encoders, ADI Encoders plugged into 3-wire Expanders, and Rotation Sensors.
If you have:
- all omni base
- it is recommended to use at minimum a horizontal tracking wheel
- a parallel tracking wheel will help read any wheel slip that happens
- traction wheels
- you can just use a parallel tracking wheel and get good results
But, EZ-Template works without tracking wheels! If you use no tracking wheels, you'll need to be aware of wheel slip and try to avoid it. Odometry and tracking are not magic and you'll need to do as much as possible to help the robot be consistent. If you're able to, just fit a parallel and perpendicular tracking wheel :D you'll be thankful in the long run.
EZ-Template supports any combination of tracking wheels.
2.75
is the wheel diameter, and 4.0
is the distance to the center of the robot. You can use a tape measure to find this value, or you can follow this tutorial. Your parallel tracking wheels will be the left/right trackers, and your perpendicular trackers will be the front/back trackers.
Left/right trackers are tracking wheels that are parallel to your drive wheels, and front/back trackers are tracking wheels that are perpendicular to your drive wheels.
ez::tracking_wheel right_tracker({-'A', -'B'}, 2.75, 4.0); // ADI Encoders
ez::tracking_wheel left_tracker(1, {'C', 'D'}, 2.75, 4.0); // ADI Encoders plugged into a Smart port
ez::tracking_wheel horiz_tracker(1, 2.75, 4.0); // Rotation sensors
You'll now need to tell EZ-Template what tracking wheels to use.
void initialize() {
// Print our branding over your terminal :D
ez::ez_template_print();
pros::delay(500); // Stop the user from doing anything while legacy ports configure
// Are you using tracking wheels? Comment out which ones you're using here!
chassis.odom_tracker_right_set(&right_tracker);
chassis.odom_tracker_left_set(&left_tracker);
chassis.odom_tracker_back_set(&horiz_tracker); // Replace `back` to `front` if your tracker is in the front!
// . . .
}
If you don't have tracking wheels, you don't need to set any drive offsets! You'll be able to use odometry without any offsets.
Build and Upload​
If you see a white dot at the top of your file name, this means your code is not saved! Please save your code with ctrl + s
on Windows or command + s
on Mac. Only your most recent saved code will build!
Go to File
-> Auto Save
to enable automatic saving!
First, take a micro-USB cable and connect it between your computer and the robot. Â You may also connect it to the controller, but only if your controller is already linked to the robot. Â If you're unsure if your controller is paired or not, read this article. Â
At the left of your screen, select this icon.
Select Build and Upload
. Â Building your code makes sure you have no errors and sets everything up to upload your code to the robot. Â Once this is complete, it will upload code to your robot.
Making Sure the IMU is Detected​
Run the program on the brain. Â You should see a loading bar come up on the brain. Â If this bar goes completely red, you have a problem with your IMU. Â You've either used the wrong port in your drive constructor, you have a bad cable, or you have a bad IMU. Â You'll have to debug this to find out which one is bad. Â
Making Sure Drive Ports are Correct​
The default drive mode for EZ-Template is tank drive, where the left stick controls the left side of the drive and the right stick controls the right side of the drive. Â If all of the ports are set up correctly, the robot will drive! Â
If the motors sound like they're running but they get locked up, you have a motor going in the wrong direction. Â I suggest unplugging motors until you find the 1 going the wrong way, find out which port is going the wrong way, and update your drive constructor accordingly. Â
Making Sure Tracking Wheels are Reversed Correctly​
Once you start up your code, go left on the autonomous selector once. This will bring you to a blank page that ships with the example project.
Ensure that your left/right tracking wheels increase positively when pushing the robot forward, and your front/back tracking wheels increase positively when pushing the robot to the right.
If any sensor is reading the wrong way, make the port negative in the constructor.
You're Setup!​
🥳🥳You're all set up!  The next page will show you how to run the built-in example autonomous routines. Â