URDF to Gazebo differs from URDF to SDF to Gazebo
I found out a strange behaviour when spawning model in Gazebo.
I have an URDF model of a humanoid robot and a launch file where it is sapwned to Gazebo through model_spawn
of the gazebo_ros
package using -urdf
flag:
<param name="robot_description"
command="$(find xacro)/xacro.py '$(find my_robot_description)/urdf/my_robot.xacro'"/>
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model my_robot -param robot_description"/>
In such a case, if I endow the URDF with a simple <gazebo>
property as follows:
<gazebo>
<!-- robot model offset -->
<pose>0 0 0.5 0 0 0</pose>
</gazebo>
It doesn't affect my model in Gazebo, which generate a warning like this:
Warning [parser_urdf.cc:1232] multiple inconsistent <pose> exists due to fixed joint reduction overwriting previous value [0 0 0.5 0 0 0] with [0 0 0 0 -0 0].
However, if I convert the URDF first to SDF (using gz sdf -p my_robot.urdf
) and spawn the SDF directly with the -sdf
flag, this does not happen and everything works as expected.
Why does this happen? Is a problem of the URDF parser of Gazebo or I'm doing something wrong?
And if you try to do : <gazebo reference="robot_base_link"> <pose>0 0 0.5 0 0 0</pose> </gazebo>
Nothing happens, but no warning is displayed this time... At a closer look it seems that no properties in the `<gazebo>` tags pass from the URDF to Gazebo (I've specified frictional parameters but they are filled with default values), even if the `gazebo_ros_control` plugin is properly loaded... I'm using Gazebo7 with ROS Jade; could this be a problem?
which version of sdformat and urdf are you running? There are some examples in the unit tests, see equivalent examples in https://bitbucket.org/osrf/sdformat/src/753c70f286d59790160cf458ad18fa322def0691/test/integration/fixed_joint_reduction_collision_visual_extension.urdf?at=default and https://bitbucket.org/osrf/sdformat/src/753c70f286d59790160cf458ad18fa322def0691/test/integration/fixed_joint_reduction_collision_visual_extension.sdf?at=default
Thanks @hsu, I probably got the problem: as I said in http://answers.ros.org/question/226659/ros-jade-gazebo7-and-gazebo_ros_control-compatibility/ I compiled directly the `jade-devel` branch of `gazebo_ros_pkgs` because there is no `gazebo_ros_pkgs` for ROS Jade and Gazebo7 yet. I thought that it was quite fine because I could control my robot from ROS as explained in the tutorials, but now I believe that the `spawn_model` could be a bit dated. Why `gz sdf` and `spawn_model` use distinct code?
What would you suggest now? Switch to Gazebo 6? Create two distinct models (SDF only for Gazebo simulation and URDF for control purposes) even if this would mean update twice when modifying something in the model? Or even other advices?