gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.19k stars 481 forks source link

<soft_contact> parameter in DART doesn't work #2255

Open osrf-migration opened 7 years ago

osrf-migration commented 7 years ago

Original report (archived issue) by Maozhen Wang (Bitbucket: Maowww).


I'm trying to simulate a soft contact using DART. I created one box object and added tag in its sdf file. Then I place another mass on that box. I thought there could be different deformation(a sinkage?) on that box with different stiffness setting, but that mass stays on the surface of the box no matter what value I set. I tried a stiffness value from 100 to 0.01. The mass doesn't sink in and stays as shown in pic.

BTW, it seems adding force on an object in DART doesn't work either.

default_gzclient_camera(1)-2017-04-18T16_30_42.688511.jpg

osrf-migration commented 7 years ago

Original comment by Maozhen Wang (Bitbucket: Maowww).


axkoenig commented 3 years ago

Hi, are there any updates on this? I checked the current code (Gazebo 11) and it seems like the <soft_contact> tag in the SDF is parsed by this line in gazebo/physics/dart/DARTLink.cc. Unfortunately, when I add the following as my collision element of my link, the debug information of DART tells me that still a BodyNode is created instead of a SoftBodyNode. So the problem, still persists...

<collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <box size=0.1 0.1 0.1"/>
        </geometry>
        <surface>
          <soft_contact>
            <dart>
              <flesh_mass_fraction>0.05</flesh_mass_fraction>
              <bone_attachment>100</bone_attachment>
              <stiffness>100</stiffness>
              <damping>10</damping>
            </dart>
          </soft_contact>
        </surface>
</collision>

Any comments are much appreciated!

trns1997 commented 3 years ago

I also seem to have the same problem. <soft_contact> does not seem to work or change the models contact in anyway. I was planning to test this out, but am unsure how to go about the test.

trns1997 commented 3 years ago

Hello guys, I was playing around with soft_contacts and seem to have it figured out (Note I have only played with boxes).

Here is my box model:

<model name="my_model">
    <pose>0 0 1 0 0 0</pose>
    <link name="box_link">
      <inertial>
        <mass>10.0</mass>
        <inertia> <!-- inertias are tricky to compute -->
          <!-- http://gazebosim.org/tutorials?tut=inertia&cat=build_robot -->
          <ixx>6.64</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
          <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
          <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
          <iyy>6.64</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
          <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
          <izz>6.64</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
        </inertia>
      </inertial>
      <collision name="collision">
        <geometry>
          <box>
            <size>2 2 2</size>
          </box>
        </geometry>
        <surface>
            <soft_contact>
                <dart>
                    <bone_attachment>0.6e10</bone_attachment>
                    <stiffness>0.4e10</stiffness>
                    <damping>0.1e2</damping>
                    <flesh_mass_fraction>3</flesh_mass_fraction>
                </dart>
            </soft_contact>
        </surface>
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>2 2 2</size>
          </box>
        </geometry>
      </visual>

      <sensor name='my_contact' type='contact'>
        <contact>
          <collision>collision</collision>
        </contact>
        <plugin name="model_push" filename="~/GazeboDartTest/build/libtest_bench.so"/>
      </sensor>
    </link>
  </model>

Some results:

Bouncy Mode:

           <soft_contact>
                <dart>
                    <bone_attachment>0.6e10</bone_attachment>
                    <stiffness>0.4e10</stiffness>
                    <damping>0.1e2</damping>
                    <flesh_mass_fraction>3</flesh_mass_fraction>
                </dart>
            </soft_contact>

Gazebo Bouncy Box

bouncy

Sum of all contact forces:

10kg box so about 98.1 N force when not bouncing bouncy

Pudding Mode:

           <soft_contact>
                <dart>
                    <bone_attachment>0.6e3</bone_attachment>
                    <stiffness>0.4e3</stiffness>
                    <damping>0.1e2</damping>
                    <flesh_mass_fraction>3</flesh_mass_fraction>
                </dart>
            </soft_contact>

Gazebo Pudding Box

pudding

Sum of all contact forces:

pudding

In the gifs you can see a solid core and the rest is basically the soft body of the box. I am not sure if I should go about making a PR. Let me know. Would appreciate some feedback nonetheless, if the results make sense or not.

huqin-RM commented 1 year ago

大家好,我正在玩soft_contacts,似乎已经弄清楚了(注意我只玩过盒子)。

这是我的盒子模型:

<model name="my_model">
    <pose>0 0 1 0 0 0</pose>
    <link name="box_link">
      <inertial>
        <mass>10.0</mass>
        <inertia> <!-- inertias are tricky to compute -->
          <!-- http://gazebosim.org/tutorials?tut=inertia&cat=build_robot -->
          <ixx>6.64</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
          <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
          <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
          <iyy>6.64</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
          <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
          <izz>6.64</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
        </inertia>
      </inertial>
      <collision name="collision">
        <geometry>
          <box>
            <size>2 2 2</size>
          </box>
        </geometry>
        <surface>
            <soft_contact>
                <dart>
                    <bone_attachment>0.6e10</bone_attachment>
                    <stiffness>0.4e10</stiffness>
                    <damping>0.1e2</damping>
                    <flesh_mass_fraction>3</flesh_mass_fraction>
                </dart>
            </soft_contact>
        </surface>
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>2 2 2</size>
          </box>
        </geometry>
      </visual>

      <sensor name='my_contact' type='contact'>
        <contact>
          <collision>collision</collision>
        </contact>
        <plugin name="model_push" filename="~/GazeboDartTest/build/libtest_bench.so"/>
      </sensor>
    </link>
  </model>

一些结果:

力弹模式:

           <soft_contact>
                <dart>
                    <bone_attachment>0.6e10</bone_attachment>
                    <stiffness>0.4e10</stiffness>
                    <damping>0.1e2</damping>
                    <flesh_mass_fraction>3</flesh_mass_fraction>
                </dart>
            </soft_contact>

凉亭模拟盒

有弹性的 有弹性的

所有接触力的总和:

10公斤的盒子,所以不弹跳时的力约为98.1 N 有弹性的

布丁模式:

           <soft_contact>
                <dart>
                    <bone_attachment>0.6e3</bone_attachment>
                    <stiffness>0.4e3</stiffness>
                    <damping>0.1e2</damping>
                    <flesh_mass_fraction>3</flesh_mass_fraction>
                </dart>
            </soft_contact>

凉亭布丁盒

布丁 布丁

所有接触力的总和:

布丁

在gif中,你可以看到一个实心的核心,其余的基本上是盒子的应该柔软的主体。我不确定我是否知道进行公关。让我。无论结果是否有意义,仍然希望得到一些反馈。

I tried using your sdf, but this elastic effect didn't happen. Is it the dart engine started