0
$\begingroup$

I built a model with Solidworks and exported it as urdf. I believe the exported file is fine as I can insert it in the gazebo world. However, once I insert it, it falls down through the ground. Could anyone help me with this problem please? Below is the urdf content:

<?xml version="1.0" encoding="utf-8"?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner ([email protected]) 
     Commit Version: 1.6.0-4-g7f85cfe  Build Version: 1.6.7995.38578
     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot name="left_most_track">
  <link name="base_link">
    <inertial>
      <origin xyz="1.0466 3.5154 6.5E-05" rpy="0 0 0" />
      <mass value="0.24972" />
      <inertia
        ixx="1.389"
        ixy="0.083703"
        ixz="-5.1242E-18"
        iyy="0.20773"
        iyz="8.5025E-17"
        izz="1.5968" />
    </inertial>
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://left_most_track/meshes/link_white.STL" />
      </geometry>
      <material name="">
        <color rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://left_most_track/meshes/link_white.STL" />
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>100</mu>
            <mu2>50</mu2>
          </ode>
        </friction>
      </surface>
    </collision>
  </link>
  <link name="link_black">
    <inertial>
      <origin xyz="1.017 3.5211 6.5E-05" rpy="0 0 0" />
      <mass value="0.47385" />
      <inertia
        ixx="1.0826"
        ixy="0.13135"
        ixz="-3.3297E-21"
        iyy="0.20237"
        iyz="3.1487E-20"
        izz="1.285" />
    </inertial>
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://left_most_track/meshes/link_black.STL" />
      </geometry>
      <material name="">
        <color rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://left_most_track/meshes/link_black.STL" />
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>100</mu>
            <mu2>50</mu2>
          </ode>
        </friction>
      </surface>
    </collision>
  </link>
  <joint name="white_black_joint" type="fixed">
    <origin xyz="0 0 0" rpy="0 0 0" />
    <parent link="base_link" />
    <child link="link_black" />
    <axis xyz="0 0 0" />
  </joint>
  
  <gazebo reference="base_link">
    <material> Gazebo/White </material>
  </gazebo>
  
  <gazebo reference="link_black">
    <material> Gazebo/Black </material>
  </gazebo>

  <static>True</static>
</robot>
$\endgroup$

1 Answer 1

0
$\begingroup$

I assume there is no ground plane in your world model.

Try adding one, see the demo world repository for examples, e.g. here is a ground plane.

EDIT:

As that didn't help: try to embrace the <static> tag into <gazebo> tags:

<gazebo>
    <static>true</static>
</gazebo>

See also this answers.ros.org question as well as the official documentation:

<?xml version='1.0' encoding='UTF-8'?>
<!--URDF-->
<robot name='no_ref_example'>
  <link name='world'/>
  <gazebo>
    <static>true</static>
    <plugin name='testPlugin' filename='testFileName'/>
  </gazebo>
</robot>
$\endgroup$
3
  • $\begingroup$ If the problem persists, try spawning the model with a +z so that the entire model is initially above the ground plane. If you spawn one object inside another object, you can't predict which way the physics will resolve the conflict (the physics engine may push it more negative, then you get the symptom you describe.) $\endgroup$
    – Mike973
    Commented Nov 23, 2023 at 14:36
  • $\begingroup$ Hello, thank you for the answers. But, the ground plane shouldn't be the problem as this is just a model file to be added to the existing world file and other models are standing on the ground with no issues. Also, the positive z-value spawning didn't work either. $\endgroup$
    – suhjw2762
    Commented Nov 23, 2023 at 19:19
  • $\begingroup$ See the update wrt <gazebo> tags. $\endgroup$
    – JRTG
    Commented Nov 24, 2023 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.