Gazebo | Ignition | Community
Ask Your Question

How to call gazebo_msg/GetLinkState service for a sensor mounted on a robot?

asked 2018-06-05 09:33:57 -0500

federico.nardi gravatar image

Hi all,

I have the following problem:

To make my own robot in gazebo (a diff-drive with a laser and a kinect) I wrote the following urdf:

Now, I'd like to call gazebo_msgs/GetLinkState service to retrieve the pose of the sensor with respect to the gazebo world.

If I do that, that's the output I get:

image description

In fact, in the gazebo window, the robot seems to be made of just few links:

image description

How can I have gazebo to see also camera_link in order to retrieve its pose?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-05 11:39:29 -0500

chapulina gravatar image

I see you have a lot of fixed joints on your URDF. When converted to SDF, links connected by fixed joints are lumped together into links for performance, and as a consequence, the link names change.

One thing you could try would be to use the preserveFixedJoint on your URDF, so that the fixed joints are persisted, and link names and poses don't change, for example:

<joint name="camera_joint" type="fixed">
<gazebo reference='camera_joint'>"
edit flag offensive delete link more


I tried your solution, but nothing changes. Btw, I pushed the fix to the repo so you can check if I'm doing that right. To test it, you can run: roslaunch lucrezio_simulation_environments robot.launch (now the urdf is lucrezio.urdf.xacro)

federico.nardi gravatar imagefederico.nardi ( 2018-06-06 03:07:51 -0500 )edit

Of course, if I change the joint type to "continuous" then I can see it. My question is: is that a possible solution? In the end, if I'm guaranteed that no one moves camera, I can be fine with this hack.

federico.nardi gravatar imagefederico.nardi ( 2018-06-06 03:11:03 -0500 )edit

I think you may be using an older version of Gazebo which doesn't support the preserve tag... In any case, using a revolute joint with zero limits should work fine even if it is moved.

chapulina gravatar imagechapulina ( 2018-06-06 11:19:16 -0500 )edit

Question Tools

1 follower


Asked: 2018-06-05 09:33:57 -0500

Seen: 2,646 times

Last updated: Jun 05 '18