rtabmap_ros icon indicating copy to clipboard operation
rtabmap_ros copied to clipboard

pointcloud orientation issue

Open redvinaa opened this issue 5 years ago • 4 comments

Hi, I'm trying to simulate a diff drive robot with a realsense D435i in gazebo. The mapping works, but the pointcloud is displayed pointing upwards. There is no point in moving the camera link, because all the cameras are pointing forward already. The imu doesn't affect the pointcloud, because if I remove the imu sensor the pointcloud is the same. Screenshot from 2020-01-24 16-48-08 Screenshot from 2020-01-24 16-48-33 Screenshot from 2020-01-24 16-48-50 Rtabmap doesn't show any relevant error messages. I don't know what files to include that might help resolve the problem, if someone asks me to I will upload the given file.

redvinaa avatar Jan 24 '20 16:01 redvinaa

Hi, What is strange to me is that base_link is not the parent frame of the camera. Normally, you would have /map -> odom -> base_link -> camera_base ....

The frame_id you set for rgbd_odometry and rtabmap should be base_link, assuming you fix the urdf to have base_link the parent of all frames on the robot.

Try fixing your TF tree to see if it helps, otherwise it would be that the frame set in image topics is wrong, or an optical rotation is needed between camera_base and camera_link. What is the frame set in camera topics?

matlabbe avatar Feb 05 '20 23:02 matlabbe

Hi i also have the same issue. I just curious what may cause the point cloud transformation to change? Does it is transformed according to the published tf topic? or robot_description? or else?

Edit

It seems the rtabmap_ros is using the tf topic for the camera transformation. And for some reasons (either i set the tf wrongly or the conversion is invalid), the transformation does not rotate, that's why it's pointed upward. I fix this issue by trickily modify the following code in the convertRGBDMsgs function:

+rtabmap::Transform newTransform(
+	localTransform.z(), localTransform.x(), localTransform.y(),
+	-1.5708, 0.0, -1.5708);
+
-cameraModels.push_back(rtabmap_ros::cameraModelFromROS(cameraInfoMsgs[i], localTransform));
+cameraModels.push_back(rtabmap_ros::cameraModelFromROS(cameraInfoMsgs[i], newTransform));

threeal avatar Apr 19 '21 10:04 threeal

The wrong frame_id may be set in the topic.

matlabbe avatar May 04 '21 03:05 matlabbe

I also had this problem. It solved by adding dummy frame with this transformation:

  <joint name="camera_optical_joint" type="fixed">
    <origin xyz="0 0 0" rpy="-1.5707 0 -1.5707"/>
    <parent link="camera_frame"/>
    <child link="camera_optical_frame"/>
  </joint>
  <link name="camera_optical_frame"/>

yaqub93 avatar Jul 15 '23 00:07 yaqub93