Robotics StackExchange | Archived questions

Ros2 and gazebo. Can someone help me?

Hi i am new with gazebo and ros. I have my own world file and i added to it the libgazeborosdiffdrive.so in order to do the same thing of the example world gazeborosdiffdrive_demo.world. When i try to run the world with i have an error:

Error [parser.cc:340] Error parsing XML in file [/home/daniel/intentosimu.world]: Error reading end tag. [Err] [Server.cc:394] Unable to read sdf file[/home/daniel/intentosimu.world]

But if i copy paste the same code from the original file everything goes perfectly.

Here is the code:

<?xml version="1.0"?>

<include>
  <uri>model://ground_plane</uri>
</include>

<include>
  <uri>model://sun</uri>
</include>

<model name='pioneer2dx'>
<pose>0 0 0.325 0 -0 0</pose>
  <link name='chassis'>
    <pose frame=''>0 0 0.16 0 -0 0</pose>
    <inertial>
      <mass>5.67</mass>
      <inertia>
        <ixx>0.07</ixx>
        <iyy>0.08</iyy>
        <izz>0.1</izz>
        <ixy>0</ixy>
        <ixz>0</ixz>
        <iyz>0</iyz>
      </inertia>
      <pose frame=''>0 0 0 0 -0 0</pose>
    </inertial>
    <collision name='collision'>
      <geometry>
        <box>
          <size>0.445 0.277 0.17</size>
        </box>
      </geometry>
      <max_contacts>10</max_contacts>
      <surface>
        <contact>
          <ode/>
        </contact>
        <bounce/>
        <friction>
          <torsional>
            <ode/>
          </torsional>
          <ode/>
        </friction>
      </surface>
    </collision>
    <collision name='castor_collision'>
      <pose frame=''>-0.2 0 -0.12 0 -0 0</pose>
      <geometry>
        <sphere>
          <radius>0.04</radius>
        </sphere>
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>0</mu>
            <mu2>0</mu2>
            <slip1>1</slip1>
            <slip2>1</slip2>
          </ode>
          <torsional>
            <ode/>
          </torsional>
        </friction>
        <contact>
          <ode/>
        </contact>
        <bounce/>
      </surface>
      <max_contacts>10</max_contacts>
    </collision>
    <visual name='visual'>
      <pose frame=''>0 0 0.04 0 -0 0</pose>
      <geometry>
        <mesh>
          <uri>model://pioneer2dx/meshes/chassis.dae</uri>
        </mesh>
      </geometry>
    </visual>
    <visual name='castor_visual'>
      <pose frame=''>-0.2 0 -0.12 0 -0 0</pose>
      <geometry>
        <sphere>
          <radius>0.04</radius>
        </sphere>
      </geometry>
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/FlatBlack</name>
        </script>
      </material>
    </visual>
    <self_collide>0</self_collide>
    <enable_wind>0</enable_wind>
    <kinematic>0</kinematic>
  </link>
  <link name='right_wheel'>
    <pose frame=''>0.1 -0.17 0.11 -0 1.5707 1.5707</pose>
    <inertial>
      <mass>1.5</mass>
      <inertia>
        <ixx>0.0051</ixx>
        <iyy>0.0051</iyy>
        <izz>0.009</izz>
        <ixy>0</ixy>
        <ixz>0</ixz>
        <iyz>0</iyz>
      </inertia>
      <pose frame=''>0 0 0 0 -0 0</pose>
    </inertial>
    <collision name='collision'>
      <geometry>
        <cylinder>
          <radius>0.11</radius>
          <length>0.05</length>
        </cylinder>
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>100000</mu>
            <mu2>100000</mu2>
            <slip1>0</slip1>
            <slip2>0</slip2>
          </ode>
          <torsional>
            <ode/>
          </torsional>
        </friction>
        <contact>
          <ode/>
        </contact>
        <bounce/>
      </surface>
      <max_contacts>10</max_contacts>
    </collision>
    <visual name='visual'>
      <geometry>
        <cylinder>
          <radius>0.11</radius>
          <length>0.05</length>
        </cylinder>
      </geometry>
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/FlatBlack</name>
        </script>
      </material>
    </visual>
    <self_collide>0</self_collide>
    <enable_wind>0</enable_wind>
    <kinematic>0</kinematic>
  </link>
  <link name='left_wheel'>
    <pose frame=''>0.1 0.17 0.11 -0 1.5707 1.5707</pose>
    <inertial>
      <mass>1.5</mass>
      <inertia>
        <ixx>0.0051</ixx>
        <iyy>0.0051</iyy>
        <izz>0.009</izz>
        <ixy>0</ixy>
        <ixz>0</ixz>
        <iyz>0</iyz>
      </inertia>
      <pose frame=''>0 0 0 0 -0 0</pose>
    </inertial>
    <collision name='collision'>
      <geometry>
        <cylinder>
          <radius>0.11</radius>
          <length>0.05</length>
        </cylinder>
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>100000</mu>
            <mu2>100000</mu2>
            <slip1>0</slip1>
            <slip2>0</slip2>
          </ode>
          <torsional>
            <ode/>
          </torsional>
        </friction>
        <contact>
          <ode/>
        </contact>
        <bounce/>
      </surface>
      <max_contacts>10</max_contacts>
    </collision>
    <visual name='visual'>
      <geometry>
        <cylinder>
          <radius>0.11</radius>
          <length>0.05</length>
        </cylinder>
      </geometry>
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/FlatBlack</name>
        </script>
      </material>
    </visual>
    <self_collide>0</self_collide>
    <enable_wind>0</enable_wind>
    <kinematic>0</kinematic>
  </link>
  <joint name='left_wheel_hinge' type='revolute'>
    <pose frame=''>0 0 -0.03 0 -0 0</pose>
    <child>left_wheel</child>
    <parent>chassis</parent>
    <axis>
      <xyz>0 1 0</xyz>
      <use_parent_model_frame>1</use_parent_model_frame>
      <limit>
        <lower>-1e+16</lower>
        <upper>1e+16</upper>
      </limit>
      <dynamics>
        <spring_reference>0</spring_reference>
        <spring_stiffness>0</spring_stiffness>
      </dynamics>
    </axis>
  </joint>
  <joint name='right_wheel_hinge' type='revolute'>
    <pose frame=''>0 0 0.03 0 -0 0</pose>
    <child>right_wheel</child>
    <parent>chassis</parent>
    <axis>
      <xyz>0 1 0</xyz>
      <use_parent_model_frame>1</use_parent_model_frame>
      <limit>
        <lower>-1e+16</lower>
        <upper>1e+16</upper>
      </limit>
      <dynamics>
        <spring_reference>0</spring_reference>
        <spring_stiffness>0</spring_stiffness>
      </dynamics>
    </axis>
  </joint>

  <plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'>  
