zivid / zivid-ros

Official ROS driver for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
60 stars 45 forks source link

Convert pcl::PointCloud or sensor_msgs::PointCloud2 to Zivid::PointCloud #73

Open Levaru opened 2 years ago

Levaru commented 2 years ago

I'm currently writing a handeye calibration program using your cpp example. But I would like to use your ros driver package instead of interfacing with the camera directly inside my program.

The calibration requires the Zivid::PointCloud type but your service will of course return a sensor_msgs::PointCloud2 type. What would be the best way to convert it back into the Zivid format?

apartridge commented 2 years ago

Hi @Levaru. Sorry for the late response. Currently we don't have any way to convert from sensor_msgs::PointCloud2 to Zivid::PointCloud. The Zivid ROS driver is not really designed to be used together with the C++ API at the same time. I am not sure how well this will work in practice. Unfortunately we also do not have hand-eye calibration support in our ROS driver directly.

However we have an open PR (https://github.com/zivid/zivid-ros/pull/68) which will allow you to use the ROS driver to capture and save to a .zdf file on disk, that you can then load again into a Zivid::Frame and then you can call frame.pointCloud(). This PR has been on hold for a while, but we will get it finished soon and then merged.

If the capture_and_save solution does not work for you, I think you might need to have the calibration be done in a separate process independent of the ROS driver, and then only after hand-eye calibration you use the Zivid ROS driver for normal operation.