Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge ros2-development into ros2-hkr #2882

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
a3e046a
Added pointcloud and dual camera examples
Arun-Prasad-V Aug 9, 2023
c785bf5
support color and depth/ir formats
SamerKhshiboun Aug 8, 2023
e05a75b
remove unsupported models
SamerKhshiboun Aug 10, 2023
1901d2c
added align_depth and get params from YAML examples
Arun-Prasad-V Aug 14, 2023
5663e71
Updated rs_launch param names
Arun-Prasad-V Aug 14, 2023
b5e57d5
updated rs_launch
Arun-Prasad-V Aug 14, 2023
116ac2e
Updated the rs_launch.py params
Arun-Prasad-V Aug 14, 2023
f2a389e
Merge branch 'ros2-development' into remove_l500_sr300
SamerKhshiboun Aug 16, 2023
7fef703
updated node output setting
Arun-Prasad-V Aug 17, 2023
e14ba75
Create /imu topic only when motion streams enabled
Arun-Prasad-V Aug 18, 2023
00621dc
Get the topic to subscribe from user
Arun-Prasad-V Aug 22, 2023
180a711
Apply camera name in topics
hyunseok-yang Aug 24, 2023
af3cd22
Added the changes from https://github.com/IntelRealSense/realsense-ro…
PrasRsRos Aug 28, 2023
3fc9f1d
Updated readme
PrasRsRos Aug 28, 2023
ec52d3b
modified service call device_info also
PrasRsRos Aug 28, 2023
bd385e9
minor change in readme
PrasRsRos Aug 28, 2023
c92ddf0
PR #2857 from lge-ros2: Apply camera name in topics
SamerKhshiboun Aug 29, 2023
e3726b9
Merge PR #2859 from PrasRsRos: Fix tests (topic now has camera name)
SamerKhshiboun Aug 29, 2023
5d0695a
fix readme and nodefactory for ros2 run
SamerKhshiboun Aug 29, 2023
30a70e1
Update README.md
SamerKhshiboun Aug 29, 2023
1801cfc
Merge branch 'ros2-development' into imu
SamerKhshiboun Aug 29, 2023
8405872
merge
SamerKhshiboun Aug 29, 2023
327e602
Update README.md
SamerKhshiboun Aug 29, 2023
2cf7290
PR #2863 from IntelRealSense: Update README.md
Nir-Az Aug 29, 2023
66ba4ee
Added live camera tests
PrasRsRos Aug 30, 2023
07d7025
PR #2861 from SamerKhshiboun: fix readme and nodefactory for ros2 run
Nir-Az Aug 31, 2023
6922d4d
Updated readme and imu tests
PrasRsRos Aug 31, 2023
a20eb25
static_tf fix
PrasRsRos Sep 1, 2023
3cb506d
PR #2839 from Arun-Prasad: Added ros2 examples
SamerKhshiboun Sep 5, 2023
c80e471
Added tf and tf_static tests
PrasRsRos Sep 5, 2023
adc75d7
Added pointcloud tests for live camera
PrasRsRos Sep 5, 2023
ce710eb
PR #2847 from Arun-Prasad-V: Updated rs_launch param names
SamerKhshiboun Sep 6, 2023
1e8b966
Merge branch 'IntelRealSense:ros2-development' into imu
Arun-Prasad-V Sep 6, 2023
ee244ef
Fix: Pointcloud topic's frame_id
Arun-Prasad-V Sep 6, 2023
6fdfaa0
updated readme
Arun-Prasad-V Sep 7, 2023
41ae997
updated QoS of IMU topic
Arun-Prasad-V Sep 7, 2023
d9e61a9
Merge PR #2849 from Arun-Prasad-V: Create /imu topic only when motion…
SamerKhshiboun Sep 6, 2023
1634444
Add aligned tests
PrasRsRos Sep 8, 2023
d5b42b8
Merge branch 'IntelRealSense:ros2-development' into add-live-camera-t…
PrasRsRos Sep 8, 2023
af646fb
Modified the imu test to remove workaround for RS550
PrasRsRos Sep 8, 2023
139acde
removed failing_test file, was covered in all_profile_tests anyway
PrasRsRos Sep 8, 2023
fd9a686
Merge PR #2868 from Arun-Prasad-V: Fix Pointcloud topic frame_id
SamerKhshiboun Sep 9, 2023
7064b9b
Merge branch 'IntelRealSense:ros2-development' into add-live-camera-t…
PrasRsRos Sep 11, 2023
642236c
Merge branch 'IntelRealSense:ros2-development' into frame_latency
Arun-Prasad-V Sep 11, 2023
e4fd495
Merge branch 'IntelRealSense:ros2-development' into remove_l500_sr300
SamerKhshiboun Sep 2, 2023
4ed7a9f
rebase from ros2-development
SamerKhshiboun Sep 11, 2023
4412cdc
rebase from ros2-development
SamerKhshiboun Sep 11, 2023
348dec3
All topics may need more time in CI
PrasRsRos Sep 11, 2023
0446d7c
All topics testing
PrasRsRos Sep 11, 2023
5f7ec20
All topics testing1
PrasRsRos Sep 11, 2023
426776b
All topics testing2
PrasRsRos Sep 11, 2023
015bd4a
All topics testing3
PrasRsRos Sep 11, 2023
7235d99
All topics testing4
PrasRsRos Sep 11, 2023
e2cd241
All topics added to regression only, excluded from CI
PrasRsRos Sep 11, 2023
b958ca1
getting camera_name dynamically in ROS2 wrapper
Arun-Prasad-V Sep 11, 2023
aef2951
updated tests for the failures in CI
PrasRsRos Sep 14, 2023
e861b35
correct the d435 marker
PrasRsRos Sep 14, 2023
de01005
added markers for d415 d455 specific tests
PrasRsRos Sep 15, 2023
241961e
updated examples and readme
Arun-Prasad-V Sep 18, 2023
df411b1
[Frame Latency] Support for all topics
Arun-Prasad-V Sep 26, 2023
9dae8bd
PR #2841 from SamerKhshiboun: Remove Dashing, Eloquent, Foxy, L500 an…
SamerKhshiboun Sep 26, 2023
7b95863
merge ros2-development into ros2-hkr
SamerKhshiboun Sep 26, 2023
16721e1
Merge branch 'IntelRealSense:ros2-development' into frame_latency
Arun-Prasad-V Sep 27, 2023
0e47ef9
Merge branch 'ros2-development' into ros2_examples_readme
Arun-Prasad-V Sep 27, 2023
6f87960
PR #2878 from Arun-Prasad-V: Updated ros2 examples and readme
SamerKhshiboun Sep 27, 2023
1cd8f27
Merge branch 'ros2-development' into camera_name
Arun-Prasad-V Sep 27, 2023
5c1aaaa
Merge PR #2872 from Arun-Prasad-V: Updating _camera_name with RS node…
SamerKhshiboun Sep 27, 2023
9679a9b
[Frame latency Tool] Added description
Arun-Prasad-V Sep 27, 2023
6947e13
Merge PR #2853 from Arun-Prasad-V: Frame latency for the '/topic' pro…
SamerKhshiboun Sep 27, 2023
aaab453
Merge branch 'ros2-development' into merge_from_dev_to_hkr_27_9_2023
SamerKhshiboun Oct 3, 2023
d2549b1
Revert 'Updating _camera_name with RS node's name'
Arun-Prasad-V Oct 4, 2023
6305b1c
Merge PR #2891 from Arun-Prasad-V: revert PR2872
SamerKhshiboun Oct 4, 2023
7762d8d
Update README.md
SamerKhshiboun Oct 4, 2023
b66a252
Added live camera tests
PrasRsRos Aug 30, 2023
dc12788
Updated readme and imu tests
PrasRsRos Aug 31, 2023
6d34932
static_tf fix
PrasRsRos Sep 1, 2023
295f08d
Added tf and tf_static tests
PrasRsRos Sep 5, 2023
1ff67d4
Added pointcloud tests for live camera
PrasRsRos Sep 5, 2023
4f5c34d
Add aligned tests
PrasRsRos Sep 8, 2023
726dbd2
Modified the imu test to remove workaround for RS550
PrasRsRos Sep 8, 2023
7a525a7
removed failing_test file, was covered in all_profile_tests anyway
PrasRsRos Sep 8, 2023
2c8a39b
All topics may need more time in CI
PrasRsRos Sep 11, 2023
5adccee
All topics testing
PrasRsRos Sep 11, 2023
a8225d1
All topics testing1
PrasRsRos Sep 11, 2023
be59d2e
All topics testing2
PrasRsRos Sep 11, 2023
ac6301e
All topics testing3
PrasRsRos Sep 11, 2023
53e39e7
All topics testing4
PrasRsRos Sep 11, 2023
7777ae7
All topics added to regression only, excluded from CI
PrasRsRos Sep 11, 2023
31b7a80
updated tests for the failures in CI
PrasRsRos Sep 14, 2023
b0d14bf
correct the d435 marker
PrasRsRos Sep 14, 2023
1376bb7
added markers for d415 d455 specific tests
PrasRsRos Sep 15, 2023
b150072
Merge branch 'add-live-camera-tests' of https://github.com/PrasRsRos/…
PrasRsRos Oct 5, 2023
8e499f1
fixed live camera connection checking
PrasRsRos Oct 5, 2023
8de679b
Merge PR #2865 from PrasRsRos: add live camera tests
SamerKhshiboun Oct 5, 2023
218e327
Update README.md
SamerKhshiboun Oct 5, 2023
4ffe643
Merge branch 'ros2-development' into merge_from_dev_to_hkr_27_9_2023
SamerKhshiboun Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

