URDF (.xacro) vs model file (.sdf) with ROS

asked 2017-05-10 11:58:44 -0500

tsbertalan gravatar image

updated 2017-05-10 17:31:59 -0500

I'm trying to develop a simulation in Gazebo of my existing ROS-controlled bot. It occurs to me that it would be nice to be able to use the same control/mapping/planning software on the real machine or Gazebo, with only a difference in launch files.

I've written an SDF file by hand that roughly models my bot, and a launch file that (apparently) allows me to keyboard-teleop (though it's not clear that there's any actual feedback control happening).

However, to write this, I had to selectively ignore parts of many tutorials I found that referred to <gazebo> tags and URDF/.xacro files. Am I doing this wrong? Should I not have a models/gunnarsubdirectory (symlinked into ~/.gazebo/models)? Should I have some set of .xacro, .xml, and .gazebo files, derived from my current .sdf and .config files? How should my launch file change? And my environment variables?

Various pieces of information available in many incomplete or outdated tutorials disagree on these points, and the Gazebo documentation seems to be much more complete for the C++ interface.

For that matter, do I have to use ros_control? How much of my current move_base stack will I need to rewrite to so that the simulation and the real bot are drop-in replacements for each other, API-wise? My guess is that ros_control simulates my existing embedded (Arduino) PID controllers from the physical robot, but doesn't supplant move_base.

The robotican repo, which seems to be under active development and so presumably uses modern techniques, uses sdf files only for props, and a hierarchy of xacro files for each robot. When launching, it seems like they're using <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" ... for getting this into Gazebo, and xacro.py to load part of this hierachy into a ROS parameter called robot_description otherwise, though I'm not sure why.

So, I suppose I'll try to copy the methods of the robotican repo, but it's frustrating that there isn't a complete MWE for each of the Gazebo tutorials.

After trawling around a bit, I'm now finding that the contents of the various ros-kinetic-turtlebot-* packages might have the examples I need, in particular turtlebot_gazebo and all of its dependencies. I'm at work now adapting its .launch, .urdf.xacro, etc. files to my robot now.

If no one has any comments on what I might be doing wrong by this (outdated methods, etc.) I'll summarize what I end up doing in my own answer later in the week.

edit retag flag offensive close merge delete