Skip to content

[tpe] Add DetachableJoint support#832

Open
Xinyu-Sheng wants to merge 6 commits intogazebosim:gz-physics9from
Xinyu-Sheng:tpe-support-gz-physics9
Open

[tpe] Add DetachableJoint support#832
Xinyu-Sheng wants to merge 6 commits intogazebosim:gz-physics9from
Xinyu-Sheng:tpe-support-gz-physics9

Conversation

@Xinyu-Sheng
Copy link

@Xinyu-Sheng Xinyu-Sheng commented Dec 23, 2025

🎉 New feature

Summary

This PR adds DetachableJoint feature support to the TPE (Trivial Physics Engine) plugin, enabling dynamic attachment and detachment of fixed joints between entities.

Fixes

Closes #818

Changes:

TPE Plugin (tpe/plugin/):

Base.hh: Add JointInfo struct and joints map for joint tracking
JointFeatures.hh/cc: Implement AttachFixedJointFeature, DetachJointFeature, SetJointTransformFromParentFeature with stub implementations for required joint interface methods
SimulationFeatures.cc: Add fixed joint constraint enforcement in WorldForwardStep (required for kinematic engines that lack built-in constraint solvers)
KinematicsFeatures.hh: Add FreeGroupFrameSemantics to feature list
plugin.cc: Include JointFeatures in plugin feature list
CMakeLists.txt: Add JointFeatures.cc to source files

Test (test/common_test/):

detachable_joint.cc: Update test to support kinematic engines that don't have gravity simulation

Background:

TPE is a kinematic physics engine without a built-in constraint solver. Unlike dynamic engines (Dartsim, Bullet), TPE requires manual enforcement of fixed joint constraints during each simulation step. This implementation maintains the relative pose between attached entities by recalculating child poses based on parent poses after each WorldForwardStep.

Test it

# Build with tests enabled
colcon build --packages-select gz-physics7 --merge-install --cmake-args -DBUILD_TESTING=ON

# Run detachable joint tests
cd build/gz-physics7
ctest -R "COMMON_TEST_detachable_joint" --output-on-failure## Checklist

Expected: All tests pass for bullet, bullet-featherstone, dartsim, and tpe.
Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Backport Request

Please backport this change to:

  • gz-physics8
  • gz-physics7

Why this should be backported:

  • Does not break API/ABI
  • Enables TPE's attach/detach joint feature in older Gazebo versions, which is useful for pick-and-place tasks in frameworks like Open-RMF
  • Minimal changes, low risk
  • Implementation is compatible with older versions

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

- Implement AttachFixedJointFeature, DetachJointFeature, SetJointTransformFromParentFeature
- Add fixed joint constraint enforcement in simulation step
- Enable TPE in detachable_joint tests"
- Update detachable_joint test to support kinematic engines

Signed-off-by: Xinyu Sheng <sheng.xin.yu@foxmail.com>
@github-actions github-actions bot added the 🪵 jetty Gazebo Jetty label Dec 23, 2025
@Xinyu-Sheng Xinyu-Sheng changed the title [tpe] Add DetachableJoint support for gz-physics9 [tpe] Add DetachableJoint support Dec 23, 2025
@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Dec 23, 2025
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Dec 23, 2025
@Xinyu-Sheng Xinyu-Sheng reopened this Dec 24, 2025
@github-project-automation github-project-automation bot moved this from Done to Inbox in Core development Dec 24, 2025
- Update copyright year from 2020 to 2025 in JointFeatures.cc and JointFeatures.hh
- Add missing #include <cstddef> to Base.hh, JointFeatures.cc, and JointFeatures.hh
- Add missing #include <string> and #include <gz/math/pose3.hh> to JointFeatures.cc

Signed-off-by: Xinyu Sheng <sheng.xin.yu@foxmail.com>
TPE exposes joint features as stubs for DetachableJoint support,
but doesn't support actual joint construction from SDF or joint
dynamics (damping, spring stiffness).

Signed-off-by: Xinyu Sheng <sheng.xin.yu@foxmail.com>
@Xinyu-Sheng Xinyu-Sheng requested a review from ahcorde December 25, 2025 04:05
- Change #include <gz/math/pose3.hh> to #include <gz/math/Pose3.hh> in JointFeatures.cc
- The correct header file is Pose3.hh with capital P, matching the actual filename

Signed-off-by: Xinyu Sheng <sheng.xin.yu@foxmail.com>
Signed-off-by: Xinyu Sheng <sheng.xin.yu@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

DetachableJoint fails with TPE physics engine due to missing AttachFixedJointFeature support

3 participants