<ros>
      <namespace>/demo</namespace>
      <argument>cmd_vel:=cmd_demo</argument>
      <argument>odom:=odom_demo</argument>
    </ros>


  <pose frame=''>0.137865 -0.009601 0 0 -0 0</pose>
</model>
<state world_name='default'>
  <sim_time>35 39000000</sim_time>
  <real_time>35 333895388</real_time>
  <wall_time>1591784247 836450534</wall_time>
  <iterations>35039</iterations>
  <model name='ground_plane'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <scale>1 1 1</scale>
    <link name='link'>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <velocity>0 0 0 0 -0 0</velocity>
      <acceleration>0 0 0 0 -0 0</acceleration>
      <wrench>0 0 0 0 -0 0</wrench>
    </link>
  </model>
  <model name='pioneer2dx'>
    <pose frame=''>0.187144 -0.007815 -1e-06 0 -3.1e-05 -0.000323</pose>
    <scale>1 1 1</scale>
    <link name='chassis'>
      <pose frame=''>0.187139 -0.007815 0.159999 0 -3.1e-05 -0.000323</pose>
      <velocity>0.002496 0.00012 0.001325 1.6e-05 -0.041571 -1.7e-05</velocity>
      <acceleration>-1.43843 0.008004 2.65016 0.035704 -1.46043 0.012583</acceleration>
      <wrench>-8.15588 0.045383 15.0264 0 -0 0</wrench>
    </link>
    <link name='left_wheel'>
      <pose frame=''>0.287195 0.162153 0.110002 -1.15464 1.57057 0.415742</pose>
      <velocity>0.004574 9.5e-05 0.00549 -0.000837 0.041572 -3.2e-05</velocity>
      <acceleration>2.71308 -0.013215 10.9773 -0.82084 0.000886 -0.004025</acceleration>
      <wrench>4.06962 -0.019823 16.4659 0 -0 0</wrench>
    </link>
    <link name='right_wheel'>
      <pose frame=''>0.287085 -0.177847 0.110002 -0.044763 1.5707 1.52561</pose>
      <velocity>0.004575 9.1e-05 0.005476 -0.0008 0.041593 -8e-06</velocity>
      <acceleration>2.72452 -0.01704 10.9529 -0.784279 0.012741 0.038966</acceleration>
      <wrench>4.08678 -0.025561 16.4294 0 -0 0</wrench>
    </link>
  </model>
  <light name='sun'>
    <pose frame=''>0 0 10 0 -0 0</pose>
  </light>
</state>
<gui fullscreen='0'>
  <camera name='user_camera'>
    <pose frame=''>10.4636 -4.31683 8.76032 0 0.547643 2.58819</pose>
    <view_controller>orbit</view_controller>
    <projection_type>perspective</projection_type>
  </camera>
</gui>

=======


Asked by MrBobSan on 2020-06-10 05:56:32 UTC

Comments

how is this supposed to work? Never seen any tag with slash at the end.

    <contact>
      <ode/>
    </contact>
    <bounce/>
    <friction>
      <torsional>
        <ode/>
      </torsional>
      <ode/>
    </friction>

Asked by kumpakri on 2020-06-12 03:29:43 UTC

The code comes directly from creating the world in the gazebo app and saving it. The mistake was that I forgot to add the plugin correctly. It finally works. Thank you anyway.

Asked by MrBobSan on 2020-07-01 04:51:25 UTC

Answers