🟑PROS

"DON'T BE AFRAID TO USE THE DOCUMENTATION" - https://pros.cs.purdue.edu/v5/index.html

PROS (Purdue Robotics Operating System) is an open-source alternative to VEXCode created by Purdue students and supported by VEX. While it may be more difficult to use in some ways, it also has more freedom and supports a wider variety of community software like templates and utilities.

First, download Visual Studio Code and install it. Open it up, go to extensions, and download the PROS extension and C/C++ extension.

Before we proceed, the following extensions are recommended but not required, so you can choose to download them or not:

  • C/C++ Themes

  • Clang-Format

  • clangd

  • Doxygen Documentation Generator

  • file-icons

Starting a New Project

Go ahead and open up VScode, go to the PROS extension and hit "Create Project," which should look like this:

Then enter a project name, choose the V5 option and select the latest version

Both PROS 3.8 and PROS 4 are widely used, but the PROS 4 documentation and community support is now at a point where I would go ahead recommend using it.

When the new project opens up, you will see a couple folders:

Quick Breakdown

πŸ“ .d - don't touch, don't worry

πŸ“ .vscode - pretty much just cofiguring vscode, shouldn't worry about it for the most part

πŸ“ bin - compile stuff done by PROS, don't touch, don't worry

πŸ“ firmware - don't touch, don't worry

πŸ“ include - this is where you will put the header files (.h and .hpp) for libraries you use and for your code

πŸ“ src - where you will work 95% of the time, for c and c++ files

πŸ—„οΈ .gitignore - used for telling GitHub what not to upload

πŸ—„οΈ common.mk - don't touch, don't worry

πŸ—„οΈ compile_commands - 99.999% of the time don't touch, don't worry

πŸ—„οΈ Makefile - useful if you want to make a library, don't touch, don't worry otherwise

πŸ—„οΈ project.pros - where to change the project name, description, slot on brain, and icon

After creating the new project, open up main.cpp and delete everything except the signatures for initialize, disabled, competition_initialize, autonomous and opcontrol and their associated comments.

Breaking Up Your Main.cpp File

While not required, I would recommend keeping as much code in your main.cpp file as possible to make your life easy. To keep everything organized, you can break your file up into 4 sections using comment blocks:

  • Device Setup

  • Custom Functions

  • Autonomous Programs

  • Vex Functions

At this point, your code should look something like this:

Device Setup

In V5RC, you will use a number of different devices, such as motors, sensors, and pneumatics. I will go through the basics, but as always, use the documentation, which is linked for each device.

Custom Functions

This is where you will write utility functions that you will use throughout the rest of your code, such as a function to move the robot a certain distance or active an arm. This is also a great place to put PIDs and other control loops (see the Coding PIDs section). Some people also put their driver control function at the bottom of this section.

Autonomous Routes

This is where you will store the pathing and commands for each autonomous route you have. Each route can be stored in a void function and run during the autonomous period.

VEX Functions

This is where you will keep the VEX functions that are essential to make the program and robot work. The comments above each "mode" the robot jumps through explain them well, but below is a diagram that shows the flow of "modes."

You can also simulate being connected to a competition switch using the competition mode on the VEX controllers.

Initialize

Under the initialize method, we need to do things like initialize the brain screen, turn on sensors and set up tasks (see the Tasks section). Basically these are the things that will happen every time the robot turns on regardless of the circumstances.

Autonomous

This is where the autonomous routes will be called. Individual routes can be called using multiple versions of the program (easy) or creating an auton selector (a little harder but recommended).

Opcontrol

The opcontrol method is what is called during the 1:30 driver period. First, we need to initialize variables that we will use later.

We also need to set the drive motors' breaking modes. You can either choose to have them on coast (recommended) or brake.

Now, create an infinite loop. This is where we will put the rest of the drive code and it will loop continuously until driver control ends.

The infinite loop will have two main sections:

1) Button Checks

Each button can be assigned a function using the following format:

You can either have a button activate once per press (get_digital_new_press) or continually while its pressed (get_digital).

2) Drive Control

The example below is the most basic form of double arcade, feeds the joystick values into the left and right after being modified by the moveSpeed and turnSpeed variables created earlier.

Finally, at the end of the infinite loop, you MUST MUST MUST add a delay(20) to make sure the brain can keep braining.

[Coming soon: Tasking, PIDs, outside libraries]

Last updated

Was this helpful?