Ask Your Question

Gazebo: spawn model fixed to another model

asked 2014-02-23 01:09:36 -0500

miniME05 gravatar image

I am currently working on a simulation with Gazebo. In this Simulation I got a robot model in some environment (some sort of table). The robot is fixed to its environment and the environment is fixed to the world. I am describing the robot and the environment in the same URDF file, but I want to describe them separately.

Here is the problem: How can I have 2 URDF files (1 for the robot and 1 for the environment), but fix the robot to the environment relative to some frame (when spawning both models via spawn_model)?

Is this somehow possible? Or is it correct to describe the robot and its environment in the same URDF file?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-02-23 03:12:13 -0500

updated 2014-02-23 09:51:53 -0500

An easy way to achieve your goal is to utilize xacro macros for your models (see xacro on the wiki and the Using Xacro to Clean Up a URDF File tutorial. By using xacro macros for your models, it is straightforward to instantiate your models alone or compose more complex models out of the macros you created.

Here´s an example I created recently:

/edit: The above is the easiest way to achieve the " fix the robot to the environment relative to some frame" part of your request. Really performing two separate "spawn model" executions and attaching models to each other on the fly probably is harder to achieve. It might make sense to ask about this at .

edit flag offensive delete link more


I haven't mentioned this in my post, but I am also using xacro. I also separated the robot and environment using macros. But in my opinion this isn't the proper way of doing it, because I want 2 separate models in the Gazebo simulation (using spawn_model) and describe the relation "somewhere else"

miniME05 gravatar image miniME05  ( 2014-02-23 04:29:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2014-02-23 01:09:36 -0500

Seen: 1,834 times

Last updated: Feb 23 '14