Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Examples `07_any_6_axis_arm.py` (an ABB IRB 4600 printing a vase, no kinematics solver) and `08_which_ik.py` (which IK each robot gets).

* `NativePlanner.has_closed_form_ik`: whether IK for the current robot cell is solved in closed form or numerically.
* `examples/web_viewer`: a browser viewer (compas_threejs) to try IK, collision checks, free motions and straight lines on library robots or your own URDF.

### Changed

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ More examples are in [`docs/files/`](docs/files), among them
[`07_any_6_axis_arm.py`](docs/files/07_any_6_axis_arm.py) (an ABB printing a vase) and
[`08_which_ik.py`](docs/files/08_which_ik.py) (which IK five robots get).

To try it interactively, [`examples/web_viewer/`](examples/web_viewer) is a browser viewer:
pick a library robot or load your own URDF, drag a target, and plan around boxes you place.

## Repository layout

| Path | Contents |
Expand All @@ -66,7 +69,8 @@ More examples are in [`docs/files/`](docs/files), among them
| `src/compas_fab_native/` | The compas_fab backend: `NativePlanner` and the robot model translation |
| `tests/` | Python tests of the backend; the Rust tests live in each crate |
| `docs/` | Documentation, examples and diagrams |
| `demo/live_viewer/` | Live browser demo |
| `examples/web_viewer/` | Browser viewer to try every feature on any robot |
| `demo/live_viewer/` | Live browser demo with fixed scenarios |
| `scripts/`, `fixtures/`, `results/` | Benchmark tooling, robot and scene data, and recorded results |

## Development
Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ Each example builds on the previous one and explains what the planner does as it
- [`07_any_6_axis_arm.py`](files/07_any_6_axis_arm.py){: download="07_any_6_axis_arm.py" }: an ABB IRB 4600 printing a spiral vase with no kinematics solver given, in closed form and with numerical IK
- [`08_which_ik.py`](files/08_which_ik.py){: download="08_which_ik.py" }: which IK five robots get (ABB, Stäubli, UR5 with and without a solver, Panda), and how many solutions each finds

To try it interactively, the
[web viewer](https://github.com/compas-dev/compas_fab_native/tree/main/examples/web_viewer)
runs in your browser: pick a library robot or load your own URDF, drag a target, and plan
around boxes you place.

## How it works, in short

The full explanation, with diagrams, is in [How it works](how-it-works.md).
Expand Down
59 changes: 59 additions & 0 deletions examples/web_viewer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Web viewer

A browser viewer for the native planner, built on
[compas_threejs](https://github.com/compas-dev/compas_threejs). Pick a robot, drag a
target, and try IK, collision checks, free motions and straight lines, with box
obstacles you place yourself.

## Run

```bash
pip install compas_fab_native compas_threejs
python examples/web_viewer/viewer.py
```

It opens the viewer in your browser (http://127.0.0.1:9001). Stop it with Ctrl+C.

### Your own robot

```bash
python examples/web_viewer/viewer.py --urdf robot.urdf --srdf robot.srdf --meshes path/to/packages
```

- `--meshes` is the folder the URDF's mesh paths point into (what `package://` resolves
to). Without it the robot has no geometry: nothing to see, nothing to collide.
- `--srdf` is optional. Without it, the planning group is the chain from the root to the
last movable joint. Pass one when that guess is wrong, for example when the last
movable joint is a gripper finger.
- `--solver` names a compas_fab closed-form solver, for UR arms only (e.g.
`--solver UR10eKinematics`). Spherical-wrist arms get a closed form without it; other
robots get numerical IK.

Your robot is listed first in the robot menu; the library robots stay available.

## What to try

| | |
|---|---|
| **Drag the target** | Click the green pointer, then drag it: W moves, E rotates. The robot jumps to the IK solution closest to where it is. The pointer turns red when there is no collision-free solution. |
| **Next IK solution** | Cycles through all solutions for the target (up to 8 for a 6-axis arm). |
| **Free motion to target** | Plans around obstacles and plays the motion. The speed slider scales it. |
| **Straight line to target** | A Cartesian path from where the tool is to the target. |
| **Free rotation about the tool axis** | Targets become a point and an axis: any rotation about the tool axis is fine. More IK solutions, and lines that are impossible otherwise. |
| **Jog a joint** | Click a robot link: its joint gets +10° and −10° buttons. Each step is collision-checked. |
| **Add a box** | Click it to move (W), rotate (E) or scale (R) it. Then plan again. |
| **Obstacle model** | Boxes (bounding boxes) or a distance field of the obstacle meshes. |
| **Check on exact meshes** | Collision checks on the link meshes instead of only the sphere model. |
| **Robot** | UR5, with a tool, carrying a beam (the beam collides too), an ABB with a printing tool, a Stäubli, and a 7-axis Panda. The status line says which IK each one gets. |

Planning errors (no path, no IK solution) appear in the status line above the robot.

## How it works

`viewer.py` subclasses compas_threejs' `App`. Buttons and drags put commands in a
queue; the main loop runs them with a `NativePlanner` and plays the trajectories.

Each robot link is sent to the browser once, as a mesh in link coordinates. After that
only poses travel: `NativeCore.link_frames` gives every link's pose for a configuration,
and the viewer sends each link's change of pose (a small message, not the mesh). Boxes
you add are rigid bodies of the robot cell, like any obstacle in compas_fab.
Loading
Loading