ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Get state of all links in a model in gazebo?

asked 2012-03-29 12:51:52 -0500

wennho gravatar image

I know that I can get a list of all link states in gazebo by calling

rostopic echo -n 1 /gazebo/link_states

But what about getting link states for only a specific model I'm interested in?

Also, what is the syntax for specifying a link name? I used

 rosservice call gazebo/get_link_properties '{link_name: link1}'

but got an error instead. Is there a way for me to specify the robot name as well?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-03-06 21:41:34 -0500

Giacomo gravatar image

updated 2013-03-06 21:42:52 -0500

The correct sintax to get the state of the link you are interested on is:

rosservice call /gazebo/get_link_state 'link_name: MODEL_NAME::LINK_NAME'

Link names are prefixed by model name, e.g. pr2::base_link.

The same for the second command, the correct sintax is:

rosservice call /gazebo/get_link_properties 'link_name: MODEL_NAME::LINK_NAME'
edit flag offensive delete link more


I forgot one important thing: the link has to be the root link of the robot.

Giacomo gravatar image Giacomo  ( 2013-03-06 21:54:14 -0500 )edit

answered 2021-01-29 15:57:10 -0500

pacman2 gravatar image

This worked for me:

rosservice call /gazebo/get_link_state link_name relative_model_name


rosservice call /gazebo/get_link_state my_link ground_plane

edit flag offensive delete link more

Question Tools


Asked: 2012-03-29 12:51:52 -0500

Seen: 4,190 times

Last updated: Mar 06 '13