166 changes: 117 additions & 49 deletions README.md

Large diffs are not rendered by default.

60 changes: 40 additions & 20 deletions realsense2_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,34 +143,18 @@ set(SOURCES
if(NOT DEFINED ENV{ROS_DISTRO})
message(FATAL_ERROR "ROS_DISTRO is not defined." )
endif()
if("$ENV{ROS_DISTRO}" STREQUAL "dashing")
message(STATUS "Build for ROS2 Dashing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDASHING")
set(SOURCES "${SOURCES}" src/ros_param_backend_dashing.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "eloquent")
message(STATUS "Build for ROS2 eloquent")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DELOQUENT")
set(SOURCES "${SOURCES}" src/ros_param_backend_foxy.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "foxy")
message(STATUS "Build for ROS2 Foxy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFOXY")
set(SOURCES "${SOURCES}" src/ros_param_backend_foxy.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "galactic")
message(STATUS "Build for ROS2 Galactic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGALACTIC")
set(SOURCES "${SOURCES}" src/ros_param_backend_foxy.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "humble")
if("$ENV{ROS_DISTRO}" STREQUAL "humble")
message(STATUS "Build for ROS2 Humble")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHUMBLE")
set(SOURCES "${SOURCES}" src/ros_param_backend_foxy.cpp)
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "iron")
message(STATUS "Build for ROS2 Iron")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIRON")
set(SOURCES "${SOURCES}" src/ros_param_backend_foxy.cpp)
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "rolling")
message(STATUS "Build for ROS2 Rolling")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DROLLING")
set(SOURCES "${SOURCES}" src/ros_param_backend_rolling.cpp)
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
else()
message(FATAL_ERROR "Unsupported ROS Distribution: " "$ENV{ROS_DISTRO}")
endif()
Expand Down Expand Up @@ -271,6 +255,12 @@ install(DIRECTORY
DESTINATION share/${PROJECT_NAME}
)

