Ros2 and gazebo. Can someone help me?

asked 2020-06-10 05:56:32 -0600

MrBobSan gravatar image

Hi i am new with gazebo and ros. I have my own world file and i added to it the libgazebo_ros_diff_drive.so in order to do the same thing of the example world gazebo_ros_diff_drive_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/intento_simu.world]: Error reading end tag. [Err] [Server.cc:394] Unable to read sdf file[/home/daniel/intento_simu.world]

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

Here is the code:

<?xml version="1.0"?>

<sdf version="1.6"> <world name="default">

<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 ...
(more)
edit retag flag offensive close merge delete

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>
kumpakri gravatar imagekumpakri ( 2020-06-12 03:29:43 -0600 )edit

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.

MrBobSan gravatar imageMrBobSan ( 2020-07-01 04:51:25 -0600 )edit