Check out this GitHub repository to see the python script and some more information about how to set up and use it in your own project. I tested this on Ubuntu 18.04 and macOS Catalina 10.15.5.
This python script parses a “constants.h” file with button assignments of the form
const auto INTAKE_BUTTON = okapi::ControllerDigital::R1;
to generate a markdown file of button assignments.
This script is useful particularly when any of the following are true:
- the drivers are not involved in programming the robot
- there are multiple drivers for each robot
- two robots have different button assignments, and it is desired to have a readily available reference for button bindings for each robot (i.e. for VEX U teams)
Setting up your project structure to use the parse_key_bindings script is also pretty straightforward
- Create a directory called
docsin your top level directory, and put the file
controller.pngin this directory.
- Create a file called
constants.hand assign your button mappings inside of it (see
- Add the lines
builddocs: path/to/constants.h, and
python generic_parse_key_bindings.pyto the beginning of your
Makefile, which is in the top level directory of your project folder (see
parse_key_bindings.pywith the requested information
To generate the documentation, type
prosv5 make builddocs at the root directory of your project. If you want the script to be run everytime you compile the project, you can create aliases in your
.bashrc (or equivalently
alias pm='prosv5 make builddocs',
alias pmu='pm && prosv5 upload', and
alias pmut='pmu && prosv5 terminal'.
Example of project that uses this script
See this github repository for an example of all the above used in a PROS project.