# Install example files
install(DIRECTORY
examples
DESTINATION share/${PROJECT_NAME}
)

# Test
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
Expand Down Expand Up @@ -313,6 +303,36 @@ if(BUILD_TESTING)
)
endforeach()
endforeach()

unset(_pytest_folders)

set(rs_query_cmd "rs-enumerate-devices -s")
execute_process(COMMAND bash -c ${rs_query_cmd}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE rs_result
OUTPUT_VARIABLE RS_DEVICE_INFO)
message(STATUS "rs_device_info:")
message(STATUS "${RS_DEVICE_INFO}")
if((RS_DEVICE_INFO MATCHES "D455") OR (RS_DEVICE_INFO MATCHES "D415") OR (RS_DEVICE_INFO MATCHES "D435"))
message(STATUS "D455 device found")
set(_pytest_live_folders
test/live_camera
)
endif()

foreach(test_folder ${_pytest_live_folders})
file(GLOB files "${test_folder}/test_*.py")
foreach(file ${files})

get_filename_component(_test_name ${file} NAME_WE)
ament_add_pytest_test(${_test_name} ${file}
APPEND_ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_SOURCE_DIR}/test/utils:${CMAKE_SOURCE_DIR}/launch:${CMAKE_SOURCE_DIR}/scripts
TIMEOUT 500
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endforeach()
endforeach()

