How to align depth using realsense2_camera_node and RealSense D435?

I cannot align depth frames to color when receiving camera’s stream over ros topic.
I’m using the GitHub - IntelRealSense/realsense-ros: Intel(R) RealSense(TM) ROS Wrapper for Depth Camera package, it provides following topics:


When I use the camera directly this code snippet (simplified) works fine

import pyrealsense2 as rs
pipeline = rs.pipeline()
align_to =
align = rs.align(align_to)

while True:
        # Get frameset of color and depth
        frames = pipeline.wait_for_frames()

        # Align the depth frame to color frame
        aligned_frames = align.process(frames)

        # Get aligned frames
        aligned_depth_frame = aligned_frames.get_depth_frame()

But when I subscribe to /depth/image_rect_raw and /color/image_raw there is obviously no pipeline and all my attempts to align failed so far.

Could someone suggest how to solve this?

A user has shared some guidance in

It may not work on latest r32.7.3(Jetpack 4.6.3). You may install r32.3.1 and give it a try.

1 Like