Gazebo | Ignition | Community
Ask Your Question

Spawn a box in another frame than world

asked 2015-06-11 09:56:02 -0500

mehdi gravatar image

updated 2015-06-11 11:01:17 -0500

Is it possible to spawn a box in a different frame than world? having already a robot spawned, I want to spawn something relative to base_link of that robot. How to do that?

After digging in the source code I discovered an input argument called referenceframe that can be used with the spawnmodel script.

-reference_frame <entity_name>

But I couldn't make Gazebo use it, I don't exactly what to write as "entityname", should it be the name of the existing robot, or robotname::baselink? or something else? No matter what I write there is no error message from Gazebo so a hint would be helpful.

edit retag flag offensive close merge delete


Could you please add a link to the part of source code / documentation where you saw reference_frame?

chapulina gravatar imagechapulina ( 2015-06-11 11:14:00 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-09-07 19:45:13 -0500

mrjogo gravatar image

From experimentation, the -reference_frame option in spawn_model must be relative to a link in a model in the world. So, for instance the following works for me:

rosrun gazebo_ros spawn_model -urdf -model my_robot -param robot_description -reference_frame other_model_name::link_name

When it can't find the reference_frame (or it's in an unexpected format), the console will output

Spawn status: SpawnModel: reference reference_frame not found, did you forget to scope the link by model name?
edit flag offensive delete link more

answered 2015-06-11 11:13:10 -0500

chapulina gravatar image

You can get the current world pose of base_link and add it to the desired pose. math::Pose's + operator should do the transforms for you.

Note that you would just be giving an offset at the beginning, but as base_link moves, their relative pose might change.

edit flag offensive delete link more


The problem is that I have object layed on a disc, their position is defined by a radius and an angle relative to that disc. When I want to spawn those object at the right place I calculate x and y by reprojecting back from polar coordinates to Cartesian. I wanted to avoid all these rotation stuff plus quaternions conversion because it always leads me to confusion.

mehdi gravatar imagemehdi ( 2015-06-11 11:27:13 -0500 )edit

But forcing my base_link to be in the same frame than world is the fastest solution ;)

mehdi gravatar imagemehdi ( 2015-06-14 10:41:00 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2015-06-11 09:56:02 -0500

Seen: 5,972 times

Last updated: Sep 07 '16