Giter VIP home page Giter VIP logo

ros2_intel_realsense's Introduction

DISCONTINUATION OF PROJECT

This project will no longer be maintained by Intel.

Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.

Intel no longer accepts patches to this project.

If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project.

Contact: [email protected]

ROS2 Wrapper for Intel® RealSense™ Devices

These are packages for using Intel RealSense cameras (D400 series) with ROS2.

Note: If you want T265 supported, please check out this branch

Installation Instructions

The following instructions were verified with ROS2 Dashing on Ubutnu 18.04.

Dependencies

Install ROS2 packages ros-dashing-desktop

Install ROS2 dependences

sudo apt-get install ros-dashing-cv-bridge ros-dashing-librealsense2 ros-dashing-message-filters ros-dashing-image-transport

Or you may install from sources:

Install Other non-ROS debian packages

sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
  • libssl-dev
  • libusb-1.0-0-dev
  • pkg-config
  • libgtk-3-dev
  • libglfw3-dev
  • libgl1-mesa-dev
  • libglu1-mesa-dev

Install ros2_intel_realsense binary packages

sudo apt-get install ros-dashing-realsense-camera-msgs ros-dashing-realsense-ros2-camera

The ros2_intel_realsense packages installation have been completed. You could jump to Usage Instructions for executing, you could also install ros2_intel_realsense from source for more features.

Install ros2_intel_realsense from source

#get code
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/intel/ros2_intel_realsense.git

#build
cd ~/ros2_ws
source /opt/ros/dashing/setup.bash
colcon build --base-paths src/ros2_intel_realsense

Usage Instructions

Start the camera node

To start the camera node in ROS2, plug in the camera, then type the following command:

source /opt/ros/dashing/setup.bash
source ~/ros2_ws/install/local_setup.bash
# To launch with "ros2 run"
ros2 run realsense_ros2_camera realsense_ros2_camera
# OR, to invoke the executable directly
realsense_ros2_camera

This will stream all camera sensors and publish on the appropriate ROS2 topics. PointCloud2 is enabled by default, till we provide ROS2 python launch options.

Published Topics

Rectified depth image: /camera/depth/image_rect_raw

Color image: /camera/color/image_raw

Rectified infra1 image: /camera/infra1/image_rect_raw

Rectified infra2 image: /camera/infra2/image_rect_raw

Depth registered point cloud: /camera/aligned_depth_to_color/color/points

Visualize Depth Aligned (i.e. Depth Registered) Point Cloud

To start the camera node in ROS2 and view the depth aligned pointcloud in rviz:

source /opt/ros/dashing/setup.bash
source ~/ros2_ws/install/local_setup.bash
# console #1 launch rviz2
ros2 run rviz2 rviz2 -d realsense_ros2_camera/rviz/ros2.rviz
# console #2 launch realsense_ros2_camera
ros2 run realsense_ros2_camera realsense_ros2_camera

This will launch RViz and display the five streams: color, depth, infra1, infra2, pointcloud.

realsense_ros2_camera visualization results

Run tests

colcon test --base-paths src/ros2_intel_realsense

Known Issues

  • This ROS2 node does not currently provide any dynamic reconfigure support for camera properties/presets.
  • We support Ubuntu Linux Bionic Beaver 18.04 on 64-bit, but not support Mac OS X 10.12 (Sierra) and Windows 10 yet.

Todo

A few features to be ported from the latest ROS realsense

  • Preset/Controls

License

Copyright 2018 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project 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.

*Other names and brands may be claimed as the property of others

Any security issue should be reported using process at https://01.org/security

ros2_intel_realsense's People

Contributors

ahuizxc avatar challenzhou avatar clalancette avatar dongx1x avatar nuclearsandwich avatar rachelren05 avatar rdower avatar sharronliu avatar xhuan28 avatar yechun1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ros2_intel_realsense's Issues

Running with enable_color=False results in not support pointscloud

When I run the node with a params file that sets enable_color=False, there was no result when run
ros2 topic echo /camera/depth/color/points

Here is the error message:

Cannot echo topic '/camera/depth/color/points', as it contains more than one type: [sensor_msgs/Image, sensor_msgs/PointCloud2]

build failed - intel realsense sdk is mssing..

I'm trying to build librealsense2 & realsense_ros2_camera.

whenever i build librealsense2 with local account, "permission denied" message about ld.so.cache is shown.
anyway, i ignored that message.

Problem is building realsense_ros2_camera.
If i install ros-crystal-librealsense2 package, build is ok.
but if i use librealsense2 from building source, i always see below message.
I built ros2 from source code. so i think i can't use debian package.

Please give me some advice.
Thanks.

--- stderr: realsense_ros2_camera
CMake Warning at CMakeLists.txt:53 (find_package):
By not providing "Findlibrealsense2.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"librealsense2", but CMake did not find one.

Could not find a package configuration file provided by "librealsense2"
with any of the following names:

librealsense2Config.cmake
librealsense2-config.cmake

Add the installation prefix of "librealsense2" to CMAKE_PREFIX_PATH or set
"librealsense2_DIR" to a directory containing one of the above files. If
"librealsense2" provides a separate development package or SDK, be sure it
has been installed.

CMake Error at CMakeLists.txt:55 (message):

Intel RealSense SDK 2.0 is missing, please install it from https://github.com/IntelRealSense/librealsense/releases


Failed <<< realsense_ros2_camera [ Exited with code 1 ]

Can't start second camera node

I'm running ROS2 eloquent on Ubuntu bionic the current refactor branch.

Steps to reproduce

Terminal 1:

ros2 run realsense_node realsense_node __params:=/path/to/d435i.yaml __ns:=/d435i

d435i.yaml

/d435i:
  camera:
    ros__parameters:
      serial_no: 845112070204 # d435i
      base_frame_id: d435i_link
      align_depth: true
      enable_pointcloud: false
      dense_pointcloud: false
      color0:
        enabled: true
        resolution: [640,480]
        fps: 30
      depth0:
        enabled: true
        resolution: [640,480]
        fps: 30
      infra1:
        enabled: false
        resolution: [640,480]
        fps: 30
      infra2:
        enabled: false
        resolution: [640,480]
        fps: 30
      accel0:
        enabled: true
      gyro0:
        enabled: true

This node runs without problems, I get this output:

[WARN] [rcl]: Found parameter file rule '__params:=/home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435i.yaml'. This syntax is deprecated. Use '--ros-args --params-file /home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435i.yaml' instead.
[WARN] [rcl]: Found remap rule '__ns:=/d435i'. This syntax is deprecated. Use '--ros-args --remap __ns:=/d435i' instead.
[INFO] [realsense.camera]: Device with serial number 845112070204 was found.
[INFO] [realsense.camera]: Create a node for D435i Camera

Terminal 2:

ros2 run realsense_node realsense_node __params:=/path/to/d435.yaml __ns:=/d435

d435.yaml

/d435:
  camera:
    ros__parameters:
      serial_no: 825312073597 # d435
      base_frame_id: d435_link
      align_depth: true
      enable_pointcloud: false
      dense_pointcloud: false
      color0:
        enabled: true
        resolution: [640,480]
        fps: 30
      depth0:
        enabled: true
        resolution: [640,480]
        fps: 30
      infra1:
        enabled: false
        resolution: [640,480]
        fps: 30
      infra2:
        enabled: false
        resolution: [640,480]
        fps: 30

This node fails to start. I get this output:

