luxonis / depthai-ros

Official ROS Driver for DepthAI Sensors.
MIT License
260 stars 190 forks source link

[question] Change of distortion_model param in depthai_examples #370

Closed ciniminis1 closed 1 year ago

ciniminis1 commented 1 year ago

Hi there, please, how can I change the distortion_model in /camera_info message? My Oak-D Pro uses rational_polynomial model, while in depthai_examples/params/cameraconfigs, the plumb_bob model is used (which is desired). Even if the /stereo_publisher/camera_param_uripath is correctly set, the values from config files are ignored. Thank you.

Serafadam commented 1 year ago

Hi, stereo_publisher example code at this moment doesn't support loading external calibration file (you would have to edit the example code to add that, or write a new node using that setup). Loading ROS calibrations from parameters is supported in depthai_ros_driver.

ciniminis1 commented 1 year ago

Hi, @Serafadam , sure, I tried to set up a path to the calibration file. Unfortunately, it evokes the[ERROR] [1692269031.217107656]: Invalid camera calibration URL: depthai_ros_driver/config/calibration/rgb.yaml. I kept the original path, but it does not accept local or global paths. Moreover, could you please give me a hint on how to set the camera to really output the non-rectified image_raw in separate topics for left and right cameras?

Serafadam commented 1 year ago

Hi, CameraInfoManager has specific path convention mentioned here, to use global path you should prepend it with file:///. Regarding non-rectified images, you can enable topics with for example left: i_publish_topic: true

ciniminis1 commented 1 year ago

@Serafadam Thank you. Regarding non-rectified image i_publish_topic works reliably in ROS1 driver, although does not work in ROS2 driver. The configuration used is completely the same.

Serafadam commented 1 year ago

Could you share your setup? I've just edited this line and it is working in my case

ciniminis1 commented 1 year ago

@Serafadam I use Foxy branch version with OAK-D-Pro. I rebuild the packages and changed only i_publish_topic, but the camera streams /stereo topics anyway.

Serafadam commented 1 year ago

@martinlucan I would recommend switching to Humble version if possible (you can use Docker container for that) as Foxy distribution reached end of life this year and thus is not officially supported. Nevertheless, setting publish_topic should work just fine (tested it right now).

One caveat with Foxy is that parameters for composable nodes have a bit different format (node name doesn't have / sign and ros__parameters field is missing, for comparison Humble parameters file and Foxy parameters file.

ciniminis1 commented 1 year ago

@Serafadam I managed to run a camera from Docker with humble branch, publish_topic parameter us now working properly. Although I see that /camera_info topic is not being published. Do you know what might be the case?

Serafadam commented 1 year ago

Hi, could you show the result of ros2 topic list?

ciniminis1 commented 1 year ago

@Serafadam see the ros2 topic list output, while /camera_info being empty. /camera_raw for left and right cameras are publishing.

/joint_states
/oak/imu/data
/oak/left/camera_info
/oak/left/image_raw
/oak/left/image_raw/compressed
/oak/left/image_raw/compressedDepth
/oak/left/image_raw/theora
/oak/right/camera_info
/oak/right/image_raw
/oak/right/image_raw/compressed
/oak/right/image_raw/compressedDepth
/oak/right/image_raw/theora
/parameter_events
/robot_description
/rosout
/tf
/tf_static
Serafadam commented 1 year ago

Hi @martinlucan, which sensor information are you expecting on /camera_info topic? Generally, info topic for each sensor is published on /camera_name/sensor_name/camera_info, so for example /oak/left/camera_info

ciniminis1 commented 1 year ago

@Serafadam sorry, I shorted the topic name, I definitely meant /oak/left/camera_info, according to the topic list.

Serafadam commented 1 year ago

Could you share logs that you get when running the driver? Additionally, you can run export DEPTHAI_DEBUG=1 before launching to enable more log information.

ciniminis1 commented 1 year ago

@Serafadam please see the attached DEGUB output as well as config file debug_log.txt config.txt

Serafadam commented 1 year ago

Thanks @martinlucan, I think I found a bug on latest development branch, fix will be merged today

ciniminis1 commented 1 year ago

@Serafadam Thank you, looking forward to the merge. Could you please elaborate on what is the bug related to? I am just being curious.

Serafadam commented 1 year ago

One of the newest updates introduced lazy publishing mechanism which checks whether there are subscribers to a topic. What needs to be updated is to use image_transport::CameraPublisher getNumSubscribers() method to check for all types of subscribers as for now the check was only against image topic. In other words, until this is merged you should be able to get camera_info messages if you also subscribe to the image topic in some other way (such as displaying it in rviz/rqt).

ciniminis1 commented 1 year ago

@Serafadam Thank you, I solved it temporarily by creating a "dummy" subscriber, to force the /camera_info topic to publish.

Serafadam commented 1 year ago

Changes are merged, closing the issue.