Gazebo | Ignition | Community
Ask Your Question

not able to retrieve sensor's pose from standalone gazebo program

asked 2017-10-11 10:11:38 -0500

kimmcg gravatar image

Hi all,

I am compiling Gazebo directly as a standalone program(without the use of ROS). I use an MAV model which contains some single ray sensors in various direction. I am able to read out the value of raysensors with no problem, which means they are correctly initialized , however when I try to read out their pose from that program, I get all zeros. Is this an bug within gazebo or am I doing it in the wrong way?

The piece of code is listed here, where I try to read out the orientation of the pose in a loop. Roll pitch and yaw are all zeros.

    ignition::math::Pose3d pose3d_sensor = RaySensorPtr_test->Pose();
    gazebo::math::Pose pose_sensor = gazebo::math::Pose(pose3d_sensor);
    double roll = pose_sensor.rot.GetRoll()
    double pitch = pose_sensor.rot.GetPitch()
    double yaw = pose_sensor.rot.GetYaw()
edit retag flag offensive close merge delete


the rotation angles you're getting is relative to parent link so they could be 0s depending on what you specified in SDF. Are you're looking for angles in world frame?

iche033 gravatar imageiche033 ( 2017-10-11 16:57:44 -0500 )edit

Ah of course! The link has the orientation but not the sensor relative to the link. My bad. Thanks for your quick answer :)

kimmcg gravatar imagekimmcg ( 2017-10-13 06:24:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-10-13 06:27:08 -0500

kimmcg gravatar image

Following iche033's advise, I specified the <pose></pose> not underneath the link in the *.sdf file but within the <sensor></sensor> environment. Now I am able to read out the position and rotation with the code listed in the first command.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-10-11 10:11:38 -0500

Seen: 184 times

Last updated: Oct 13 '17