[WARN] [rcl]: Found parameter file rule '__params:=/home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435.yaml'. This syntax is deprecated. Use '--ros-args --params-file /home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435.yaml' instead.
[WARN] [rcl]: Found remap rule '__ns:=/d435'. This syntax is deprecated. Use '--ros-args --remap __ns:=/d435' instead.
[INFO] [realsense.camera]: Device with serial number 845112070204 was found.
[INFO] [realsense.camera]: Device with serial number 825312073597 was found.
[INFO] [realsense.camera]: Create a node for D4X5 Camera
terminate called after throwing an instance of 'rs2::backend_error'
  what():  xioctl(VIDIOC_S_FMT) failed Last Error: Device or resource busy

When I run the second node (the ones which fails) in gdb, I get this backtrace:

terminate called after throwing an instance of 'rs2::backend_error'
  what():  xioctl(VIDIOC_S_FMT) failed Last Error: Device or resource busy

Thread 10 "realsense_node" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd11d9700 (LWP 8847)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff6a82801 in __GI_abort () at abort.c:79
#2  0x00007ffff70d7957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff70ddae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff70ddb21 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff70ddd54 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7570300 in rs2::error::handle(rs2_error*) () from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#7  0x00007ffff7593bdf in rs2::pipeline_profile rs2::pipeline::start<std::_Bind<void (realsense::RealSenseBase::*(realsense::RealSenseBase*, std::_Placeholder<1>))(rs2::frame const&)> >(rs2::config const&, std::_Bind<void (realsense::RealSenseBase::*(realsense::RealSenseBase*, std::_Placeholder<1>))(rs2::frame const&)>) ()
   from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#8  0x00007ffff7584c81 in realsense::RealSenseBase::startPipeline() () from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#9  0x00007ffff756b94b in realsense::RealSenseNodeFactory::startDevice() () from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#10 0x00007ffff756a7c3 in realsense::RealSenseNodeFactory::init()::{lambda()#1}::operator()() const ()
   from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#11 0x00007ffff756ce57 in void std::__invoke_impl<void, realsense::RealSenseNodeFactory::init()::{lambda()#1}>(std::__invoke_other, realsense::RealSenseNodeFactory::init()::{lambda()#1}&&) () from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#12 0x00007ffff756cae2 in std::__invoke_result<realsense::RealSenseNodeFactory::init()::{lambda()#1}>::type std::__invoke<realsense::RealSenseNodeFactory::init()::{lambda()#1}>(std::__invoke_result&&, (realsense::RealSenseNodeFactory::init()::{lambda()#1}&&)...) ()
   from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#13 0x00007ffff756eca8 in decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<realsense::RealSenseNodeFactory::init()::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) () from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff756ec64 in std::thread::_Invoker<std::tuple<realsense::RealSenseNodeFactory::init()::{lambda()#1}> >::operator()() ()
   from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#15 0x00007ffff756ec34 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<realsense::RealSenseNodeFactory::init()::{lambda()#1}> > >::_M_run() ()
   from /home/mtr/ros/safety_field_detector_ws/install/realsense_ros/lib/librealsense_ros.so
#16 0x00007ffff71086df in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#17 0x00007ffff63e76db in start_thread (arg=0x7fffd11d9700) at pthread_create.c:463
#18 0x00007ffff6b6388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Point cloud doesn't work for D415 and Dashing

Followed instructions to start Rviz and D415:
ros2 run rviz2 rviz2 -d realsense_ros2_camera/rviz/ros2.rviz
and
ros2 run realsense_ros2_camera realsense_ros2_camera

All images are fine but no point cloud display, error message "could not transform [...frame] to [map]", see attached
Screenshot from 2019-10-18 08-51-43

Eloquent branch: Errors running node

Platform: Jetson Nano 18.04
Sensor: D435

I built a colcon workspace with:

  • ros2_intel_realsense (eloquent)
  • librealsense (master)

with ROS 2 Eloquent installed via debs.

I put the serial number into the d435.yml

Running ros2 run realsense_node realsense_node __params:=/home/jetson/dev/realsense_ws/src/ros2_intel_realsense/realsense_examples/config/d435.yaml __ns:=/d435
yields:

[WARN] [rcl]: Found parameter file rule '__params:=/home/jetson/dev/realsense_ws/src/ros2_intel_realsense/realsense_examples/config/d435.yaml'. This syntax is deprecated. Use '--ros-args --params-file /home/jetson/dev/realsense_ws/src/ros2_intel_realsense/realsense_examples/config/d435.yaml' instead.
[WARN] [rcl]: Found remap rule '__ns:=/d435'. This syntax is deprecated. Use '--ros-args --remap __ns:=/d435' instead.
[INFO] [d435.camera]: Device with serial number 752112070330 was found.
[INFO] [d435.camera]: Create a node for D4X5 Camera
terminate called after throwing an instance of 'rs2::error'
  what():  Couldn't resolve requests

and running ros2 launch realsense_examples rs_camera.launch.py yields:

[INFO] [launch]: All log files can be found below /home/jetson/.ros/log/2020-01-08-13-00-16-018285-jetson-1614
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense_node-1]: process started with pid [1630]
[realsense_node-1] terminate called after throwing an instance of 'rs2::invalid_value_error'
[realsense_node-1]   what():  hwmon command 0x10 failed. Error type:  (1).
[ERROR] [realsense_node-1]: process has died [pid 1630, exit code -6, cmd '/home/jetson/dev/realsense_ws/install/realsense_node/lib/realsense_node/realsense_node --ros-args'].

typo in readme

ros2 run realsense_ros2_camera realsenes_ros2_camera
should be:
ros2 run realsense_ros2_camera realsense_ros2_camera

ros2 realsense segfault error with fastrtps

Running ros2 realsense with librealsense v2.19.1 with the following error:

realsense_ros2_[6797]: segfault at 10 ip 00007f0acac83a95 sp 00007f0ac3ffdb70 error 4 in libfastrtps.so.1.7.1[7f0acab6b000+42c000]

Failed to load entry point 'status': librmw.so when running the ROS2 launch file

Required Info  
Camera Model D415
Firmware Version 05.09.11.00
Operating System & Version Ubuntu 16.04
Kernel Version (Linux Only) 4.13.0-43-generic
Platform PC
SDK Version 2.11.1

Issue Description
Follow below instructions to build, but it's failed to launch as you can see below error. any idea to resolve this?
https://github.com/intel/ros2_intel_realsense
$ ros2 run realsense_ros2_camera realsense_ros2_camera
Failed to load entry point 'status': librmw.so: cannot open shared object file: No such file or directory
The C extension '/opt/ros/ardent/lib/python3.5/site-packages/rclpy/_rclpy.cpython-35m-x86_64-linux-gnu.so' failed to be imported while being present on the system. Please refer to 'https://github.com/ros2/ros2/wiki/Rclpy-Import-error-hint' for possible solutions
Failed to load entry point 'stop': librmw.so: cannot open shared object file: No such file or directory
The C extension '/opt/ros/ardent/lib/python3.5/site-packages/rclpy/_rclpy.cpython-35m-x86_64-linux-gnu.so' failed to be imported while being present on the system. Please refer to 'https://github.com/ros2/ros2/wiki/Rclpy-Import-error-hint' for possible solutions

当realsense_ros2_camera和rviz2分开启动时,不会发布TF tree

ros2 launch realsense_ros2_camera ros2_intel_realsense.launch.py
在launch中启动realsense_ros2_camera和rviz2是正常的,但是把launch中启动rviz2部分注释掉,只启动realsense_ros2_camera,手动启动Rviz2就不会有TF tree了。因为我需要配置camera和机器人底盘的坐标关系,没有camera各个镜头的TF tree是很麻烦的。

Errors when pressed Ctrl+C

To reproduce the error -

  1. $ ros2 launch realsense_ros2_camera ros2_intel_realsense.launch.py
  2. While the node is running, hit Ctrl+C

