Skip to content

dartsim: Add support for the <kinematic> tag#758

Open
jcmayoral wants to merge 44 commits intogazebosim:mainfrom
jcmayoral:ionic-kinematic-tag
Open

dartsim: Add support for the <kinematic> tag#758
jcmayoral wants to merge 44 commits intogazebosim:mainfrom
jcmayoral:ionic-kinematic-tag

Conversation

@jcmayoral
Copy link
Copy Markdown

@jcmayoral jcmayoral commented Jul 9, 2025

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

🎉 New feature

Bring back the kinematic tag available in gazebo classic.

Summary

Adding the kinematic tag feature for dartsim physics engine. The dart joints used in gz-physics are called FreeJoints, available in dart upsteam repository in this file FreeJoint.cpp . However, as it can be observed, this joint is designed to integrate accelerations over time to calculate speed, and integrate speed to get positions. Therefore, other type of joint is needed to achieve the behavior of the Kinematic tag which ignores Forces.

In this MR for dart, an attempt to integrate this joint to the upstream repository can be found, but it seems the use case is really gazebo-related, also it will require to bump the dart version used on gz-physics. Therefore, those changes are integrated to this one MR, adding the KinematicJoint as a customization of dart (based on the feedback given on the dart MR (KinematicJoint.cc and KinematicJoint.hh).

Test it

In order to test, the MR can be compiled and using the following sdf (attached as a txt file):

kinematic-robot.sdf.txt

Once compiled, rename the file to kinematic-robot.sdf, and run

gz sim -v 4 kinematic-robot.sdf

A comparison between setting the kinematic tag (true/false) can be seen in the next video.

kinematic-tag-demo-2025-07-09_19.08.49.mp4

Checklis

  • 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

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.

@jcmayoral
Copy link
Copy Markdown
Author

Same as #756

A comparison between kinematic and non-kinematic collision with static box

kinematic-tag-demo-2025-07-09_19.08.49.mp4

@jcmayoral jcmayoral force-pushed the ionic-kinematic-tag branch from 311f5f1 to a39f1d0 Compare July 24, 2025 21:08
@azeey azeey added this to the Jetty Release milestone Jul 28, 2025
@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 6, 2025

See #756 (comment)

@azeey azeey removed this from the Jetty Release milestone Aug 6, 2025
@jcmayoral jcmayoral changed the base branch from gz-physics8 to main August 6, 2025 22:15
@jcmayoral jcmayoral changed the title Kinematic Tag for DartSim (Ionic) Kinematic Tag for DartSim (Main) Aug 6, 2025
@jcmayoral jcmayoral mentioned this pull request Aug 6, 2025
26 tasks
@azeey azeey added 🪵 jetty Gazebo Jetty and removed 🏛️ ionic Gazebo Ionic labels Aug 6, 2025
@azeey azeey added this to the Jetty Release milestone Aug 6, 2025
@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 6, 2025

@jcmayoral can you update the PR description?

@azeey azeey moved this from Inbox to In review in Core development Aug 6, 2025
@azeey azeey changed the title Kinematic Tag for DartSim (Main) dartsim: Add support for the <kinematic> tag Aug 6, 2025
@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 7, 2025

cc @iche033

@jcmayoral
Copy link
Copy Markdown
Author

@azeey Is there a feature list of a issue list I can refer to? So I can complete the description?

@jcmayoral
Copy link
Copy Markdown
Author

Checking the test I found that the Bazel CI was failing because of this line:

[3,384 / 3,394] 48 / 57 tests, 1 failed; Compiling dartsim/src/KinematicsFeatures.hh; 7s processwrapper-sandbox ... (4 actions running)

But I did not modify that file. Is it part of the pipeline?

@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 7, 2025

@azeey Is there a feature list of a issue list I can refer to? So I can complete the description?

If there's no issue, you can skip that, but please add more description on what this PR does, and the approach you are taking. Also remove the parts of the template that are not relevant (i.e, bug fix and release sections). You can look at other PRs in this repo for reference.

@jcmayoral
Copy link
Copy Markdown
Author

@azeey I just updated it. Please, let me know if something is missing.

@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 20, 2025

@jcmayoral After looking at the discussion in the upstream DART PR, I tested out what setting the joint actuator type to ACCELERATION would do and I think it does make the link "kinematic". For the quickest test, I added

  joint->setActuatorType(dart::dynamics::Joint::ACCELERATION);

to

joint->setTransform(tf);

right after joint->setTransform(tf); , which makes sets the actuator type of all free joints to ACCELERATION. With this, I ran the velocity_control.sdf Gazebo example. The vehicles respond to velocity commands, but are not affected by gravity or contacts.

Screen.Recording.2025-08-20.at.00.58.24.mp4

Can you give it a try? Maybe all we need need to do is detect if a link is kinematic and set the actuator type of it's parent joint to ACCELERATION.

cc @iche033

@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 22, 2025

This would be a great addition to Gazebo, but it's a large change and we're not sure about the approach taken. With
Code freeze being Monday, 08-25-2025 (see https://discourse.openrobotics.org/t/feature-freeze-for-gazebo-jetty/48187/3?u=azeey), I don't think we'll have enough time to discuss, make changes and merge this PR. Therefore, I'll remove the "Jetty Release" milestone. This means, we can't merge this until Jetty is released, however, please continue making progress on the PR and we'll try to respond as much as we can.

@azeey azeey removed this from the Jetty Release milestone Aug 22, 2025
@moriarty
Copy link
Copy Markdown

@azeey it's unfortunate that this will miss the code freeze.

We originally needed the kinematic tag and had been commenting and working on top of this MR: #618 from @iche033 which adds kinematic tag for bullet but as we moved further along with our migration we realized we had behaviors which require us to use Dartsim.

What are the possibilities or options to have something like this back-ported to jetty?

@azeey
Copy link
Copy Markdown
Contributor

azeey commented Aug 22, 2025

What are the possibilities or options to have something like this back-ported to jetty?

It's should be possible to backport since the changes shouldn't break API/ABI. We might even be able to backport it to Ionic/Harmonic.

@moriarty
Copy link
Copy Markdown

Great, Thanks. We've been testing Harmonic / Ionic via source builds but if this had made it into Jetty it would have clearly given us a reason to target Jetty ASAP...

Need to get over the migration we still have performance related issues where Gazebo Classic out performs Gazebo in most cases unless you have GPUs, but this <kinematic> tag support is a key blocker and is required to work around a bunch of other things.

jcmayoral and others added 20 commits March 4, 2026 08:52
Signed-off-by: Jose Mayoral <jocamaba1989@gmail.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jocamaba1989@gmail.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jocamaba1989@gmail.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jocamaba1989@gmail.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
Signed-off-by: Jose Mayoral <jcmbanos@ottomotors.com>
@jcmayoral jcmayoral force-pushed the ionic-kinematic-tag branch from 96a8c91 to fd18910 Compare March 4, 2026 14:53
Copy link
Copy Markdown
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you also be able to implement the KinematicLink feature which was added in #618. Not a blocker, but it would be great to have feature symmetry and be able to change the property at runtime.

Comment on lines +718 to +723
bodyProperties.mInertia.setMass(sdfInertia.MassMatrix().Mass());
bodyProperties.mGravityMode = _sdfLink.EnableGravity();
bodyProperties.mInertia.setMoment(I_link);

bodyProperties.mInertia.setLocalCOM(localCom);
bodyProperties.mFrictionCoeff = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are any of these lines necessary? These properties are already being set above or elsewhere.

bodyProperties.mInertia.setLocalCOM(localCom);
bodyProperties.mFrictionCoeff = 0;

if(isKinematic){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Style

Suggested change
if(isKinematic){
if(isKinematic)
{


if(isKinematic){
gzdbg << "Kinematic tag found -> " << bodyProperties.mName << std::endl;
jointProperties.mName = bodyProperties.mName + "_KinematicJoint";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for changing the name of the joint?

gz::math::eigen3::convert(frameData.linearVelocity));
EXPECT_EQ(gz::math::Vector3d::Zero,
gz::math::eigen3::convert(frameData.angularVelocity));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also check that setting the velocity of the link works?

Comment on lines +697 to +699
// currently only dartsim is supported
if (this->PhysicsEngineName(name) != "dartsim")
continue;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bullet-featherstone also supports kinematic links (see #618).

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

Labels

🪵 jetty Gazebo Jetty

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants