ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

How to use Kinect or other Sensors in ROS2?

I was looking at the ros2_astra_driver. I see the PR #26. Is it something similar we are looking forward in order to use sensors like kinect and others to be used in ROS2.0, without using ROS1.0 ?

Do we need to change all these drivers?
Or Will there be any common ROS2 interface for the sensors that would build the bridge between ros1 cpp/py standards with ros2 rclcpp/rclpy standards?

As it currently stands, it is necessary to do some porting of drivers and packages to bring them from ROS1 to ROS2. Some of those changes are mechanical, so will be easy to do (and possibly automate); some of those changes could be eased by a shim layer. @dirk-thomas created a PR detailing some of the problems, thinking, and solutions here: https://github.com/ros2/design/pull/139 . Feedback on that is welcome.

Hi,
@clalancette do you think we can write a shim layer for https://github.com/code-iai/iai_kinect2, to have it working on ROS2.

We haven’t done any of the work to create a generic shim yet; the PR link I posted was thoughts on designs and how to ease transition from ROS1 to ROS2. We have a few of the parts in place, but not the bulk of it. We will be doing more work on this in the future to make it easier to port.

If you want to port the kinect2 driver to ROS2 right now, I think you’d have to make a new branch/fork, and do the changes in the separate branch. If you want some ideas on the kinds of things you would have to do, you can look at the https://github.com/ros2/ros_astra_camera driver that we did.

Note that the shim layer mentioned in the design document linked above is mostly at the CMake level. As most sensor drivers rely heavily on nodelets for performance, I don’t think foresee shiming as being a suitable approach to port sensors to ROS2. It will likely be better to convert the driver to use ROS2 directly instead, as nodelets don’t exist in ROS2 (every node can be a nodelet, see https://github.com/ros2/ros2/wiki/Composition for more details on node composition in a single process).