Skip to content

gramaziokohler/workshop_compas_fab_2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workshop: COMPAS FAB 2.0

COMPAS FAB 2.0 Workshop Banner

Robotic fabrication planning with the COMPAS framework and the compas_fab package: building robot cells, solving kinematics, and planning motions, in Rhino/Grasshopper and standalone Python.

👉 Slides · Written guide

Installation

We will install compas_fab in Rhino and also in a standalone Python environment.

Rhino 8

  1. Open Rhino 8, then open the Package Manager (type PackageManager in the command line), and search for compas_fab, install version 2.0.1.
  2. Restart Rhino.

Standalone

Install uv as pre-requisite (if you don't have it yet):

On Windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

On MacOS / Linux:

curl -Ls https://astral.sh/uv/install.sh | sh

You might need to restart VS Code if it was open during the installation of uv.

Virtual environment

Open VS Code and open a terminal in the folder of this repository.

Create a new virtual environment:

uv venv --python 3.12

Activate it:

On Windows:

.venv\Scripts\activate

On MacOS / Linux:

source .venv/bin/activate

Then, install the package via pip:

uv pip install compas_fab~=2.0

Finally, test the installation by running the 01_hello_world.py script from the examples folder.

Make sure you select the newly created virtual environment in VS Code before running the script. You can do this by clicking on the Python version in the bottom-left corner of VS Code and selecting the interpreter from the .venv folder.

PyBullet (optional)

Example 05_collision_aware_ik.py needs the PyBullet backend, which is an optional dependency:

uv pip install pybullet

On macOS, PyBullet may fail to build unless you pass an extra compiler flag:

CFLAGS="-fno-define-target-os-macros" uv pip install pybullet

Backends

Some examples require a planning backend. compas_fab supports several:

  • Analytical: closed-form inverse kinematics, runs in-process, no setup.
  • PyBullet: in-process collision checking and motion planning.
  • ROS / MoveIt: full motion planning over a ROS bridge. A ready-to-use docker-compose.yml is included to spin up ROS + MoveIt (see the COMPAS FAB docs for details).

The first examples run without any backend; later ones note which backend they need.

Examples

The examples/ folder is a progression: standalone Python scripts first (run them with VS Code), then Grasshopper definitions (open them in Rhino 8). Each example notes which backend it needs.

Standalone Python

# Example What it shows Backend
01 01_hello_world.py Verify the install; print the COMPAS and COMPAS FAB versions. none
02 02_robot_cell.py Load a UR5 robot cell from the library and inspect its model, tools, joints, and default state. none
03 03_forward_kinematics.py Forward kinematics: joint values → flange frame, with the closed-form solver. Analytical
04 04_inverse_kinematics.py Inverse kinematics: a target frame → all closed-form solutions. Analytical
05 05_collision_aware_ik.py Collision-aware IK that avoids a floor obstacle, then verifies the result with FK. PyBullet

Grasshopper

# Example What it shows Backend
00 00_install.ghx Installation check for Rhino/Grasshopper none
06 06_visualize_and_pose.ghx Load a robot cell, set a configuration, and visualize it in Rhino. none
07 07_inverse_kinematics.ghx Solve analytical IK from a frame target and visualize the result. Analytical
08 08_build_robot_cell.ghx Build a cell from scratch: import a tool from a mesh, add a rigid body, attach the tool, then solve IK. Analytical
09 09_plan_motion.ghx Plan a motion to a frame target over ROS/MoveIt and deconstruct the resulting trajectory. ROS / MoveIt
10 10_kitchen_sink.ghx End-to-end definition: FK, IK, Cartesian motion, and action chains with full ROS/MoveIt planning. ROS / MoveIt
11 11_install.ghx Installation of optional Pybullet backend for Rhino/Grasshopper none

A couple of the Grasshopper definitions ship with a preview of the expected result:

06_visualize_and_pose 07_inverse_kinematics
Visualize and pose Inverse kinematics

AI-assisted Grasshopper with LAMCP (optional)

LAMCP ("Lambda MCP") lets an AI coding assistant inspect and edit a live Grasshopper session: read the canvas, wire components, set slider values, run RhinoCommon calls, and hot-reload modules, all from inside the agent loop without rebuilding userobjects or restarting Rhino. It is handy during the workshop for scaffolding Grasshopper definitions with compas_fab robot planning and debugging them conversationally.

It has two halves: an MCP server (runs in your system Python) and a bridge component (runs inside Rhino). They talk over loopback HTTP.

1. Install the Grasshopper bridge

  1. Download Lamcp_Bridge.ghuser from the latest release.
  2. In Grasshopper: File → Special Folders → Components Folder, and move the .ghuser file there.
  3. Restart Grasshopper. The LAMCP Bridge component appears under the LAMCP tab.
  4. Drop it on the canvas and wire a Boolean Toggle set to True into its enable input. The status output should read listening on http://127.0.0.1:8765.

2. Register the MCP server in your editor

You only need one of these, depending on which assistant you use. Both launch the server with uvx, so there is nothing to install first.

Claude Code (VS Code extension) registers MCP servers from the command line. Run this once, at user scope so it is available in every project:

claude mcp add lamcp --scope user -- uvx lamcp

Verify it with claude mcp list. The LAMCP tools then show up in any new Claude Code conversation.

Codex (VS Code extension) reads MCP servers from ~/.codex/config.toml. Add this block (create the file if it does not exist):

[mcp_servers.lamcp]
command = "uvx"
args = ["lamcp"]

Restart the Codex extension so it picks up the new server.

Using a different MCP client? Point it at the uvx lamcp command over stdio.

With both halves running, your assistant has a run_python_script tool that executes code inside your live Rhino session.

Resources

About

Materials for the COMPAS FAB 2.0 workshop

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors