Build a 2D workspace, write a motion planner in pseudocode (with your own Python functions if you like), and watch it search step by step. It comes with RRT, RRT reward-penalty, RRT-Connect, RRT*, Informed RRT*, Lazy RRT, PRM, PRM*, Lazy PRM, BIT*, ABIT* and AIT*.
- VS Code 1.85 or newer.
- Python 3, to build the extension and to run your own Python functions. Any interpreter works, including a virtual environment. Packages your functions import (numpy, matplotlib, …) must be installed in it.
- Optional: Microsoft's Python extension for VS Code, to pick the interpreter with Python: Select Interpreter.
- In a terminal, in the PlanLab folder, build the extension:
This writes
python3 tools/build_vsix.pydist/planlab.vsix. No Node.js or npm is needed. - In VS Code: Extensions view → ⋯ → Install from VSIX… → choose
dist/planlab.vsix. Or in a terminal:code --install-extension dist/planlab.vsix. - Click the PlanLab icon in the activity bar, then Open PlanLab. PlanLab opens in an editor tab.
Use File → Open Folder… on the PlanLab folder, or on the folder that contains it (like ~/Downloads). PlanLab
then runs from that folder:
- The Python tab is saved as the file
python/functions.py, which you can also edit in VS Code. - Saved changes to PlanLab's files load by themselves.
Without the folder open, PlanLab runs the copy installed with the extension. To always use a particular folder,
set planlab.appFolder in VS Code's settings.
PlanLab uses the interpreter selected in VS Code (Python: Select Interpreter). To use a different one only for
PlanLab, set planlab.pythonPath. Check Python in the Python tab shows which one runs your functions.
After changing PlanLab's files, press Reload PlanLab in the PlanLab sidebar (it also restarts Python). Build and
install the .vsix again only when vscode/extension.js or package.json have changed.
Open index.html in a web browser, or run python3 tools/build.py to make dist/planlab.html, PlanLab in a single
file you can share. Everything works except Python functions, and your work is saved in that browser only.
PlanLab has four windows. Drag the dividers between them to resize them, and double-click a divider to reset it.
| Window | What it's for |
|---|---|
| 1 Workspace | The 100 × 100 world the planner searches. Trees, roadmaps and paths are drawn here as the run goes. |
| 2 Objects | The start, goals, goal samples, obstacles and ready-made layouts. |
| 3 Pseudocode | Tabs Algorithm, Functions, Python and Reference. |
| 4 Run | Run and step, speed, seed, the checks before a run, numbers, Variables and Output. |
At the top right, the status shows what the planner is doing (Ready, Running, Path found, …). The switch next to it gives PlanLab light or dark colours. Until you use it, PlanLab follows VS Code's theme (or the system's in a browser); it never changes VS Code's own colours.
- Add objects: drag q_start, q_goal, a Goal region or an obstacle from Objects into the Workspace.
- Change them: drag an object to move it, drag a corner to resize it, and drag the round handle to rotate it. Arrow keys nudge the selected object.
- Remove them: press Delete, drag the object off the Workspace, or click Remove in Objects.
- Selected object: Objects shows its size, its Weight (for a goal), and buttons to rotate it by 15° (for an obstacle).
- Layouts: the menu loads a ready-made workspace (four blocks, narrow passage, bug trap, zig-zag, three goal regions, two weighted goals). Clear obstacles and Clear all start over.
- Goal samples: each goal region gives the planner a few collision-free points to aim for, shown as dots. Set how
many with Per region. Random or Consecutive sets how
sample_goal()picks one.
-
Pick an algorithm in the menu of the Algorithm tab.
-
Run planner runs it. The button then becomes Pause, Resume or Run again.
-
Step line runs one line of pseudocode. On the Functions tab, it goes into your functions line by line.
-
Next expansion runs until a tree or roadmap gains an edge. Reset clears the run.
-
Speed sets how many lines of pseudocode run per second.
-
Checks: a run only starts once these hold:
q_startand at least one goal are placed;q_startand everyq_goalare outside obstacles, and obstacles don't cover all of the goal regions;- the pseudocode has no errors.
If something is missing, a note in the Workspace says what.
-
Seed: all of a run's random numbers come from it, so the same seed, workspace and code give the same run. New picks another seed.
- Randomise each run gives every run a new seed.
- Run repeatedly runs again and again and keeps a tally of the results.
-
Numbers: lines run, vertices, edges added and path length. Variables shows the algorithm's variables; Output shows messages and
printoutput.
-
Edit the algorithm in the Algorithm tab. Your edits are kept, and Restore original brings back the built-in version.
-
Your own algorithms: + New starts an empty one and Save a copy copies the current one. Your own algorithms can also be renamed and deleted.
-
The workspace in pseudocode:
q_start,q_goal,goal_region,goals,goal_weightsandgoal_samples. Return a path (a list of points) to have it drawn, orfailure. -
The language: the Reference tab lists the syntax and every built-in function.
<-and:=work in place of←. A complete example, a basic RRT:T ← new_tree(q_start) for k ← 1 to 2000 do q_rand ← sample_free() q_near ← nearest(T, q_rand) q_new ← steer(q_near, q_rand, 4) if collision_free(q_near, q_new) then add_vertex(T, q_new) add_edge(T, q_near, q_new) if in_goal(q_new, 3) then return path(T, q_new) end if end if end for return failureor if you want to see a gridmap in matplotlib of the environment created in your workspace:
grid ← [] for j ← 0 to 99 do row ← [] for i ← 0 to 99 do append(row, is_free(point(i + 0.5, j + 0.5))) end for append(grid, row) end for free ← show_grid(grid) return failure -
Your functions: + New function in the Functions tab adds a pseudocode function that every algorithm can call. Edit a built-in… copies a built-in's pseudocode into the Functions tab (or wraps it), and your version then replaces it.
builtin.name(…)still calls the original. Jump to: finds your functions. -
Errors show under the editors with their tab and line. Show jumps to the line.
Write def functions in the Python tab (or + New Python function) and call them from pseudocode like any other
function: c ← path_cost(P). Open functions.py opens the tab's file in VS Code. Your other modules in python/
can be imported.
- Points arrive as
Pointobjects (p.x,p.y,+ - * /). Give back aPointor an(x, y)tuple. - Lists arrive as lists.
- Trees, graphs, sets, maps and queues arrive as handles you can give back but not look into.
- A point that comes back unchanged is the same point (a tree vertex stays a vertex).
- Ready to use:
dist,norm,steer,Point,infandfailure.print()writes to the Output tab, andimport randomfollows the run's seed. - Names: a Python function with a built-in's name replaces it. A name can't be both a pseudocode and a Python function.
- Calls: a call runs in one go (Step line steps over it). An error shows at the calling line, with the Python line. A call that takes over 10 seconds is stopped and Python restarts.
- Goal samples: planners aim at the goal samples. BIT*, ABIT* and AIT* aim at all of them and add more each
batch, and RRT reward-penalty picks them by weight. In pseudocode they are
goal_samplesandGOAL_CHOICE. - Informed sampling: once a planner has a path of cost c, only points x with dist(q_start, x) + dist(x, goal) < c
can improve it. That region is a prolate hyperspheroid (an ellipse in 2D) per goal, and the Workspace shades it.
sample_phs,informed_phs,sample_informedandinformed_measurefollow Gammell et al. (2014, 2018). BIT*, ABIT* and AIT* also prune outside it and take their connection radius from its area. - RRT reward-penalty is Algorithm 1 of Hernández, Moll & Kavraki (ICRA 2019).
- Goal samples are kept in a binary max heap of weights.
- A successful expansion rewards a sample (w ← w / (1 − w), at most 1), and a blocked one penalises it (w ← w / (w + 1)).
- A weight of
W_MINor less triggers resampling. STRATEGY"consecutive"or"random"gives the paper's baselines.- Its functions are built-ins you can copy with Edit a built-in….
- In VS Code: in
planlab-work.jsonin the extension's storage folder. The Python tab is also saved aspython/functions.pywhen PlanLab runs from your folder. - In a browser: in that browser's storage.
- View → Output → PlanLab shows which PlanLab files and which Python are running, and anything Python wrote to its error output.
- PlanLab: Restart Python (or the button in the PlanLab sidebar) restarts Python.
- PlanLab: Reload loads PlanLab again with your latest saved files.
TO change PlanLab itself: see tools/DEVELOPING.md.