[rcutils|error_handling.c:106] rcutils_set_error_state()
This error state is being overwritten:
'rcl node's context is invalid, at /home/lkumarbe/ros2_ws/src/ros2/rcl/rcl/src/rcl/node.c:531'
with this new error message:
'publisher's context is invalid, at /home/lkumarbe/ros2_ws/src/ros2/rcl/rcl/src/rcl/publisher.c:313'
rcutils_reset_error() should be called after error handling to avoid this.
<<<

'refactor' branch use case

I see the refactor branch was added a few weeks ago with some significant changes to the node. Is there some documentation on new features that have been added and how to build the branch?

exception thrown during user callback

When I publish my D435 image data on computer A and subscribe to that data on computer B, I get the following error message in the terminal of the publisher.

(source.cpp:127) Exception was thrown during user callback!

And running gdb and breaking on caught exceptions yields me this as the source of that error message

librealsense::frame_source::invoke_callback(librealsense::frame_holder) const () from /opt/ros/dashing/lib/librealsense2.so.2

I still get frames from the camera, but I would really like to know why the realsense lib is complaining when I'm on two separate computers.

I also posted this question here:
https://answers.ros.org/question/327439/ros2-realsense2-subscribing-to-raw-camera-from-different-computer-throws-exceptions/
But I believe that was the wrong place for it.

not launch,rviz folders with debian instalation in 18.04

i installed via debian pkg, I can run the node of the example, but when I run the launch.py from the example,cant find it and it aim to a directory in the error msg. nothing there. I copied the folders manually from the source and it looks work, but Im not sure.

Many SDK parameters are missing or not exposed in ROS2

As compared to the ROS1 wrapper for the realsense, many of the original parameters for the SDK remain missing or not exposed as dynamic or runtime parameters in ROS2. For example, the boolean options for enabling/disabling the IR projector are not made available, making it inconvenient to use the stereo IR stream for visual inertial SLAM.

https://github.com/IntelRealSense/realsense-ros/blob/88f73074ba00c7826c9e48249b33237b54d78ea5/realsense2_camera/launch/rs_rgbd.launch#L96

align_depth: false
enable_pointcloud: true
dense_pointcloud: true

Experiencing lower frame rate than requested

Hi,

I'm using:
librealsense commit master e5d51792182a71f47fa87e086fa46a9b778a06e8
ros2_intel_realsense commit master 31cdfb7
ROS 2.0 Dashing
Ubuntu 18.04

I have tried both compiling from source and installing through debian.

How to replicate:
Terminal 1: ros2 run realsense_ros2_camera realsense_ros2_camera.
Terminal 2: ros2 topic hz /camera/color/image_raw.

By default, the driver is supposed to produce images at 30fps.
However, the output at terminal 2 shows frequency lower than that. I've tried in the 3 different protocols:
FastRTPS - ~8-10Hz
OpenSplice - ~15-17Hz
RTI Connext - ~18-20Hz

I'm not sure if this is related to the driver, or an inherent ROS2 problem.

Running with enable_depth=False results in shutdown

When I run the node with a params file that sets enable_depth=False, I get a shutdown:

mkhansen@mkhansen-desk:~/rap_framework$ ros2 run realsense_ros2_camera realsense_ros2_camera __params:=realsense_params.yaml 
[INFO] [RealSenseCameraNode]: RealSense ROS v2. 0.1
[INFO] [RealSenseCameraNode]: Running with LibRealSense v2.16.5
[INFO] [RealSenseCameraNode]: getParameters...
[INFO] [RealSenseCameraNode]: setupDevice...
[INFO] [RealSenseCameraNode]: Device Name: Intel RealSense D415
[INFO] [RealSenseCameraNode]: Device Serial No: 725112060242
[INFO] [RealSenseCameraNode]: Device FW version: 05.08.05.00
[INFO] [RealSenseCameraNode]: Device Product ID: 0AD3
[INFO] [RealSenseCameraNode]: Sync Mode: On
[INFO] [RealSenseCameraNode]: Device Sensors: 
[INFO] [RealSenseCameraNode]: Stereo Module was found.
[INFO] [RealSenseCameraNode]: RGB Camera was found.
[INFO] [RealSenseCameraNode]: Fisheye sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: Gyro sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: Accel sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: setupPublishers...
[INFO] [RealSenseCameraNode]: setupStreams...
[INFO] [RealSenseCameraNode]: color stream is enabled - width: 640, height: 480, fps: 30
[ERROR] [RealSenseCameraNode]: Depth profile not found!

Here is the params file:

mkhansen@mkhansen-desk:~/rap_framework$ cat realsense_params.yaml 
RealSenseCameraNode:
  ros__parameters:
    enable_depth: False
    enable_infra1: False
    enable_infra2: False
mkhansen@mkhansen-desk:~/rap_framework$ 

This seems to be traced to these lines of code (703-706, 799-802):

