LemLib Auton VisualizerA VS Code sidebar that draws your team's LemLib autonomous routines on the VEX field, in the style of path.jerry.io. It reads the routines straight from your What you get:
Contents
1. What you need
2. Install itPick one of these. Option A is best for a team. Option A: install from a
|
| Setting | Default | How to measure it |
|---|---|---|
maxVelocity |
70 in/s | Drive straight at full power across 4 tiles (96 in) and time it. Use 96 ÷ seconds, measured after the robot reaches full speed. |
acceleration |
150 in/s² | Roughly max speed ÷ the time it takes to reach full speed. 150 means about half a second. |
maxAngularVelocity |
400 °/s | Spin in place at full power for 3 turns (1080°) and time it. Use 1080 ÷ seconds. |
angularAcceleration |
2000 °/s² | Leave it unless turns look clearly too quick or too slow. |
trackWidth |
12 in | Distance between the left and right wheels, measured centre to centre. Used for swing turns. |
robotWidth / robotLength |
15 in | The robot's size, so the outline on the field is right. |
defaultLead |
0.6 | LemLib's default boomerang lead. Only change it if your code changes it globally. |
field |
auto | auto, match or skills, the same as the menu on the field. |
fieldImage |
(empty) | Leave empty for the built-in fields, none for plain tiles, or the path to your own picture. A custom picture must be cropped to the field walls, with +Y pointing up. |
codeLens |
on | Shows the "▶ Show in Auton Visualizer" link above routines. |
Share the settings with the team: create .vscode/settings.json in your PROS project and commit it. Everyone then gets the same numbers:
{
"autonVisualizer.maxVelocity": 62,
"autonVisualizer.maxAngularVelocity": 330,
"autonVisualizer.trackWidth": 11.5,
"autonVisualizer.robotWidth": 14.5,
"autonVisualizer.robotLength": 16
}
5. Using it
Reading the field
The Key under the field explains every symbol. Click "Key" to fold it away.
- Numbered dots are the points, in order:
- blue dots are places the robot drives to;
- purple dots are turns in place;
- S is where the robot starts.
- The short line on each dot shows which way the robot faces there.
- The line between points is the path. Its colour is the speed, from blue (slow) to yellow (fast). A dashed line means the robot drives backwards.
- Hover over a point to see where it is, which way the robot faces, its top speed and when it gets there. Hover over a path to see the speed at that spot.
- Under the field you'll find the number of points and roughly how long the routine takes. The time turns yellow if it's over 15 s.
Finding things in the code
- Click a point or a path and the matching line in the editor is highlighted. If points overlap, click again to cycle through them.
- Click on a motion in the code (for example a
moveToPoseline) and it works the other way round:- that line is highlighted in the editor;
- the point flashes on the field, and the view pans to it if you're zoomed in;
- its popup opens, showing where it is, which way the robot faces, its top speed and when it arrives.
- Clicking anywhere else inside a routine selects the matching point quietly, and moving into another function switches to that routine.
Dragging points (edits your code)
- Drag a numbered dot (
moveToPose,moveToPoint) or the S (setPose) to move it. It snaps to 0.5 in; hold Shift while dragging for whole inches. - Drag the small knob at the end of a direction line to rotate it (
moveToPose,turnToHeading,swingToHeading,setPose). It snaps to 1°; hold Shift for 15° steps. - The path updates live while you drag. When you let go, the numbers in your code are rewritten.
- Ctrl+Z in the editor undoes the whole drag.
- The file is changed but not saved. Press Ctrl+S when you're happy with it.
- Only plain numbers are rewritten. If a value is calculated, such as
-TILE * 2or a variable, the drag is refused so you don't lose it. Hold Ctrl while dragging to replace it with a number anyway.
Zoom and playback
- Zoom: scroll on the field, or use the − / + buttons.
- ⊡ Fit zooms to the current routine, and ⛶ Field shows the whole field again.
- Drag empty space to pan, and double-click empty space to reset.
- Playback: press ▶ or drag the slider to watch the robot drive the routine. The menu next to it sets the speed.
Keyboard shortcuts
Click the field once first.
| Key | Does |
|---|---|
| Space | Play / pause |
| ↑ / ↓ (or k / j) | Previous / next point |
| + / − | Zoom in / out |
| 0 | Show the whole field |
| Esc | Clear the selection |
| Shift + click | Copy that spot's x, y to the clipboard (handy for planning new points) |
6. Coordinates
The extension uses the same conventions as LemLib and path.jerry.io:
- Positions are in inches, with (0, 0) at the centre of the field. The field runs from −72 to 72 on both axes, with +Y pointing up on the plot.
- θ is in degrees: 0° points up (+Y), 90° points right (+X), and it increases clockwise.
7. What it understands
- Numbers, arithmetic,
#defineandconst/constexprconstants, localdouble x = …;variables,M_PI,sin,cosand similar. - Options in braces:
{.forwards = false, .maxSpeed = 80, .minSpeed = 10, .earlyExitRange = 1, .lead = 0.3, .direction = AngularDirection::CW_CLOCKWISE}. waitUntilDone(),waitUntil(distance),pros::delay(ms),cancelMotion(), and a trailingfalsethat makes a motion wait until it finishes.- A comment on the line directly above a motion becomes its label, for example
// grab the goal.
Not simulated:
if/for/while: everything inside is drawn once, in order.chassis.follow(...)pure-pursuit paths.- Your own helper functions called from a routine.
The motion model is simple physics, so times are estimates. Each motion is drawn starting from where the previous one was told to end, the same as path.jerry.io.
8. Troubleshooting
| Problem | Fix |
|---|---|
| No Auton Visualizer icon in the Activity Bar | Check that it's installed and enabled in the Extensions view, then run Developer: Reload Window (Ctrl+Shift+P). |
| "…has no LemLib routines" | Open the file that contains your autons. A routine must call chassis.moveToPose, moveToPoint, turnToHeading … or setPose directly inside the function. |
| The plot doesn't change when I edit | It updates a quarter of a second after you stop typing. If it still doesn't, click ⟳ Refresh at the top of the view. |
| A point won't drag | Its value is calculated, such as TILE * 2. Hover it for the reason. Hold Ctrl while dragging to overwrite it with a number, or edit it in the code. |
| Speeds or times look wrong | Tune the speeds in section 4. |
| A red point, or a point in the wrong place | That value uses something the extension can't see, such as a function call or a variable from another file. Use a number or a const in the same file. |
npm / node is not recognised |
Install Node.js LTS from nodejs.org, then close and reopen VS Code. |
| The wrong field picture | Use the menu in the top-left corner of the field: Auto, Match or Skills. |
9. For developers
There is no build step: it's plain JavaScript with no dependencies.
extension.js: the VS Code side. It runs the sidebar and editor tab, tracks the C++ file, highlights code, applies drag edits and provides the CodeLens links.src/parser.js: a small C++ scanner that finds functions, statements, calls (with argument positions), comments and constants.src/simulator.js: the LemLib motion models and the timeline.media/main.js,media/main.css: the field drawing, dragging, zoom and popups.media/field.png,media/field-skills.png: the built-in match and skills fields. Each is 500 px with the walls included; the playing field runs from px 9 to 491.test/smoke.js:npm testprints what the parser and simulator see inexamples/auton.cpp, or in any file you pass:node test/smoke.js path/to/auton.cpp.