This repo contains ROS2 packages that act on the ROS2 topics published by RealSense cameras (depthImage and PointCloud2). are useful for common pointcloud manipulation tasks.
Before running these packages, both ROS2 and a few realsense libraries need to be installed. The realsense installs include the base software, that gives you commands like realsense-viewer
, to view the cameras outputs in a GUI. Seperate realsense ROS2 wrappers also need to be installed, to allow for realsense to publish to ROS2 topics with commands like...
ros2 launch realsense2_camera rs_launch.py
ros2 launch realsense2_camera rs_launch.py pointcloud.enable:=true
ros2 launch realsense2_camera rs_pointcloud_launch.py
The packages here have launch files to start everything necessary at once. To launch the nodes to calculate and publish normals based on the depth images of a single realsense camera, call the following commands from the top-level pointcloud_grasp
directory.
colcon build
ros2 launch pointcloud_package master.launch.py
This calculates the normals using the depth image (not the pointcloud), from a single RealSense camera. When using the depth image instead of a pointcloud, finding the nearest-neighboring points is faster, because the assumption is made that nearby points in 3D space will also be nearby pixels in the 2D image. This assumption fails around edges where the depth quickly changes, but in general, works well. The algorithm I used to calculate normals is described in Chapter 5 of the MIT Robot Manipulation course.