if (!getEnabledProfile(DEPTH, depth_profile)) {

realsense_ros exception when launching T265

We've been struggling with an exception thrown trying to start our T265 camera

Issue: Whats really wierd is our D435i starts fine but when the T265 starts, we get this exception:

$ ros2 run realsense_node realsense_node --ros-args -p serial_no:=908412110938
[INFO] [camera]: Device with serial number 908412110938 was found.
[INFO] [camera]: Create a node for T265 Camera
terminate called after throwing an instance of 'rs2::error'
  what():  No device connected

Our setup:
ros2 eloquent from repos
ros2_intel_realsense : branch eloquent
librealsense2 from repos at 2.34.0

Troubleshooting
Trouble persists with branch refactor
Same Node is able to start a D435i
realsense-viewer/rs-enumerate-devices is able to stream/enumerate device

Copy of stack trace

1  raise                                                                                                                                                                  0x7ffff3c4be97 
2  abort                                                                                                                                                                  0x7ffff3c4d801 
3  ??                                                                                                                                                                     0x7ffff4640957 
4  ??                                                                                                                                                                     0x7ffff4646ae6 
5  std::terminate()                                                                                                                                                       0x7ffff4646b21 
6  __cxa_throw                                                                                                                                                            0x7ffff4646d54 
7  rs2::error::handle                                                                                                                                 rs_types.hpp    156 0x555555582bee 
8  rs2::config::resolve                                                                                                                               rs_pipeline.hpp 321 0x55555559c529 
9  realsense::RealSenseBase::startPipeline                                                                                                            rs_base.cpp     58  0x55555558fb7b 
10 realsense::RealSenseNodeFactory::startDevice                                                                                                       rs_factory.cpp  99  0x55555557e36a 
11 realsense::RealSenseNodeFactory::<lambda()>::operator()(void) const                                                                                rs_factory.cpp  61  0x55555557d1c7 
12 std::__invoke_impl<void, realsense::RealSenseNodeFactory::init()::<lambda()>>(std::__invoke_other, realsense::RealSenseNodeFactory::<lambda()> &&) invoke.h        60  0x55555557f877 
13 std::__invoke<realsense::RealSenseNodeFactory::init()::<lambda()>>(realsense::RealSenseNodeFactory::<lambda()> &&)                                 invoke.h        95  0x55555557f502 
14 std::thread::_Invoker<std::tuple<realsense::RealSenseNodeFactory::init()::<lambda()>>>::_M_invoke<0>(std::_Index_tuple<0>)                         thread          234 0x5555555816c8 
15 std::thread::_Invoker<std::tuple<realsense::RealSenseNodeFactory::init()::<lambda()>>>::operator()(void)                                           thread          243 0x555555581684 
16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<realsense::RealSenseNodeFactory::init()::<lambda()>>>>::_M_run(void)                     thread          186 0x555555581654 
17 ??                                                                                                                                                                     0x7ffff46716df 
18 start_thread                                                                                                                                                           0x7ffff4d7f6db 
19 clone                                                                                                                                                                  0x7ffff3d2e88f 

Issue seems to be here:

pipeline_profile resolve(std::shared_ptr<rs2_pipeline> p) const
       {
           rs2_error* e = nullptr;
           auto profile = std::shared_ptr<rs2_pipeline_profile>(
               rs2_config_resolve(_config.get(), p.get(), &e),
               rs2_delete_pipeline_profile);

           error::handle(e);
           return pipeline_profile(profile);
       }

Build Error - Intel RealSense SDK 2.0 is missing

lkumarbe@intel:~/ros2_ws/src$ git clone https://github.com/intel/ros2_intel_realsense.git

Cloning into 'ros2_intel_realsense'...
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 231 (delta 47), reused 75 (delta 43), pack-reused 145
Receiving objects: 100% (231/231), 933.45 KiB | 498.00 KiB/s, done.
Resolving deltas: 100% (107/107), done.

lkumarbe@intel:~/ros2_ws/src$ ls

ament image_common ros ros2_intel_movidius_ncs ros2_object_analytics ros-perception ros-visualization
eProsima osrf ros2 ros2_intel_realsense ros2_object_msgs ros-planning vision_opencv

lkumarbe@intel:~/ros2_ws/src$ cd ..
lkumarbe@intel:~/ros2_ws$ source install/local_setup.bash
lkumarbe@intel:~/ros2_ws$ colcon build --base-paths src/ros2_intel_realsense

Starting >>> realsense_camera_msgs
Finished <<< realsense_camera_msgs [5.67s]
Starting >>> realsense_ros2_camera
--- stderr: realsense_ros2_camera
CMake Warning at CMakeLists.txt:52 (find_package):
By not providing "Findlibrealsense2.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"librealsense2", but CMake did not find one.
Could not find a package configuration file provided by "librealsense2"
with any of the following names:
librealsense2Config.cmake
librealsense2-config.cmake
Add the installation prefix of "librealsense2" to CMAKE_PREFIX_PATH or set
"librealsense2_DIR" to a directory containing one of the above files. If
"librealsense2" provides a separate development package or SDK, be sure it
has been installed.
CMake Error at CMakeLists.txt:54 (message):
Intel RealSense SDK 2.0 is missing, please install it from https://github.com/IntelRealSense/librealsense/releases ---
Failed <<< realsense_ros2_camera [ Exited with code 1 ]
Summary: 1 package finished [5.82s]
1 package failed: realsense_ros2_camera
1 package had stderr output: realsense_ros2_camera

I have installed librealsense2 SDK from debian following the instructions from here

lkumarbe@intel:~/ros2_ws$ modinfo uvcvideo | grep "version:"

version: 1.1.2.realsense-1.3.4
srcversion: C4FB5E9B212E9C39ED6CD7C

build error with ros2 eloquent

I believe it is a typo in CMakeList.txt. Could someone fix this?

--- stderr: realsense_ros
CMake Error at /home/intel/workspace/ros2_eloquent/install/ament_cmake_target_dependencies/share/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake:52 (message):
ament_target_dependencies() the passed package name 'rclcpp_componets' was
not found before
Call Stack (most recent call first):
CMakeLists.txt:165 (ament_target_dependencies)
CMakeLists.txt:180 (custom_gtest)

Time Stamp issue when system with heavy load

When launch RealSense node with other modules, the time interval is not stable and the frames sometimes out of order, log as below:

Timestamp interval: 33.388916
Timestamp interval: 33.354736
Timestamp interval: 33.381836
Timestamp interval: 33.323975
Timestamp interval: 33.374756
Timestamp interval: 133.653320
Timestamp interval: -100.312744
Timestamp interval: 155.536621
Timestamp interval: -122.171387
Timestamp interval: 33.446777
Timestamp interval: 99.965576
Timestamp interval: 33.382324
Timestamp interval: 66.683838
Timestamp interval: 33.668457
Timestamp interval: -66.988770
Timestamp interval: 100.058594
Timestamp interval: 53.513428
Timestamp interval: 49.924805
Timestamp interval: 38.312012
Timestamp interval: 0.833740
Timestamp interval: 24.228760
Timestamp interval: 33.336182

ROS2 topic names align with ROS

Keep topic names alignment with ROS version.
topic for xyz pointcloud: "/camera/aligned_depth_to_color/color/points"
expected: "/camera/points" as suggested in section 2.3 here

image_transport colcon build error

ubuntu 18.04
I was successfully Installed ROS2 via Debian Packages by the link
https://index.ros.org/doc/ros2/Linux-Install-Debians/

when I tried to colcon build image_transport package,I got errors, thanks for any helps.

$ cd ~/ros2_ws/src
$ git clone https://github.com/ros-perception/image_common.git
$ git checkout ros2
$ cd ~/ros2_ws
$ colcon build --base-paths src/image_common/image_transport

u@u-OptiPlex-9020:~/ros2_ws$ colcon build --base-paths src/image_common/image_transport
Starting >>> image_transport
--- stderr: image_transport
In file included from /opt/ros/bouncy/include/rclcpp/service.hpp:33:0,
from /opt/ros/bouncy/include/rclcpp/callback_group.hpp:24,
from /opt/ros/bouncy/include/rclcpp/node.hpp:36,
from /home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h:38,
from /home/u/ros2_ws/src/image_common/image_transport/include/image_transport/raw_publisher.h:39,
from /home/u/ros2_ws/src/image_common/image_transport/src/manifest.cpp:36:
/home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h: In member function ‘virtual void image_transport::SimplePublisherPlugin::publish(const Image&) const’:
/opt/ros/bouncy/include/rclcpp/logging.hpp:362:83: error: type/value mismatch at argument 1 in template parameter list for ‘template<class, class> struct std::is_same’
::std::is_same<std::remove_reference<decltype(logger)>::type, ::rclcpp::Logger>::value,
^
/home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h:91:7: note: in expansion of macro ‘RCLCPP_ERROR’
RCLCPP_ERROR(simple_impl_->logger_,
^~~~~~~~~~~~
/opt/ros/bouncy/include/rclcpp/logging.hpp:362:83: note: expected a type, got ‘std::remove_reference<decltype (((const image_transport::SimplePublisherPlugin)this)->image_transport::SimplePublisherPlugin::simple_impl_->logger_)>::type’
::std::is_same<std::remove_reference<decltype(logger)>::type, ::rclcpp::Logger>::value,
^
/home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h:91:7: note: in expansion of macro ‘RCLCPP_ERROR’
RCLCPP_ERROR(simple_impl_->logger_,
^~~~~~~~~~~~
/home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h: In member function ‘virtual void image_transport::SimplePublisherPlugin::advertiseImpl(rclcpp::Node, const string&, rmw_qos_profile_t)’:
/opt/ros/bouncy/include/rclcpp/logging.hpp:68:83: error: type/value mismatch at argument 1 in template parameter list for ‘template<class, class> struct std::is_same’
::std::is_same<std::remove_reference<decltype(logger)>::type, ::rclcpp::Logger>::value,
^
/home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h:112:5: note: in expansion of macro ‘RCLCPP_DEBUG’
RCLCPP_DEBUG(simple_impl_->logger_, "getTopicToAdvertise: %s", transport_topic.c_str());
^~~~~~~~~~~~
/opt/ros/bouncy/include/rclcpp/logging.hpp:68:83: note: expected a type, got ‘std::remove_reference<decltype (((image_transport::SimplePublisherPlugin*)this)->image_transport::SimplePublisherPlugin::simple_impl_->logger_)>::type’
::std::is_same<std::remove_reference<decltype(logger)>::type, ::rclcpp::Logger>::value,
^
/home/u/ros2_ws/src/image_common/image_transport/include/image_transport/simple_publisher_plugin.h:112:5: note: in expansion of macro ‘RCLCPP_DEBUG’
RCLCPP_DEBUG(simple_impl_->logger_, "getTopicToAdvertise: %s", transport_topic.c_str());
^~~~~~~~~~~~
make[2]: *** [CMakeFiles/image_transport_plugins.dir/src/manifest.cpp.o] Error 1
make[1]: *** [CMakeFiles/image_transport_plugins.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2

Failed <<< image_transport [ Exited with code 2 ]

Summary: 0 packages finished [12.6s]
1 package failed: image_transport
1 package had stderr output: image_transport

port aligned depth images from intel-ros/realsense

@dorodnic @sharronliu
We are developing ros2_object_analytics which use intel/ros2_intel_realsense as dependence.We require a feature "publish aligned depth images" from realsense package. As we checked intel-ros/realsense 2.0.2 had already supported publishing aligned frames feature. But ros2_intel_realsense not merged that code, it just ported based on https://github.com/intel-ros/realsense/tree/2.0.1, and have no any updates. May I ask if you have any plan to port latest intel-ros/realsense code to ros2_intel_realsense?

For immediate usage, I could also contribute on porting 2.0.2 to enable aligned depth images from realsense to ros2 realsense. Do you have any suggestion? Thanks.

node crash on startup

This node crashes on startup around 50% of the time for me.
The backtraces on each crash are all over the place, sometimes when discovering the camera, sometimes when receiving a frame. IntelRealSense/librealsense#4158 might be related, but I don't want to spend the cycles figuring out how to replace rs2::pipeline from the node

Starting a D435 and a D435i camera fails

OS Ubuntu Bionic
Hardware UP2 board
ROS2 version eloquent
ros2_intel_realsense branch refactor

I try to start two realsense nodes and another node. When I start them as composable nodes with:

import launch
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch.substitutions import LaunchConfiguration
from ament_index_python import get_package_share_directory


def generate_launch_description():
    """Generate launch description with multiple components."""

    # config the serial number and base frame id of each camera
    d435_base_frame_id = LaunchConfiguration('base_frame_id', default='d435_link')
    d435_serial_no = LaunchConfiguration('serial_no', default='825312073597')
    
    d435i_base_frame_id = LaunchConfiguration('base_frame_id', default='d435i_link')
    d435i_serial_no = LaunchConfiguration('serial_no', default='841512070768')

    container = ComposableNodeContainer(
            node_name='safety_field_intrusion_detection',
            node_namespace='',
            package='rclcpp_components',
            node_executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='realsense_ros',
                    node_plugin='realsense::RealSenseNodeFactory',
                    node_name='D435',
                    node_namespace='/realsense',
                    parameters=[
                        {'serial_no': d435_serial_no,
                         'base_frame_id': d435_base_frame_id}
                    ]),
                ComposableNode(
                    package='realsense_ros',
                    node_plugin='realsense::RealSenseNodeFactory',
                    node_name='D435i',
                    node_namespace='/realsense',
                    parameters=[
                        {'serial_no': d435i_serial_no,
                         'base_frame_id': d435i_base_frame_id}
                    ]),
                ComposableNode(
                    package='safety-field-intrusion-detector-ros',
                    node_plugin='DetectorRobotComponent',
                    node_name='safety_field_intrusion_detector',
                    parameters=[
                        get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/params.yaml"
                    ])
            ],
            output='screen',
    )

    return launch.LaunchDescription([container])

I get the following output:

[INFO] [launch]: All log files can be found below /home/mtr/.ros/log/2020-05-11-09-13-46-695913-mtr-UP-APL01-7685
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [7696]
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/realsense/D435' in container '/safety_field_intrusion_detection'
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/realsense/D435i' in container '/safety_field_intrusion_detection'
[component_container-1] [WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/safety_field_intrusion_detection' in container '/safety_field_intrusion_detection'
[component_container-1] terminate called after throwing an instance of 'rs2::error'
[component_container-1]   what():  Couldn't resolve requests
[ERROR] [component_container-1]: process has died [pid 7696, exit code -6, cmd '/opt/ros/eloquent/lib/rclcpp_components/component_container --ros-args -r __node:=safety_field_intrusion_detection'].

When I start them with:

import os
import launch
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import ThisLaunchFileDir
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode

def generate_launch_description():

    # config the serial number and base frame id of each camera
    d435_base_frame_id = LaunchConfiguration('base_frame_id', default='d435_link')
    d435_serial_no = LaunchConfiguration('serial_no', default='825312073597')
    
    d435i_base_frame_id = LaunchConfiguration('base_frame_id', default='d435i_link')
    d435i_serial_no = LaunchConfiguration('serial_no', default='841512070768')

    d435_node = Node(
        package='realsense_node',
        node_namespace='/realsense',
        node_executable='realsense_node',
        output='screen',
        parameters=[
            {'serial_no': d435_serial_no,
             'base_frame_id': d435_base_frame_id}
            #get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/d435.yaml"
        ])
    d435i_node = Node(
        package='realsense_node',
        node_namespace='/realsense',
        node_executable='realsense_node',
        output='screen',
        parameters=[
            {'serial_no': d435i_serial_no,
             'base_frame_id': d435i_base_frame_id}
            #get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/d435i.yaml"
        ])
    detector_node = Node(
        package='safety-field-intrusion-detector-ros',
        node_executable='mt-detector-robot-node',
        node_name='safety_field_intrusion_detector',
        parameters=[
            get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/params.yaml"
        ])

    return launch.LaunchDescription([d435_node, d435i_node, detector_node])

I get the following output:

[INFO] [launch]: All log files can be found below /home/mtr/.ros/log/2020-05-11-09-13-11-986002-mtr-UP-APL01-5750
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense_node-1]: process started with pid [5761]
[INFO] [realsense_node-2]: process started with pid [5762]
[INFO] [mt-detector-robot-node-3]: process started with pid [5763]
[realsense_node-1] terminate called after throwing an instance of 'rs2::error'
[realsense_node-1]   what():  Couldn't resolve requests
[ERROR] [realsense_node-1]: process has died [pid 5761, exit code -6, cmd '/home/mtr/ros/safety_field_detector_ws/install/realsense_node/lib/realsense_node/realsense_node --ros-args --params-file /tmp/launch_params_vvxtb6v1 -r __ns:=/realsense'].

Only if I start them from a bash script with:

ros2 run realsense_node realsense_node __params:=`ros2 pkg prefix safety-field-intrusion-detector-ros`/share/safety-field-intrusion-detector-ros/config/d435i.yaml __ns:=/realsense & \
ros2 run realsense_node realsense_node __params:=`ros2 pkg prefix safety-field-intrusion-detector-ros`/share/safety-field-intrusion-detector-ros/config/d435.yaml __ns:=/realsense & \
ros2 run safety-field-intrusion-detector-ros mt-detector-robot-node

the nodes start successfully.

[WARN] [rcl]: Found parameter file rule '__params:=/home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435.yaml'. This syntax is deprecated. Use '--ros-args --params-file /home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435.yaml' instead.
[WARN] [rcl]: Found remap rule '__ns:=/realsense'. This syntax is deprecated. Use '--ros-args --remap __ns:=/realsense' instead.
[WARN] [rcl]: Found parameter file rule '__params:=/home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435i.yaml'. This syntax is deprecated. Use '--ros-args --params-file /home/mtr/ros/safety_field_detector_ws/install/safety-field-intrusion-detector-ros/share/safety-field-intrusion-detector-ros/config/d435i.yaml' instead.
[WARN] [rcl]: Found remap rule '__ns:=/realsense'. This syntax is deprecated. Use '--ros-args --remap __ns:=/realsense' instead.
[INFO] [realsense.camera]: Device with serial number 825312073597 was found.
[INFO] [realsense.camera]: Device with serial number 825312073597 was found.
[INFO] [realsense.camera]: Create a node for D4X5 Camera
[INFO] [realsense.camera]: Device with serial number 841512070768 was found.
[INFO] [realsense.camera]: Create a node for D435i Camera

Technically it is not a problem to use a bash script to start the nodes but I want to do it the proper way in ROS2 which is via launch file.

ROS2 eloquent: build fails. module 'em' has no attribute 'Interpreter'

It would be really nice if ROS2 Eloquent (stable release) would officialy be supported, #94 .

So far the recommended ways are building from source from refactor or eloquent branches.

I used to be able to build this way, #95 , but I started getting an error now:

Starting >>> realsense_msgs
-- Found ament_cmake: 0.8.2 (/opt/ros/eloquent/share/ament_cmake/cmake)
-- Found PythonInterp: /home_shared/mmm/miniconda3/envs/ros2/bin/python3 (found suitable version "3.6.7", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /home_shared/mmm/miniconda3/envs/ros2/bin/python3
-- Override CMake install command with custom implementation using symlinks instead of copying resources
-- Found rosidl_default_generators: 0.8.0 (/opt/ros/eloquent/share/rosidl_default_generators/cmake)
-- Found rosidl_adapter: 0.8.2 (/opt/ros/eloquent/share/rosidl_adapter/cmake)
-- Found std_msgs: 0.8.1 (/opt/ros/eloquent/share/std_msgs/cmake)
-- Found PythonInterp: /home_shared/mmm/miniconda3/envs/ros2/bin/python3 (found version "3.6.7") 
CMake Error at /opt/ros/eloquent/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:60 (message):
execute_process(/home_shared/mmm/miniconda3/envs/ros2/bin/python3 -m
rosidl_adapter --package-name realsense_msgs --arguments-file
/home_shared/mmm/ros2_ws/build/realsense_msgs/rosidl_adapter__arguments__realsense_msgs.json
--output-dir
/home_shared/mmm/ros2_ws/build/realsense_msgs/rosidl_adapter/realsense_msgs
--output-file
/home_shared/mmm/ros2_ws/build/realsense_msgs/rosidl_adapter/realsense_msgs.idls)
returned error code 1:

AttributeError processing template 'msg.idl.em'

Traceback (most recent call last):

File "/opt/ros/eloquent/lib/python3.6/site-packages/rosidl_adapter/resource/__init__.py", line 48, in evaluate_template
_interpreter = em.Interpreter(

AttributeError: module 'em' has no attribute 'Interpreter'

This happens on both (eloquent, refactor) branches, with gcc (7.x, 8.4), Ubuntu 18.04 LTS.

Add linear interpolation union method for IMU

This ROS2 package for the realsense is missing valuable feature parity with that of ROS1: allowing for the union of the accelerometer and gyro measurements to be linear interpolated for publishing to a single /imu topic. It'd be nice if we could include this so that the ROS2 driver could be used for existing VIO and tracking applications and package.

Related: IntelRealSense/realsense-ros#558

Change prefix of camera optical and depth frames in refactor branch

Hi,
I can not find any parameter to change the prefix for the frames on the refactor branch. When launching with two D435 cameras, both camera links, defined with base_frame_id, have the child frames camera_color_optical_frame and camera_depth_optical_frame, and it is not possible to separate these. Is there any way to change the prefix of the frames? I am using ROS2 Eloquent.

Add support for sensor_msg.CompressedImage

CvBridge and ROS sensor_msg support CompressedImage.
Is it possible to use (add) that to the topics?

In our use-case we have to be cautious of datathroughput.
Thank you

Not supported on Mac

Now that the main RealSense library is getting more mature on Mac, can we get the ros2 library also running on Mac? Specifically, the 2.21 version of librealsense supports the T265 on the Mac - how about on Ros2 on the Mac?

Multi-camera support.

Hi, all
I use two D435 cameras on ubuntu, and can't launch them successfully.

bowen@amp3:~/workspace/depthimage_to_laserscan[(HEAD detached at origin/dashing-devel)*]$ ros2 launch rs_multiple_devices.launch.py
[INFO] [launch]: All log files can be found below /home/bowen/.ros/log/2020-03-16-17-45-44-976443-amp3-13582
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense_node-1]: process started with pid [13599]
[INFO] [realsense_node-2]: process started with pid [13600]
[realsense_node-1] terminate called after throwing an instance of 'rs2::backend_error'
[realsense_node-1]   what():  xioctl(VIDIOC_S_FMT) failed Last Error: Device or resource busy
[ERROR] [realsense_node-1]: process has died [pid 13599, exit code -6, cmd '/opt/robot_devkit/perception/realsense_node/lib/realsense_node/realsense_node __ns:=/camera1 __params:=/tmp/launch_params_wm115vow'].

I specify two serial number for cameras in script as bellows:

def generate_launch_description():
    # config the serial number and base frame id of each camera
    camera1_base_frame_id = LaunchConfiguration('base_frame_id', default='camera1_link')
    camera2_base_frame_id = LaunchConfiguration('base_frame_id', default='camera2_link')
    camera1_serial_no = LaunchConfiguration('serial_no', default='937422070858')
    camera2_serial_no = LaunchConfiguration('serial_no', default='938422073729')


    camera1_node = Node(
        package='realsense_node',
        node_executable='realsense_node',
        node_namespace="/camera1",
        output='screen',
        parameters=[{'serial_no':camera1_serial_no, 
                    'base_frame_id': camera1_base_frame_id}]
        )
    camera2_node = Node(
        package='realsense_node',
        node_executable='realsense_node',
        node_namespace="/camera2",
        output='screen',
        parameters=[{'serial_no':camera2_serial_no, 
                    'base_frame_id': camera2_base_frame_id}]
        )
    return launch.LaunchDescription([camera1_node, camera2_node])

The system config is as bellow:

Ubuntu 18.04.3 LTS \n \l
5.3.0-40-generic
realsense-ros: commit e41d491a1cbdb0c4529a651adbc45693db99bd01 (HEAD, origin/refactor)
librealsense version:2.32.1-0~realsense0.1913

@sharronliu, @ahuizxc, & @yechun1 Will you help have a look at this?

unexpected frame id for "/camera/aligned_depth_to_color/color/points"

When depth frame is aligned to color camera, the frame id suppose to keep same as a color frame. Please can you check?
See below outputs:
sharron@nuc6-u1804:~/workspace/views/ros2$ ros2 topic echo /camera/aligned_depth_to_color/color/points
header:
stamp:
sec: 1551932588
nanosec: 73540995
frame_id: camera_depth_optical_frame
height: 480
width: 640

infra1 and infra2 topics - where is this images from?

Hi.
A little (maybe) off-topic question, but I am wondering what images are published to the topics:
Rectified infra1 image: /camera/infra1/image_rect_raw
Rectified infra2 image: /camera/infra2/image_rect_raw

Is this the images from the Left and Right Imager on the camera (HD image sensors) or is it from the IR projector?
I guess i am confused because they are named infra, so it sounds like it is an image from the infrared projector, but at the same time, there are two of them?

I tried to look for documentation of this somewhere, but I could not find any. Thanks

Installing Intel® RealSense™ SDK from source still needs to install dependencies first

When I tried to get Intel® RealSense™ SDK from source, colcon build occurred error:
Starting >>> realsense_camera_msgs --- stderr: librealsense2 CMake Error at /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:645 (message): None of the required 'libusb-1.0' found Call Stack (most recent call first): CMake/unix_config.cmake:41 (pkg_search_module) CMakeLists.txt:47 (os_target_config) CMake Error at CMake/unix_config.cmake:47 (message): Failed to find libusb-1.0 Call Stack (most recent call first): CMakeLists.txt:47 (os_target_config)

Install the following dependencies to resolve the issue :
sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

Can't start more than one camera node as ComposableNode

After being able to start two cameras as nodes (#119) I want to start the two camera nodes from a launch file as ComposableNode to allow inter-process communication.

Running the following launch file

import launch
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch.substitutions import LaunchConfiguration
from ament_index_python import get_package_share_directory


def generate_launch_description():
    """Generate launch description with multiple components."""

    # config the serial number and base frame id of each camera
    d435_base_frame_id = LaunchConfiguration('base_frame_id', default='camera1_link')

    d435_serial_no = LaunchConfiguration('serial_no', default='837212070294')

    container = ComposableNodeContainer(
            node_name='safety_field_intrusion_detection',
            node_namespace='',
            package='rclcpp_components',
            node_executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='realsense_ros',
                    node_plugin='realsense::RealSenseNodeFactory',
                    node_name='d435',
                    node_namespace='/d435',
                    parameters=[
                        get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/d435.yaml"
                ]),
                ComposableNode(
                    package='realsense_ros',
                    node_plugin='realsense::RealSenseNodeFactory',
                    node_name='d435i',
                    node_namespace='/d435i',
                    parameters=[
                        get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/d435i.yaml"
                ]),
                ComposableNode(
                    package='safety-field-intrusion-detector-ros',
                    node_plugin='SafetyFieldIntrusionDetectorBaseNode',
                    node_name='safety_field_intrusion_detector',
                    parameters=[
                        get_package_share_directory('safety-field-intrusion-detector-ros')+"/config/params.yaml"
                ])
            ],
            output='screen',
    )

    return launch.LaunchDescription([container])

with d435.yaml

/d435:
  camera:
    ros__parameters:
      serial_no: 825312073597 # d435
      base_frame_id: d435_link
      align_depth: true
      enable_pointcloud: false
      dense_pointcloud: false
      color0:
        enabled: true
        resolution: [640,480]
        fps: 30
      depth0:
        enabled: true
        resolution: [640,480]
        fps: 30
      infra1:
        enabled: false
        resolution: [640,480]
        fps: 30
      infra2:
        enabled: false
        resolution: [640,480]
        fps: 30

and d435i.yaml

/d435i:
#realsense/d435i:
#/d435i:
  camera:
    ros__parameters:
      serial_no: 845112070204 # d435i
      base_frame_id: d435i_link
      align_depth: true
      enable_pointcloud: false
      dense_pointcloud: false
      color0:
        enabled: true
        resolution: [640,480]
        fps: 30
      depth0:
        enabled: true
        resolution: [640,480]
        fps: 30
      infra1:
        enabled: false
        resolution: [640,480]
        fps: 30
      infra2:
        enabled: false
        resolution: [640,480]
        fps: 30
      accel0:
        enabled: true
      gyro0:
        enabled: true

gives this output

[INFO] [launch]: All log files can be found below /home/mtr/.ros/log/2020-04-02-10-34-10-493702-UP2-board-17377
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [17388]
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/realsense/D435' in container '/safety_field_intrusion_detection'
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/realsense/D435i' in container '/safety_field_intrusion_detection'
[component_container-1] [WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/safety_field_intrusion_detection' in container '/safety_field_intrusion_detection'
[component_container-1] terminate called after throwing an instance of 'rs2::backend_error'
[component_container-1]   what():  xioctl(VIDIOC_S_FMT) failed Last Error: Device or resource busy
[ERROR] [component_container-1]: process has died [pid 17388, exit code -6, cmd '/opt/ros/eloquent/lib/rclcpp_components/component_container --ros-args -r __node:=safety_field_intrusion_detection'].

or

[INFO] [launch]: All log files can be found below /home/mtr/.ros/log/2020-04-02-10-38-21-156610-UP2-board-17492
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [17512]
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/realsense/D435' in container '/safety_field_intrusion_detection'
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/realsense/D435i' in container '/safety_field_intrusion_detection'
[component_container-1] [WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/safety_field_intrusion_detection' in container '/safety_field_intrusion_detection'
[component_container-1] terminate called after throwing an instance of 'rs2::invalid_value_error'
[component_container-1]   what():  hwmon command 0x30 failed.
[component_container-1] Error type: No data to return (-21).
[ERROR] [component_container-1]: process has died [pid 17512, exit code -6, cmd '/opt/ros/eloquent/lib/rclcpp_components/component_container --ros-args -r __node:=safety_field_intrusion_detection']

or

[INFO] [launch]: All log files can be found below /home/mtr/.ros/log/2020-04-02-10-40-56-586733-UP2-board-17725
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [17736]
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/d435/D435' in container '/safety_field_intrusion_detection'
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/d435i/D435i' in container '/safety_field_intrusion_detection'
[component_container-1] [WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/safety_field_intrusion_detection' in container '/safety_field_intrusion_detection'
[component_container-1] terminate called after throwing an instance of 'rs2::invalid_value_error'
[component_container-1]   what():  hwmon command 0x10 failed.
[component_container-1] Error type:  (1).
[ERROR] [component_container-1]: process has died [pid 17736, exit code -6, cmd '/opt/ros/eloquent/lib/rclcpp_components/component_container --ros-args -r __node:=safety_field_intrusion_detection'].

rs2::error when trying to run T265 node

Device info:
Name : Intel RealSense T265
Serial Number : 0000908412111187
Firmware Version : 0.2.0.926
Product Line : T200

Operating System & Version Linux (Ubuntu 18.04)
Kernel Version (Linux Only) 4.15.0-041500-generic
ROS2 Dashing
SDK Version 2.0 (v2.32.1)
ros2_intel_realsense pkg 2.0.6 (2019-09-03)

I am new to ROS2 and librealsense and I've been trying to get the camera T265
running with ros2_intel_realsense pkg, however when I try to start a node I get this:

~/ros2_ws$ ros2 run realsense_node realsense_node __params:=ros2 pkg prefix realsense_examples/share/realsense_examples/config/t265.yaml __ns:=/t265
[INFO] [t265.camera]: Device's serial number is not set, enabling the default device!
[INFO] [t265.camera]: Device with serial number 0000908412111187 was found.
[INFO] [t265.camera]: Create a node for T265 Camera
terminate called after throwing an instance of 'rs2::error'
what(): No device connected

The device is being recognised by rs-enumerate-devices and realsense-viewer:

~/ros2_ws$ rs-enumerate-devices
Device info:
Name : Intel RealSense T265
Serial Number : 0000908412111187
Firmware Version : 0.2.0.926
Physical Port : 2-6-3
Product Id : 0B37
Usb Type Descriptor : 3.1
Product Line : T200

Stream Profiles supported by Tracking Module
Supported modes:
stream resolution fps format
Fisheye 1 848x800 @ 30Hz Y8
Fisheye 2 848x800 @ 30Hz Y8
Gyro N/A @ 200Hz MOTION_XYZ32F
Accel N/A @ 62Hz MOTION_XYZ32F
Pose N/A @ 200Hz 6DOF

Screenshot at 2020-02-18 13-57-08

Anyone with the same or similar problem?

rviz2 error after realsense_ros2_camera

I installed ROS2 Crystal, librealsense2 and realsense_ros2_camera on Jetson TX2.
realsense_ros2_camera was fine:
[INFO] [RealSenseCameraNode]: setupStreams...
[INFO] [RealSenseCameraNode]: depth stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: infra1 stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: infra2 stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: color stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: publishStaticTransforms...
[INFO] [RealSenseCameraNode]: RealSense Node Is Up!
but rviz2 won't display video and generated the following errors:
[INFO] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[INFO] [rviz2]: Stereo is NOT SUPPORTED

D435 RGB color encoding

/camera/color/image_raw topic of D435 has wrong color encoding.

Its encoding is 'rgb8', whereas its actual color format is 'bgr8'.
If I convert image topic using cv_bridge and save it as file, it shows wrong image whose color channels are wrongly mapped.

Test codes are as below;

void GrabImage(const sensor_msgs::msg::Image::SharedPtr msg){
  cv_bridge::CvImagePtr cv_ptr;
  cv_ptr = cv_bridge::toCvCopy(msg);
  imwrite("test.jpg", cv_ptr->image);
}

I have to modify conversion code to

cv_ptr = cv_bridge::toCvCopy(msg, "bgr8");

to get proper result.

Generating point cloud on remote machine

I would like to connect my D435 to my robot (local machine) and advertise only raw depth & RGB images. Then compute point cloud on the remote machine. Is it possible? How? Any solutions? Suggestions?

Or maybe... do u have any idea hot to push point cloud via network? I got very slow FPS if I am doing it and it seems like a ROS limitation...

I am using ros2_intel_realsense from branch refactor and SDK v2.26.0.

enable_pointcloud=True results in segfault when running with D415

When I run with the D415 camera and enable_pointcloud=True, which is the default I get a crash / segfault with no error message:

robot@nuc-i7:~$ ros2 run realsense_ros2_camera realsense_ros2_camera
[INFO] [RealSenseCameraNode]: RealSense ROS v2. 0.1
[INFO] [RealSenseCameraNode]: Running with LibRealSense v2.16.5
[INFO] [RealSenseCameraNode]: getParameters...
[INFO] [RealSenseCameraNode]: setupDevice...
[INFO] [RealSenseCameraNode]: Device Name: Intel RealSense D415
[INFO] [RealSenseCameraNode]: Device Serial No: 725112060242
[INFO] [RealSenseCameraNode]: Device FW version: 05.11.01.00
[INFO] [RealSenseCameraNode]: Device Product ID: 0AD3
[INFO] [RealSenseCameraNode]: Sync Mode: On
[INFO] [RealSenseCameraNode]: Device Sensors: 
[INFO] [RealSenseCameraNode]: Stereo Module was found.
[INFO] [RealSenseCameraNode]: RGB Camera was found.
[INFO] [RealSenseCameraNode]: Fisheye sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: Gyro sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: Accel sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: setupPublishers...
[INFO] [RealSenseCameraNode]: setupStreams...
[INFO] [RealSenseCameraNode]: depth stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: infra1 stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: infra2 stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: color stream is enabled - width: 640, height: 480, fps: 30
robot@nuc-i7:~$ 

No Error, but camera starts then quits!

When I run with enable_pointcloud=False:

robot@nuc-i7:~/rap_framework-amr_sdk_crystal$ cat realsense_params.yaml 
RealSenseCameraNode:
  ros__parameters:
    enable_depth: True
    enable_infra1: True
    enable_infra2: True
    enable_pointcloud: False
robot@nuc-i7:~/rap_framework-amr_sdk_crystal$ ros2 run realsense_ros2_camera realsense_ros2_camera __params:=realsense_params.yaml 
[INFO] [RealSenseCameraNode]: RealSense ROS v2. 0.1
[INFO] [RealSenseCameraNode]: Running with LibRealSense v2.16.5
[INFO] [RealSenseCameraNode]: getParameters...
[INFO] [RealSenseCameraNode]: setupDevice...
[INFO] [RealSenseCameraNode]: Device Name: Intel RealSense D415
[INFO] [RealSenseCameraNode]: Device Serial No: 725112060242
[INFO] [RealSenseCameraNode]: Device FW version: 05.11.01.00
[INFO] [RealSenseCameraNode]: Device Product ID: 0AD3
[INFO] [RealSenseCameraNode]: Sync Mode: On
[INFO] [RealSenseCameraNode]: Device Sensors: 
[INFO] [RealSenseCameraNode]: Stereo Module was found.
[INFO] [RealSenseCameraNode]: RGB Camera was found.
[INFO] [RealSenseCameraNode]: Fisheye sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: Gyro sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: Accel sensor isn't supported by current device! -- Skipping...
[INFO] [RealSenseCameraNode]: setupPublishers...
[INFO] [RealSenseCameraNode]: setupStreams...
[INFO] [RealSenseCameraNode]: depth stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: infra1 stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: infra2 stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: color stream is enabled - width: 640, height: 480, fps: 30
[INFO] [RealSenseCameraNode]: publishStaticTransforms...
[INFO] [RealSenseCameraNode]: RealSense Node Is Up!

That works fine.
When I ran gdb and did a backtrace to find the failure, it is in this line of code:

Not sure why it is segfaulting there.

When I run with the D435 camera, this issue doesn't happen. Is pointcloud supported for D415?

Cartographer with ROS2 and camera D435

Hi. I want to use Cartographer together with my D435 camera and ROS Eloquent.
I have been trying to use this tutorial (https://intel.github.io/robot_devkit_doc/pages/rs_slam.html) but get some problems as I do not have the T265 camera. What I have done is to comment out the T265 node, and also change the tracking_frame from "camera_pose_optical_frame" to "base_link" as the first one is related to the T265 camera.

By watching the tf-tree, I can see that a lot of frames are not connected.

frames.pdf
(even though the T265 node is commented out, the static transform between T265 and D435 is still published, thats why it is in the tf-tree).
What can be seen is that there lacks a connection from odom_frame to the rest and also from the D435 link.
Am I supposed to change "odom_frame" in the code with "odom", and the camera links in the turtlebot URDF with the D435 camera? This would might connect the whole tree, but seems like a lot of changes in the code. From the tutorial, I got the impression that I could just run the commands and that it would be straight forward without changing the code too much, but now I am unsure.

Have anyone tried to do the same and could help me out a bit?
Thank you!

Current librealsense version not compatible ROS1 version

Currently, the ROS1 version of the realsense wrapper is on release 2.2.3, which is linked to LibRealSense v2.19.0/ v2.19.1/ v2.19.2.
However, this version seems to only support 2.16.5.

Apparently, the package can be compiled with the latest librealsense version such as 2.20.0. Only it'll than give a runtime dynamic linking error stating that it is compiled with 2.20.0 but it needs 2.16.5 to run.

My workaround is to regress to older version of librealsense by:

(edit: fix missing libraries)

	sudo apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
	sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u
	
	sudo apt-get install librealsense2-dkms
	sudo apt-get install librealsense2=2.16.5-0~realsense0.209
	sudo apt-get install librealsense2-udev-rules=2.16.5-0~realsense0.209
	sudo apt-get install librealsense2-utils=2.16.5-0~realsense0.209
	sudo apt-get install librealsense2-dbg=2.16.5-0~realsense0.209
	sudo apt-get install librealsense2-dev=2.16.5-0~realsense0.209

IMO maybe some kind of version check can be implemented during build process, or at least noted the compatibility issue somewhere in the README/RELEASE document.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.