gazebosim / gazebo-classic

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

Log playback fails if there is an <sdf> tag in the world file #2281

Open osrf-migration opened 7 years ago

osrf-migration commented 7 years ago

Original report (archived issue) by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Imagine a world which has a model plugin, and that plugin takes a tag called <sdf>, for example:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <include>
      <uri>model://sun</uri>
    </include>
    <model name="sphere">
      <pose>0 1.5 20 0 0 0</pose>
      <link name="link">
        <collision name="collision">
          <geometry>
            <sphere>
              <radius>0.5</radius>
            </sphere>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <sphere>
              <radius>0.5</radius>
            </sphere>
          </geometry>
        </visual>
      </link>
      <plugin name="justtesting" filename="libInitialVelocityPlugin.so">
        <linear>0 0 10</linear>
        <sdf version="1.5">
          <just_testing_sdf_within_plugin/>
        </sdf>
      </plugin>
    </model>
  </world>
</sdf>

Gazebo works fine and the plugin is able to access that sdf tag normally. (Initial velocity plugin doesn't use it, I'm just using it as an example)

The only problem I'm having is when logging that world. It fails to playback because it tries to read the world only up to the first </sdf>.

I believe the problem comes from the logic here

osrf-migration commented 7 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


Also, the logic here: