Pose discrepancies in Gazebo and ROS.

asked 2020-05-14 07:10:24 -0500

I am using ROS Kinetic with Ubuntu 16.04 and Gazebo 7 simulator. I am using https://github.com/wsnewman/learning_ros repository to load simple_camera_model present in Part_3 in the repository.

I am working on retrieving ground truth pose of the camera with respect to an object. In the simplest case, I am trying to find the pose of a cube. I tried to get the pose of the camera with respect to the cube using 'gazebo/get_link_state service camera_link cube'. But the pose estimate is not correct as when I tried to reproject a point on the cube onto the image the point was not at the desired location. So when I tried to understand the pose information from the service call I faced two issues.
First, The pose set for camera link in simple_camera_model.xarco is not the same as that is displayed in the gazebo. In the model, a joint called camera_model is defined which is a fixed link between link named world and camera_link with <origin rpy="0.0 1.5708 1.5708" xyz="0 0.0 0.5"/>. In gazebo when I see the pose of camera_link it displays as roll:3.1415 pitch:1.570790 yaw:-1.570791 and position as x:0.0, y:0.0, z:0.5. I did not understand why orientation is not the same even though the position is the same as in the file.

Second, I expect that the translation of one link with respect to another and vice versa should have negative signs for each axis but the result is something different. The position values of x and z axes are switched. The following is the output from the terminal for the pose.

$ rosservice call /gazebo/get_link_state camera_link cube

pose: position: {x: 4.47e-07, y: -1.32e-06, z: 0.389} and orientation: {x:0.2197, y: -0.672, z: -0.219, w: -0.6722}

$ rosservice call /gazebo/get_link_state cube camera_link

pose: position:{x: 0.389, y: 2.89e-07, z: 2.55e-06} and orientation: {x:-0.2197, y:0.672, z: 0.219, w: -0.6722}

edit retag flag offensive close merge delete


The two frames are also rotated relative to one another. Have you tried visualizing them in Rviz? I think this might clear up some of your confusion.

fvd gravatar image fvd  ( 2020-05-19 10:09:46 -0500 )edit