endif()

# Ament exports
Expand Down
12 changes: 12 additions & 0 deletions realsense2_camera/examples/align_depth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Align Depth to Color
This example shows how to start the camera node and align depth stream to color stream.
```
ros2 launch realsense2_camera rs_align_depth_launch.py
```

The aligned image will be published to the topic "/aligned_depth_to_color/image_raw"

Also, align depth to color can enabled by following cmd:
```
ros2 launch realsense2_camera rs_launch.py align_depth.enable:=true
```
56 changes: 56 additions & 0 deletions realsense2_camera/examples/align_depth/rs_align_depth_launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2023 Intel Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# DESCRIPTION #
# ----------- #
# Use this launch file to launch a device and align depth to color.
# The Parameters available for definition in the command line for the camera are described in rs_launch.configurable_parameters
# command line example:
# ros2 launch realsense2_camera rs_align_depth_launch.py

"""Launch realsense2_camera node."""
from launch import LaunchDescription
import launch_ros.actions
from launch.actions import OpaqueFunction
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir
import sys
import pathlib
sys.path.append(str(pathlib.Path(__file__).parent.absolute()))
import os
from ament_index_python.packages import get_package_share_directory
sys.path.append(os.path.join(get_package_share_directory('realsense2_camera'), 'launch'))
import rs_launch

local_parameters = [{'name': 'camera_name', 'default': 'camera', 'description': 'camera unique name'},
{'name': 'camera_namespace', 'default': 'camera', 'description': 'camera namespace'},
{'name': 'enable_color', 'default': 'true', 'description': 'enable color stream'},
{'name': 'enable_depth', 'default': 'true', 'description': 'enable depth stream'},
{'name': 'align_depth.enable', 'default': 'true', 'description': 'enable align depth filter'},
{'name': 'enable_sync', 'default': 'true', 'description': 'enable sync mode'},
]

def set_configurable_parameters(local_params):
return dict([(param['name'], LaunchConfiguration(param['name'])) for param in local_params])


def generate_launch_description():
params = rs_launch.configurable_parameters
return LaunchDescription(
rs_launch.declare_configurable_parameters(local_parameters) +
rs_launch.declare_configurable_parameters(params) +
[
OpaqueFunction(function=rs_launch.launch_setup,
kwargs = {'params' : set_configurable_parameters(params)}
)
])
123 changes: 123 additions & 0 deletions realsense2_camera/examples/dual_camera/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Launching Dual RS ROS2 nodes
The following example lanches two RS ROS2 nodes.
```
ros2 launch realsense2_camera rs_dual_camera_launch.py serial_no1:=<serial number of the first camera> serial_no2:=<serial number of the second camera>
```

## Example:
Let's say the serial numbers of two RS cameras are 207322251310 and 234422060144.
```
ros2 launch realsense2_camera rs_dual_camera_launch.py serial_no1:="'207322251310'" serial_no2:="'234422060144'"
```
or
```
ros2 launch realsense2_camera rs_dual_camera_launch.py serial_no1:=_207322251310 serial_no2:=_234422060144
```

## How to know the serial number?
Method 1: Using the rs-enumerate-devices tool
```
rs-enumerate-devices | grep "Serial Number"
```

Method 2: Connect single camera and run
```
ros2 launch realsense2_camera rs_launch.py
```
and look for the serial number in the log printed to screen under "[INFO][...] Device Serial No:".

