0.0 mass causes exception

Create issue
Issue #307 new
Brian Gerkey created an issue

Putting the following inertial block in a link causes an exception on insertion into the world:

  <inertial>
    <mass>0.0</mass>
  </inertial>

Comments (8)

  1. Brian Gerkey reporter

    Here's the entire model, in case it's relevant:

    <?xml version="1.0"?>
    <sdf version="1.3">
      <model name="Polaris Ranger EV">
        <link name="chassis">
          <pose>0 0 0 0 0 0</pose>
          <inertial>
            <mass>0.0</mass>
          </inertial>
          <visual name="visual">
            <geometry>
              <mesh>
                <uri>model://polaris_ranger_ev/meshes/polaris.dae</uri>
              </mesh>
            </geometry>
          </visual>
          <!-- collision name="chassis_bottom">
            <geometry>
              <box>
                <size></size>
              </box>
            </geometry>
          </collision -->
        </link>
        <link name="rear_right_wheel">
          <pose>-1.0 -1.0 0.25 0 1.5707 1.5707</pose>
          <inertial>
            <mass>0.5</mass>
          </inertial>
          <collision name="collision">
            <geometry>
              <cylinder>
                <radius>0.5</radius>
                <length>0.2</length>
              </cylinder>
            </geometry>
            <surface>
              <friction>
                <ode>
                  <mu>100000.0</mu>
                  <mu2>100000.0</mu2>
                  <slip1>0.0</slip1>
                  <slip2>0.0</slip2>
                </ode>
              </friction>
            </surface>
          </collision>
        </link>
        <joint type="revolute" name="rear_right_wheel_joint">
          <pose>0 0 -0.03 0 0 0</pose>
          <child>rear_right_wheel</child>
          <parent>chassis</parent>
          <axis>
            <xyz>0 1 0</xyz>
          </axis>
        </joint>
      </model>
    </sdf>
    
  2. Jackie K

    Resurrecting the discussion old issue here: how should Gazebo treat a link of mass 0? Crashing on exception is suboptimal.

    We could allow for links with zero or negative mass and simply warn the user that this will result in very unrealistic physics behavior. I've made a branch test_zero_mass that gets rid of this exception and sets the "invalid" mass with a warning. If we decide we want to allow nonpositive mass-links, this branch could become a pull request.

    However, if we want to restrict the user to only positive mass objects, we need to prevent the model from being spawned.

  3. Log in to comment