Skip to content

feat: Integrate Rotational CCD using compas-forge for motion planning#467

Open
moaminmo90 wants to merge 3 commits into
compas-dev:mainfrom
moaminmo90:feat/rotational-ccd
Open

feat: Integrate Rotational CCD using compas-forge for motion planning#467
moaminmo90 wants to merge 3 commits into
compas-dev:mainfrom
moaminmo90:feat/rotational-ccd

Conversation

@moaminmo90

Copy link
Copy Markdown

Summary

This Pull Request addresses the TODO regarding sweep_collision_fn inside motion planning loops (specifically in pybullet_plan_motion.py and pybullet_plan_cartesian_motion.py). By integrating the Rust-backed compas-forge engine, we introduce Rotational Continuous Collision Detection (CCD) with temporal sub-stepping. This approach aims to mitigate the "tunneling effect" during continuous rotary joint movements while maintaining computational efficiency.

Technical Implementation & Optimizations

To optimize performance inside the planning loops, the implementation avoids repeated mesh reconstruction by utilizing a caching mechanism:

  1. Mesh Registration (pybullet_set_robot_cell.py): Collision meshes for robot links, attached tools, and stationary rigid obstacles are registered once inside compas-forge's thread-safe memory registry during set_robot_cell.
  2. Pose Tracking (pybullet_set_robot_cell_state.py): Global frames of tools and rigid bodies are updated during cell state transitions and cached in client._forge_object_poses.
  3. Collision Evaluation (pybullet_plan_cartesian_motion.py): Within the Cartesian path planning loop, the planner queries compas_forge.check_swept_collision_cached using string IDs and calculated start/end poses.

Preliminary Benchmarks

Initial evaluations were conducted on a standard UR5 robot cell setup with a stationary obstacle:

  • A single swept-collision query (including SLERP/LERP pose interpolation, 10 piecewise-linear sub-steps, and GJK/EPA continuous solver) executes in approximately 0.2 ms on a Windows AMD64 environment.
  • This efficiency allows continuous collision validation within the planning loop with low computational overhead to the DFS solver.

Backward Compatibility & Fallback

If compas-forge is not installed in the local environment, the planner gracefully falls back to the default discrete collision checking, ensuring no breaking changes to existing COMPAS core APIs.

We welcome your feedback and review on this integration for compas_fab!

@gonzalocasas

Copy link
Copy Markdown
Member

@moaminmo90 awesome! Could you please also add compas-forge in an optional requirements file, and update the workflows so that it is installed, and then this can also be integration-tested?

@moaminmo90

moaminmo90 commented Jul 12, 2026

Copy link
Copy Markdown
Author

Hi @gonzalocasas,

Thanks for the feedback! I've bumped compas-forge to v0.2.0 on PyPI, added it to requirements-dev.txt, and updated integration.yml to install it.

The CI/CD should now automatically run the tests with it. Let me know if everything passes on your end!

@moaminmo90

Copy link
Copy Markdown
Author

Hi @gonzalocasas,

We are all set! I have successfully published compas-forge 0.3.0 to PyPI.

To solve the stable ABI limitation with the PyBuffer protocol on Python < 3.11, I removed the abi3 feature entirely and updated the release workflows to build and publish separate dedicated wheels for Python 3.9 through 3.13.

I've also updated this PR's requirements and the integration workflow to use compas-forge>=0.3.0. The CI/CD tests should pass cleanly now. Let me know if everything looks good on your end!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants