autoBuilder, a PROS library for writing autonomous routines
A tool we used to write 21 autonomous routines for our High Stakes robot is now a PROS library. A team supplies command templates and one function that reports its robot's state, and the library prints the finished code.

The problem
Writing autonomous routines by hand meant guessing a coordinate, running the robot, seeing where it missed, and editing the number. During the High Stakes season I added a small tool to our code so I could push the robot to a spot with odometry running, pick a command on the controller, and press A to print the LemLib call with the live coordinates filled in. We used it to write 21 autonomous routines that season.
Watch a routine get built
Left and right on the controller step through the command list, and pressing A rumbles the controller and prints the C++ line. Commands that need no coordinates, like the clamp, print as-is, and the output pastes straight into the autonomous function.
chassis.moveToPoint(-24.38, -23.91, 1500, goal, false); clamp.set_value(true); intake.move(127); chassis.moveToPoint(-23.64, -46.52, 1500, regularPoint, false); chassis.turnToHeading(91.83, 500, headingTurn, false); chassis.moveToPoint(11.85, -46.71, 1500, regularPoint, false); clamp.set_value(false); intake.move(0);
Making it modular
The original version was tied to our robot in three places: button handling in main.cpp, hardcoded chassis command functions, and direct pose reads. I moved the button logic into a class in April 2025 and removed the chassis dependency in May 2025 to ship it as a PROS template (version 1.0.0) that only handles controller input, template substitution, and printing.
What a team provides
A team gives it a list of commands (a name and a template string with {key} fields), a snapshot function that returns the values the fields can use, and its controller and screens. Our setup reports x, y, and theta. Another team can add a lift angle or a distance reading to the same function.
// Everything templates can reference as {key}. Add other subsystems here.
autoBuilder::State snapshot() {
auto p = chassis.getPose();
return {{"x", p.x}, {"y", p.y}, {"theta", p.theta}};
}Try it
Drag the robot or move the sliders to change what the snapshot reports, pick a command or edit its template, and press A. The lift key and the Lift To command are not in the repository example. They are here to show a team adding its own value to the snapshot and using it in a template. A field the snapshot has no name for stays as written, as it does in the library.
chassis.moveToPose(-24.38, -23.91, 271.46, 1500, regularPose, false);How it runs
run() checks the controller every 100 ms. Left and right move through the command list, and A takes one snapshot, fills the template, and prints the result to the terminal and the brain screen.
State state = snapshot();
std::string out;
for (size_t i = 0; i < tpl.size();) {
size_t end = tpl[i] == '{' ? tpl.find('}', i) : std::string::npos;
auto it = end == std::string::npos ? state.end() : state.find(tpl.substr(i + 1, end - i - 1));
if (it == state.end()) {
out += tpl[i++];
continue;
}
char buf[32];
snprintf(buf, sizeof buf, "%.2f", it->second);
out += buf;
i = end + 1;
}
return out;
