0
$\begingroup$

Rosanswers logo

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?


Originally posted by miniME05 on ROS Answers with karma: 33 on 2014-02-23

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 http://answers.gazebosim.org/questions/.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2014-02-23

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by miniME05 on 2014-02-23:
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"

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.