# Using Multiple RS camera by launching each in differnet terminals
Make sure you set a different name and namespace for each camera.

Terminal 1:
```
ros2 launch realsense2_camera rs_launch.py serial_no:="'207322251310'" camera_name:='camera1' camera_namespace:='camera1'
```
Terminal 2:
```
ros2 launch realsense2_camera rs_launch.py serial_no:="'234422060144'" camera_name:='camera2' camera_namespace:='camera2'
```

# Multiple cameras showing a semi-unified pointcloud
The D430 series of RealSense cameras use stereo based algorithm to calculate depth. This mean, a couple of cameras can operate on the same scene. For the purpose of this demonstration, let's say 2 cameras can be coupled to look at the same scene from 2 different points of view. See image:

![multi_cameras](https://user-images.githubusercontent.com/127019120/268692789-1b3d5d8b-a41f-4a97-995d-81d44b4bcacb.jpg)

The schematic settings could be described as:
X--------------------------------->cam_2
|&emsp;&emsp;&emsp;&emsp;(70 cm)
|
|
|&ensp;(60 cm)
|
|
/
cam_1

The cameras have no data regarding their relative position. That’s up to a third party program to set. To simplify things, the coordinate system of cam_1 can be considered as the refernce coordinate system for the whole scene.

The estimated translation of cam_2 from cam_1 is 70(cm) on X-axis and 60(cm) on Y-axis. Also, the estimated yaw angle of cam_2 relative to cam_1 as 90(degrees) clockwise. These are the initial parameters to be set for setting the transformation between the 2 cameras as follows:

```
ros2 launch realsense2_camera rs_dual_camera_launch.py serial_no1:=_207322251310 serial_no2:=_234422060144 tf.translation.x:=0.7 tf.translation.y:=0.6 tf.translation.z:=0.0 tf.rotation.yaw:=-90.0 tf.rotation.pitch:=0.0 tf.rotation.roll:=0.0
```

If the unified pointcloud result is not good, follow the below steps to fine-tune the calibaration.

## Visualizing the pointclouds and fine-tune the camera calibration
Launch 2 cameras in separate terminals:

**Terminal 1:**
```
ros2 launch realsense2_camera rs_launch.py serial_no:="'207322251310'" camera_name:='camera1' camera_namespace:='camera1'
```
**Terminal 2:**
```
ros2 launch realsense2_camera rs_launch.py serial_no:="'234422060144'" camera_name:='camera2' camera_namespace:='camera2'
```
**Terminal 3:**
```
rviz2
```
Open rviz and set '“Fixed Frame'” to “camera1_link”
Add Pointcloud2-> By topic -> /camera1/camera1/depth/color/points
Add Pointcloud2 -> By topic -> /camera2/camera2/depth/color/points

**Terminal 4:**
Run the 'set_cams_transforms.py' tool. It can be used to fine-tune the calibaration.
```
python src/realsense-ros/realsense2_camera/scripts/set_cams_transforms.py camera1_link camera2_link 0.7 0.6 0 -90 0 0
```

**Instructions printed by the tool:**
```
Using default file /home/user_name/ros2_ws/src/realsense-ros/realsense2_camera/scripts/_set_cams_info_file.txt

Use given initial values.

Press the following keys to change mode: x, y, z, (a)zimuth, (p)itch, (r)oll

For each mode, press 6 to increase by step and 4 to decrease

Press + to multiply step by 2 or - to divide

Press Q to quit
```

Note that the tool prints the path of the current configuration file. It saves its last configuration automatically, all the time, to be used on the next run.

After a lot of fiddling around, unified pointcloud looked better with the following calibaration:
```
x = 0.75
y = 0.575
z = 0
azimuth = -91.25
pitch = 0.75
roll = 0
```

Now, use the above results in the launch file:
```
ros2 launch realsense2_camera rs_dual_camera_launch.py serial_no1:=_207322251310 serial_no2:=_234422060144 tf.translation.x:=0.75 tf.translation.y:=0.575 tf.translation.z:=0.0 tf.rotation.yaw:=-91.25 tf.rotation.pitch:=0.75 tf.rotation.roll:=0.0
```

Loading