Gazebo | Ignition | Community
Ask Your Question

Properly making soft joints to world in Gazebo 9 + ROS Melodic

asked 2021-02-05 16:53:27 -0500

danzimmerman gravatar image

I'm trying to interact a position-controlled robot with "fixed" obstacles in its environment. In this case, they're a couple of floating spheres, "magically" fixed in space. I'm using default ros-melodic-desktop-full installations to do this, in this case Gazebo 9.13.1 on Windows.

With <static> obstacles and default constraint parameters, the robot "explodes" if it touches obstacles. This is reasonable behavior given the incompatible constraints of infinitely rigid object meets immovable object.

If I add some global constraint force mixing with <cfm> tags at world->physics scope, it stabilizes the simulation and makes the robot's contacts with the world understandable, but it also allows the joints to slide apart. This is also correct behavior from the standpoint of what CFM does, but it's not the desired behavior.

What I'd like to do is attach the floating spheres to the world frame using spring-dampers that are much softer than the robot joints, so that they easily slide out of the way if the robot collides without pulling the robot joints apart visibly.

I'm having a very hard time finding a correct and complete description on how to do this, partially because any suggestions are scattered across many years of SDF file format changes, unanswered ROS Answers and Gazebo Answers questions, and so on.

I have successfully held the spheres in place with fixed joints so they move a little with relaxed constraints. After a long time experimenting (because of lack of a complete example) I figured out I could put those joints in a nested <model> so I could write this "boundary condition" in my world file instead of the complex model file that defines the visual/inertial/collision geometry.

Now I'd like to soften the joints that hold the spheres in place. So I'm trying to set different <cfm> and <erp> values for the spheres' fixed joints, or maybe <implicit_spring_damper> or ... what? Everything I've tried has resulted in the spheres' displacements being the same order of magnitude as the robot's displacement.

image description

I still can't find a documentation source that's any more useful than, but that just kind of tells me which tags I might try, not how they fit together.

The image was captured using these settings for the red sphere:

<model name="soft_fixed_big_red">
  <joint name="bc" type="fixed">
  <pose>0.15 0.50 0.45 0 0 0</pose>

The spheres had mass properties like solid plastic when I started. I tried making them thin, extremely light spherical shells, which made it shakier but roughly similar in relative sphere and robot displacements.

At the world level (which contains the red and blue sphere models, ground plane, and sun), I have this:

<physics name ...
edit retag flag offensive close merge delete


<dynamics> tagged joints may be a partial solution, but very verbose to go to 6DOF springiness

  <joint name="bcz" type="prismatic">
      <xyz>0 0 1</xyz>
danzimmerman gravatar imagedanzimmerman ( 2021-02-05 16:20:43 -0500 )edit

I'm chasing the wrong modeling paradigm here and I think I'm probably going to go with virtual cardboard boxes for anything that can sit on the floor until I can get around to building some effort-controlled URx robots that more gracefully handle accidental contact with a rigid world.

However, the original question about using CFM and ERP to do 6DOF soft constraints comes up from time to time, hopefully someone can help there?

danzimmerman gravatar imagedanzimmerman ( 2021-02-05 16:50:14 -0500 )edit

I tried to add two prismatic joints in series with a light link in between and now the red sphere behaves correctly for a little while when in contact with the robot but then implodes to the origin.

danzimmerman gravatar imagedanzimmerman ( 2021-02-09 13:39:39 -0500 )edit

Serial joints now working correctly. Had the damping set too low on the second joint of the red sphere.

Working okay now with x, y, z, slides with critically-damped spring dampers using <implicit_spring_damper> set to 1 as well. Dummy link between joints is just 10 grams with kg-scale spheres, works okay.

danzimmerman gravatar imagedanzimmerman ( 2021-02-09 15:25:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-09 16:37:17 -0500

danzimmerman gravatar image

I solved this for 3DOF compliance on the red sphere with a chain of prismatic joints and links with <implicit_spring_damper> behavior and <dynamics> elements defining <damping>, <spring_stiffness> and <spring_reference> elements.

I used 10 gram links with reasonable symmetric inertia matrix elements and made the spring-dampers critically damped for the moving mass, and it seems pretty okay.

I had some trouble with the sphere snapping to the global origin, but only when I had the damping set way too low by mistake. Not 100% sure whether or not <implicit_spring_damper> was also helpful, but seems like there's a lot of discussion about having this turned on by default, which makes sense to me to avoid instabilities.

It's a pretty verbose way to define a 3DOF spring-damper but it works okay.

I found this discussion:

This suggests

A floating joint in Gazebo (SDF) is just no joint ๐Ÿ˜‰

But I think the ability to define dynamics on various axes means that "no joint" and "a 6DOF joint" are not identically equal. It'd be cool to have some 2DOF and 3DOF translational joints that do this job more tersely.

We've already got revolute2 and ball joints for the rotational equivalent I guess.

A 6DOF bushing type joint on which one can define dynamics would be nice, but I think I know how to do the job I wanted to do now with the tools we have.

edit flag offensive delete link more


It looks like <implicit_spring_damper> is not actually supported yet at least in the way I'm using it. When I start Gazebo I get warnings that it's not supported. Need to check my SDF versions and support in Gazebo.

danzimmerman gravatar imagedanzimmerman ( 2021-02-10 20:35:18 -0500 )edit

Forgot the <physics><ode> tags around it.

danzimmerman gravatar imagedanzimmerman ( 2021-02-11 08:42:18 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-02-05 15:42:48 -0500

Seen: 51 times

Last updated: Feb 09