IntelRealSense / realsense-ros

ROS Wrapper for Intel(R) RealSense(TM) Cameras
http://wiki.ros.org/RealSense
Apache License 2.0
2.51k stars 1.74k forks source link

Wrong frame_id in /camera/camera/infra2/camera_info #3172

Open vinaym815 opened 1 month ago

vinaym815 commented 1 month ago

| Camera Model D415 | ROS Distro Humble

Issue Description

The frame_id on topic /camera/camera/infra2/camera_info is wrongly published as camera_infra1_optical_frame

MartyG-RealSense commented 1 month ago

Hi @vinaym815 In https://github.com/IntelRealSense/realsense-ros/pull/1242 Doronhi the RealSense ROS1 wrapper creator discusses reasons for having the right camera frame_id for infra2 be equal to that of the left camera (infra1) as this was required by some ROS packages such as StereoCameraModel

vinaym815 commented 1 month ago

Hello @MartyG-RealSense If we launch the camera using ros2 launch realsense2_camera rs_launch.py enable_infra1:=true enable_infra2:=true and echo the topic ros2 topic echo /camera/camera/infra2/camera_info we get

header:
  stamp:
    sec: 1722328243
    nanosec: 768045898
  frame_id: camera_infra1_optical_frame
...

The frame id should be camera_infra2_optical_frame

MartyG-RealSense commented 1 month ago

I recall once seeing a line in the source code of the ROS wrapper that basically said infra2_optical_frame = infra1_optical_frame, hence why the infra1 value was displayed for infra2.

The following method was suggested to get the coordinate transform from right camera to left camera.

ros2 run tf tf_echo camera_infra2_optical_frame camera_infra1_optical_frame

vinaym815 commented 1 month ago

I have a generalized checkerboard detector package which uses CameraInfo topic and Image topic to publish the relevant transform. Wrong frame_id requires making exception case and I want to avoid it.

Also when only enabling the infra2, the published frame_id is correct, i.e. 'camera_infra2_optical_frame'. So I think it is a small bug somewhere. ros2 launch realsense2_camera rs_launch.py enable_infra1:=false enable_infra2:=true

MartyG-RealSense commented 1 month ago

I will discuss your question with my Intel RealSense colleagues on the ROS wrapper team. Thanks very much for your patience!

MartyG-RealSense commented 1 month ago

Hi @vinaym815 My Intel RealSense colleagues on the ROS wrapper team said that they would look at this issue. Thanks very much for your patience!