diff --git a/README.md b/README.md index 6659fdb695..7bd8cf5625 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,65 @@ -# ROS2 Wrapper for Intel® RealSense™ Devices -These are packages for using Intel RealSense cameras (D400, L500 and SR300 cameras) with ROS2. - -This version supports ROS2 Dashing, Eloquent, Foxy, Galactic and Rolling. - -LibRealSense supported version: v2.51.1 (see [realsense2_camera release notes](https://github.com/IntelRealSense/realsense-ros/releases)) - - -## For LibRS ROS1 Wrapper please refer to [ROS1-legacy branch](https://github.com/IntelRealSense/realsense-ros/tree/ros1-legacy) - -## Please notice: if you are moving from RealSense [ROS2-legacy branch](https://github.com/IntelRealSense/realsense-ros/tree/ros2-legacy) to ROS2-development: -- **Changed Parameters**: +

+ Intel® RealSense™ +

+ +

+ ROS2 packages for using Intel RealSense D400 cameras.
+ Latest release notes +

+ +
+ + +[![rolling][rolling-badge]][rolling] +[![humble][humble-badge]][humble] +[![foxy][foxy-badge]][foxy] +[![galactic][galactic-badge]][galactic] +[![ubuntu22][ubuntu22-badge]][ubuntu22] +[![ubuntu20][ubuntu20-badge]][ubuntu20] + +![GitHubWorkflowStatus](https://img.shields.io/github/actions/workflow/status/IntelRealSense/realsense-ros/main.yml?logo=github&style=flat-square) +[![GitHubcontributors](https://img.shields.io/github/contributors/IntelRealSense/realsense-ros?style=flat-square)](CONTRIBUTING.md) +[![License](https://img.shields.io/github/license/IntelRealSense/realsense-ros?style=flat-square)](LICENSE) + +
+ +## Table of contents + * [ROS1 and ROS2 legacy](#legacy) + * [Installation](#installation) + * [Usage](#usage) + * [Starting the camera node](#start-camera-node) + * [Parameters](#parameters) + * [ROS2-vs-Optical Coordination Systems](#coordination) + * [TF from coordinate A to coordinate B](#tfs) + * [Extrinsics from sensor A to sensor B](#extrinsics) + * [Topics](#topics) + * [Metadata Topic](#metadata) + * [Post-Processing Filters](#filters) + * [Available Services](#services) + * [Efficient intra-process communication](#intra-process) + * [Contributing](CONTRIBUTING.md) + * [License](LICENSE) + +
+ +

+ Legacy +

+ +
+ + Intel RealSense ROS1 Wrapper + + Intel Realsense ROS1 Wrapper is not supported anymore, since our developers team are focusing on ROS2 distro.
+ For ROS1 wrapper, go to ros1-legacy branch +
+ +
+ + Moving from ros2-legacy to ros2-development + + +* Changed Parameters: - **"stereo_module"**, **"l500_depth_sensor"** are replaced by **"depth_module"** - For video streams: **\.profile** replaces **\_width**, **\_height**, **\_fps** - **ROS2-legacy (Old)**: @@ -26,45 +76,72 @@ LibRealSense supported version: v2.51.1 (see [realsense2_camera release notes](h - **unite_imu_method** parameter is now changeable in runtime. - **enable_sync** parameter is now changeable in runtime. - - -## Installation Instructions - - ### Step 1: Install the ROS2 distribution - - #### Ubuntu 22.04: - - [ROS2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html) - - #### Ubuntu 20.04: - - [ROS2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html) - - [ROS2 Galactic](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html) - - #### Ubuntu 18.04 : - - [ROS2 Dashing](https://docs.ros.org/en/dashing/Installation/Ubuntu-Install-Debians.html) - - [ROS2 Eloquent](https://docs.ros.org/en/eloquent/Installation/Linux-Install-Debians.html) - - -### Step 2: Install the latest Intel® RealSense™ SDK 2.0 - -- #### Option 1: Install librealsense2 debian package (Not supported in Ubuntu 22.04 yet) - - Jetson users - use the [Jetson Installation Guide](https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_jetson.md) - - Otherwise, install from [Linux Debian Installation Guide](https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installing-the-packages) - - In this case treat yourself as a developer: make sure to follow the instructions to also install librealsense2-dev and librealsense2-dkms packages - -- #### Option 2: Build from source - - Download the latest [Intel® RealSense™ SDK 2.0](https://github.com/IntelRealSense/librealsense/releases/tag/v2.51.1) +
+ + +

+ Installation +

+ +
+ + Step 1: Install the ROS2 distribution + + +- #### Ubuntu 22.04: + - [ROS2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html) +- #### Ubuntu 20.04: + - [ROS2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html) + - [ROS2 Galactic](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html) (deprecated) + +
+ +
+ + Step 2: Install latest Intel® RealSense™ SDK 2.0 + + +- #### Option 1: Install librealsense2 debian package from Intel servers + - Jetson users - use the [Jetson Installation Guide](https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_jetson.md) + - Otherwise, install from [Linux Debian Installation Guide](https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installing-the-packages) + - In this case treat yourself as a developer: make sure to follow the instructions to also install librealsense2-dev and librealsense2-dkms packages + +- #### Option 2: Install librealsense2 (without graphical tools and examples) debian package from ROS servers: + - [Configure](http://wiki.ros.org/Installation/Ubuntu/Sources) your Ubuntu repositories + - Install all realsense ROS packages by ```sudo apt install ros--librealsense2*``` + - For example, for Humble distro: ```sudo apt install ros-humble-librealsense2*``` + +- #### Option 3: Build from source + - Download the latest [Intel® RealSense™ SDK 2.0](https://github.com/IntelRealSense/librealsense/releases/tag/v2.53.1) - Follow the instructions under [Linux Installation](https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md) - -### Step 3: Install Intel® RealSense™ ROS2 wrapper from sources - - Create a ROS2 workspace +
+ +
+ + Step 3: Install Intel® RealSense™ ROS2 wrapper + + +#### Option 1: Install debian package from ROS servers + - [Configure](http://wiki.ros.org/Installation/Ubuntu/Sources) your Ubuntu repositories + - Install all realsense ROS packages by ```sudo apt install ros--realsense2-*``` + - For example, for Humble distro: ```sudo apt install ros-humble-realsense2-*``` + +#### Option 2: Install from source + + - Create a ROS2 workspace ```bash mkdir -p ~/ros2_ws/src cd ~/ros2_ws/src/ ``` - - Clone the latest ROS2 Intel® RealSense™ wrapper from [here](https://github.com/IntelRealSense/realsense-ros.git) into '~/ros2_ws/src/' + + - Clone the latest ROS2 Intel® RealSense™ wrapper from [here](https://github.com/IntelRealSense/realsense-ros.git) into '~/ros2_ws/src/' ```bashrc git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2-development cd ~/ros2_ws ``` -### Step 4: Install dependencies + + - Install dependencies ```bash sudo apt-get install python3-rosdep -y sudo rosdep init # "sudo rosdep init --include-eol-distros" for Eloquent and earlier @@ -72,43 +149,205 @@ LibRealSense supported version: v2.51.1 (see [realsense2_camera release notes](h rosdep install -i --from-path src --rosdistro $ROS_DISTRO --skip-keys=librealsense2 -y ``` -### Step 5: Build + - Build ```bash colcon build ``` -### Step 6: Terminal environment + - Source environment ```bash - ROS_DISTRO= # set your ROS_DISTRO: humble, galactic, foxy, eloquent, dashing + ROS_DISTRO= # set your ROS_DISTRO: humble, galactic, foxy source /opt/ros/$ROS_DISTRO/setup.bash cd ~/ros2_ws . install/local_setup.bash ``` + +
+ +
+ +

+ Usage +

+ +

+ Start the camera node +

+ + #### with ros2 run: + ros2 run realsense2_camera realsense2_camera_node + # or, with parameters, for example - temporal and spatial filters are enabled: + ros2 run realsense2_camera realsense2_camera_node --ros-args -p enable_color:=false -p spatial_filter.enable:=true -p temporal_filter.enable:=true + + #### with ros2 launch: + ros2 launch realsense2_camera rs_launch.py + ros2 launch realsense2_camera rs_launch.py depth_module.profile:=1280x720x30 pointcloud.enable:=true + +
+ +

+ Parameters +

+ +### Sensor Parameters: +- Each sensor has a unique set of parameters. +- Video sensors, such as depth_module or rgb_camera have, at least, the 'profile' parameter.
+ - The profile parameter is a string of the following format: \X\X\ (The deviding character can be X, x or ",". Spaces are ignored.) + - For example: ```depth_module.profile:=640x480x30``` +- Since infra1, infra2 and depth are all streams of the depth_module, their width, height and fps are defined by their common sensor. +- If the specified combination of parameters is not available by the device, the default configuration will be used. -  +
-## Usage Instructions +### Available Parameters: +- For the entire list of parameters type `ros2 param list`. +- For reading a parameter value use `ros2 param get ` + - For example: `ros2 param get /camera/camera depth_module.emitter_on_off` +- For setting a new value for a parameter use `ros2 param set ` + - For example: `ros2 param set /camera/camera depth_module.emitter_on_off true` -### Start the camera node -To start the camera node in ROS: +#### Parameters that can be modified during runtime: +- All of the filters and sensors inner parameters. +- **enable_****: + - Choose whether to enable a specified stream or not. Default is true for images and false for orientation streams. + - can be any of *infra1, infra2, color, depth, fisheye, fisheye1, fisheye2, gyro, accel, pose*. + - For example: ```enable_infra1:=true enable_color:=false``` +- **enable_sync**: + - gathers closest frames of different sensors, infra red, color and depth, to be sent with the same timetag. + - This happens automatically when such filters as pointcloud are enabled. +- ****_qos**: + - Sets the QoS by which the topic is published. + - can be any of *infra, color, fisheye, depth, gyro, accel, pose*. + - Available values are the following strings: `SYSTEM_DEFAULT`, `DEFAULT`, `PARAMETER_EVENTS`, `SERVICES_DEFAULT`, `PARAMETERS`, `SENSOR_DATA`. + - For example: ```depth_qos:=SENSOR_DATA``` + - Reference: [ROS2 QoS profiles formal documentation](https://docs.ros.org/en/rolling/Concepts/About-Quality-of-Service-Settings.html#qos-profiles) +- **Notice:** ****_info_qos** refers to both camera_info topics and metadata topics. +- **tf_publish_rate**: double, positive values mean dynamic transform publication with specified rate, all other values mean static transform publication. Defaults to 0 -```bash -ros2 launch realsense2_camera rs_launch.py -``` -or, with parameters, for example - temporal and spatial filters are enabled: -```bash -ros2 run realsense2_camera realsense2_camera_node --ros-args -p enable_color:=false -p spatial_filter.enable:=true -p temporal_filter.enable:=true -``` +#### Parameters that cannot be changed in runtime: +- **serial_no**: + - will attach to the device with the given serial number (*serial_no*) number. + - Default, attach to the first (in an inner list) RealSense device. + - Note: serial number should be defined with "_" prefix. + - That is a workaround until a better method will be found to ROS2's auto conversion of strings containing only digits into integers. + - Example: serial number 831612073525 can be set in command line as `serial_no:=_831612073525`. +- **usb_port_id**: + - will attach to the device with the given USB port (*usb_port_id*). + - For example: `usb_port_id:=4-1` or `usb_port_id:=4-2` + - Default, ignore USB port when choosing a device. +- **device_type**: + - will attach to a device whose name includes the given *device_type* regular expression pattern. + - Default, ignore device type. + - For example: + - `device_type:=d435` will match d435 and d435i. + - `device_type=d435(?!i)` will match d435 but not d435i. +- **reconnect_timeout**: + - When the driver cannot connect to the device try to reconnect after this timeout (in seconds). + - For Example: `reconnect_timeout:=10` +- **wait_for_device_timeout**: + - If the specified device is not found, will wait *wait_for_device_timeout* seconds before exits. + - Defualt, *wait_for_device_timeout < 0*, will wait indefinitely. + - For example: `wait_for_device_timeout:=60` +- **rosbag_filename**: + - Publish topics from rosbag file. There are two ways for loading rosbag file: + * Command line - ```ros2 run realsense2_camera realsense2_camera_node -p rosbag_filename:="/full/path/to/rosbag.bag"``` + * Launch file - set ```rosbag_filename``` parameter with rosbag full path (see ```realsense2_camera/launch/rs_launch.py``` as reference) +- **initial_reset**: + - On occasions the device was not closed properly and due to firmware issues needs to reset. + - If set to true, the device will reset prior to usage. + - For example: `initial_reset:=true` +- ****_frame_id**, ****_optical_frame_id**, **aligned_depth_to_**_frame_id**: Specify the different frame_id for the different frames. Especially important when using multiple cameras. +- **base_frame_id**: defines the frame_id all static transformations refers to. +- **odom_frame_id**: defines the origin coordinate system in ROS convention (X-Forward, Y-Left, Z-Up). pose topic defines the pose relative to that system. + +- **unite_imu_method**: + - D400 cameras have built in IMU components which produce 2 unrelated streams, each with it's own frequency: + - *gyro* - which shows angular velocity + - *accel* which shows linear acceleration. + - By default, 2 corresponding topics are available, each with only the relevant fields of the message sensor_msgs::Imu are filled out. + - Setting *unite_imu_method* creates a new topic, *imu*, that replaces the default *gyro* and *accel* topics. + - The *imu* topic is published at the rate of the gyro. + - All the fields of the Imu message under the *imu* topic are filled out. + - `unite_imu_method` parameter supported values are [0-2] meaning: [0 -> None, 1 -> Copy, 2 -> Linear_ interpolation] when: + - **linear_interpolation**: Every gyro message is attached by the an accel message interpolated to the gyro's timestamp. + - **copy**: Every gyro message is attached by the last accel message. +- **clip_distance**: + - Remove from the depth image all values above a given value (meters). Disable by giving negative value (default) + - For example: `clip_distance:=1.5` +- **linear_accel_cov**, **angular_velocity_cov**: sets the variance given to the Imu readings. +- **hold_back_imu_for_frames**: Images processing takes time. Therefor there is a time gap between the moment the image arrives at the wrapper and the moment the image is published to the ROS environment. During this time, Imu messages keep on arriving and a situation is created where an image with earlier timestamp is published after Imu message with later timestamp. If that is a problem, setting *hold_back_imu_for_frames* to *true* will hold the Imu messages back while processing the images and then publish them all in a burst, thus keeping the order of publication as the order of arrival. Note that in either case, the timestamp in each message's header reflects the time of it's origin. +- **publish_tf**: + - boolean, publish or not TF at all. + - Defaults to True. +- **diagnostics_period**: + - double, positive values set the period between diagnostics updates on the `/diagnostics` topic. + - 0 or negative values mean no diagnostics topic is published. Defaults to 0.
+The `/diagnostics` topic includes information regarding the device temperatures and actual frequency of the enabled streams. + +- **publish_odom_tf**: If True (default) publish TF from odom_frame to pose_frame. + +
+ +

+ ROS2(Robot) vs Optical(Camera) Coordination Systems: +

+ +- Point Of View: + - Imagine we are standing behind of the camera, and looking forward. + - Always use this point of view when talking about coordinates, left vs right IRs, position of sensor, etc.. + +![image](https://user-images.githubusercontent.com/99127997/230150735-bc31fedf-d715-4e35-b462-fe2c338832c3.png) + +- ROS2 Coordinate System: (X: Forward, Y:Left, Z: Up) +- Camera Optical Coordinate System: (X: Right, Y: Down, Z: Forward) +- References: [REP-0103](https://www.ros.org/reps/rep-0103.html#coordinate-frame-conventions) [REP-0105](https://www.ros.org/reps/rep-0105.html#coordinate-frames) + +
+ +

+ TF from coordinate A to coordinate B: +

+ +- TF msg expresses a transform from coordinate frame "header.frame_id" (source) to the coordinate frame child_frame_id (destination) [Reference](http://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/Transform.html) +- In RealSense cameras, the origin point (0,0,0) is taken from the left IR (infra1) position and named as "camera_link" frame +- Depth, left IR and "camera_link" coordinates converge together. +- Our wrapper provide static TFs between each sensor coordinate to the camera base (camera_link) +- Also, it provides TFs from each sensor ROS coordinates to its corrosponding optical coordinates. +- Example of static TFs of RGB sensor and Infra2 (right infra) sensor of D435i module as it shown in rviz2: +![example](https://user-images.githubusercontent.com/99127997/230148106-0f79cbdb-c401-4d09-b386-a366af18e5f7.png) + +
+ +

+ Extrinsics from sensor A to sensor B: +

+ + +- Extrinsic from sensor A to sensor B means the position and orientation of sensor A relative to sensor B. +- Imagine that B is the origin (0,0,0), then the Extrensics(A->B) describes where is sensor A relative to sensor B. +- For example, depth_to_color, in D435i: + - If we look from behind of the D435i, extrinsic from depth to color, means, where is the depth in relative to the color. + - If we just look at the X coordinates, in the optical coordiantes (again, from behind) and assume that COLOR(RGB) sensor is (0,0,0), we can say that DEPTH sensor is on the right of RGB by 0.0148m (1.48cm). + +![d435i](https://user-images.githubusercontent.com/99127997/230220297-e392f0fc-63bf-4bab-8001-af1ddf0ed00e.png) -or, with a launch file: -```bash -ros2 launch realsense2_camera rs_launch.py -ros2 launch realsense2_camera rs_launch.py depth_module.profile:=1280x720x30 pointcloud.enable:=true +``` +administrator@perclnx466 ~/ros2_humble $ ros2 topic echo /camera/extrinsics/depth_to_color +rotation: +... +translation: +- 0.01485931035131216 +- 0.0010161789832636714 +- 0.0005317096947692335 +--- ``` -This will stream all camera sensors and publish on the appropriate ROS topics. +
-### Published Topics +

+ Published Topics +

+ The published topics differ according to the device and parameters. After running the above command with D435i attached, the following list of topics will be available (This is a partial list. For full one type `ros2 topic list`): - /camera/aligned_depth_to_color/camera_info @@ -127,8 +366,9 @@ After running the above command with D435i attached, the following list of topic - /rosout - /tf_static +This will stream relevant camera sensors and publish on the appropriate ROS topics. -Enabling accel and gyro is achieved either by adding the following parameters to the command line:
+ Enabling accel and gyro is achieved either by adding the following parameters to the command line:
`ros2 launch realsense2_camera rs_launch.py pointcloud.enable:=true enable_gyro:=true enable_accel:=true`
or in runtime using the following commands: ``` @@ -146,117 +386,71 @@ Enabling stream adds matching topics. For instance, enabling the gyro and accel - /camera/gyro/metadata - /camera/gyro/sample +
->Using an L515 device the list differs a little by adding a 4-bit confidence grade (published as a mono8 image): ->- /camera/confidence/camera_info ->- /camera/confidence/image_rect_raw -> ->It also replaces the 2 infrared topic sets with the single available one: ->- /camera/infra/camera_info ->- /camera/infra/image_raw - -To turn them off: `ros2 param set /camera/camera enable_infra false` -The "/camera" prefix is the namesapce specified in the given launch file. -When using D435 or D415, the gyro and accel topics wont be available. - -### The metadata topic: +

+ Metadata topic +

+ The metadata messages store the camera's available metadata in a *json* format. To learn more, a dedicated script for echoing a metadata topic in runtime is attached. For instance, use the following command to echo the camera/depth/metadata topic: ``` python3 src/realsense-ros/realsense2_camera/scripts/echo_metadada.py /camera/depth/metadata ``` - -### Post processing blocks - i.e. filters: -The following processing blocks are available: - - ```align_depth```: If enabled, will publish the depth image aligned to the color image on the topic `/camera/aligned_depth_to_color/image_raw`.
The pointcloud, if created, will be based on the aligned depth image. - + +
+ +

+ Post-Processing Filters +

+ +The following post processing filters are available: + - ```align_depth```: If enabled, will publish the depth image aligned to the color image on the topic `/camera/aligned_depth_to_color/image_raw`. + - The pointcloud, if created, will be based on the aligned depth image. - ```colorizer```: will color the depth image. On the depth topic an RGB image will be published, instead of the 16bit depth values . - ```pointcloud```: will add a pointcloud topic `/camera/depth/color/points`. * The texture of the pointcloud can be modified using the `pointcloud.stream_filter` parameter.
* The depth FOV and the texture FOV are not similar. By default, pointcloud is limited to the section of depth containing the texture. You can have a full depth to pointcloud, coloring the regions beyond the texture with zeros, by setting `pointcloud.allow_no_texture_points` to true. * pointcloud is of an unordered format by default. This can be changed by setting `pointcloud.ordered_pc` to true. - - - ```hdr_merge```: Allows depth image to be created by merging the information from 2 consecutive frames, taken with different exposure and gain values. The way to set exposure and gain values for each sequence in runtime is by first selecting the sequence id, using the `depth_module.sequence_id` parameter and then modifying the `depth_module.gain`, and `depth_module.exposure`.
To view the effect on the infrared image for each sequence id use the `sequence_id_filter.sequence_id` parameter.
To initialize these parameters in start time use the following parameters:
- `depth_module.exposure.1`, `depth_module.gain.1`, `depth_module.exposure.2`, `depth_module.gain.2`
- \* For in-depth review of the subject please read the accompanying [white paper](https://dev.intelrealsense.com/docs/high-dynamic-range-with-stereoscopic-depth-cameras). - - - The following filters have detailed descriptions in : https://github.com/IntelRealSense/librealsense/blob/master/doc/post-processing-filters.md - - ```disparity_filter``` - convert depth to disparity before applying other filters and back. - - ```spatial_filter``` - filter the depth image spatially. - - ```temporal_filter``` - filter the depth image temporally. - - ```hole_filling_filter``` - apply hole-filling filter. - - ```decimation_filter``` - reduces depth scene complexity. + - ```hdr_merge```: Allows depth image to be created by merging the information from 2 consecutive frames, taken with different exposure and gain values. + - The way to set exposure and gain values for each sequence in runtime is by first selecting the sequence id, using the `depth_module.sequence_id` parameter and then modifying the `depth_module.gain`, and `depth_module.exposure`. + - To view the effect on the infrared image for each sequence id use the `sequence_id_filter.sequence_id` parameter. + - To initialize these parameters in start time use the following parameters: + - `depth_module.exposure.1` + - `depth_module.gain.1` + - `depth_module.exposure.2` + - `depth_module.gain.2` + - For in-depth review of the subject please read the accompanying [white paper](https://dev.intelrealsense.com/docs/high-dynamic-range-with-stereoscopic-depth-cameras). + + - The following filters have detailed descriptions in : https://github.com/IntelRealSense/librealsense/blob/master/doc/post-processing-filters.md + - ```disparity_filter``` - convert depth to disparity before applying other filters and back. + - ```spatial_filter``` - filter the depth image spatially. + - ```temporal_filter``` - filter the depth image temporally. + - ```hole_filling_filter``` - apply hole-filling filter. + - ```decimation_filter``` - reduces depth scene complexity. Each of the above filters have it's own parameters, following the naming convention of `.` including a `.enable` parameter to enable/disable it. -### Sensor Parameters: -Each sensor has a unique set of parameters. -Video sensors, such as depth_module or rgb_camera have, at least, the 'profile' parameter.
-It is a string of the following format: \X\X\ (The deviding character can be X, x or ",". Spaces are ignored.) - -Since infra1, infra2 and depth are all streams of the depth_module, their width, height and fps are defined by their common sensor. -The same rule applies in L515 for the depth, infra and confidence streams which all share the parameters of their common depth_module. -If the specified combination of parameters is not available by the device, the default configuration will be used.
- -### Available Parameters: -For the entire list of parameters type `ros2 param list`. -For reading a parameter value use `ros2 param get ` for instance: `ros2 param get /camera/camera depth_module.emitter_on_off` -For setting a new value for a parameter use `ros2 param set ` i.e. `ros2 param set /camera/camera depth_module.emitter_on_off true` - -#### Parameters that can be modified during runtime: -- All of the filters and sensors inner parameters. -- **enable_****: Choose whether to enable a specified stream or not. Default is true for images and false for orientation streams. can be any of *infra1, infra2, color, depth, fisheye, fisheye1, fisheye2, gyro, accel, pose*. -- **enable_sync**: gathers closest frames of different sensors, infra red, color and depth, to be sent with the same timetag. This happens automatically when such filters as pointcloud are enabled. -- ****_qos**: can be any of *infra, color, fisheye, depth, gyro, accel, pose*. Sets the QoS by which the topic is published. Available values are the following strings: SYSTEM_DEFAULT, DEFAULT, PARAMETER_EVENTS, SERVICES_DEFAULT, PARAMETERS, SENSOR_DATA. -- **Notice:** ****_info_qos** refers to both camera_info topics and metadata topics. -- **tf_publish_rate**: double, positive values mean dynamic transform publication with specified rate, all other values mean static transform publication. Defaults to 0 - - - -#### Parameters that cannot be changed in runtime: -- **serial_no**: will attach to the device with the given serial number (*serial_no*) number. Default, attach to the first (in an inner list) RealSense device. - - Note: serial number can also be defined with "_" prefix. For instance, serial number 831612073525 can be set in command line as `serial_no:=_831612073525`. That is a workaround until a better method will be found to ROS2's auto conversion of strings containing only digits into integers. -- **usb_port_id**: will attach to the device with the given USB port (*usb_port_id*). i.e 4-1, 4-2 etc. Default, ignore USB port when choosing a device. -- **device_type**: will attach to a device whose name includes the given *device_type* regular expression pattern. Default, ignore device type. For example, device_type:=d435 will match d435 and d435i. device_type=d435(?!i) will match d435 but not d435i. -- **reconnect_timeout**: When the driver cannot connect to the device try to reconnect after this timeout (in seconds). -- **wait_for_device_timeout**: If the specified device is not found, will wait *wait_for_device_timeout* seconds before exits. Defualt, *wait_for_device_timeout < 0*, will wait indefinitely. -- **rosbag_filename**: Publish topics from rosbag file. There are two ways for loading rosbag file: - * Command line - ```ros2 run realsense2_camera realsense2_camera_node -p rosbag_filename:="/full/path/to/rosbag.bag"``` - * Launch file - set ```rosbag_filename``` parameter with rosbag full path (see ```realsense2_camera/launch/rs_launch.py``` as reference) - -- **initial_reset**: On occasions the device was not closed properly and due to firmware issues needs to reset. If set to true, the device will reset prior to usage. - -- ****_frame_id**, ****_optical_frame_id**, **aligned_depth_to_**_frame_id**: Specify the different frame_id for the different frames. Especially important when using multiple cameras. - -- **base_frame_id**: defines the frame_id all static transformations refers to. -- **odom_frame_id**: defines the origin coordinate system in ROS convention (X-Forward, Y-Left, Z-Up). pose topic defines the pose relative to that system. - -- **unite_imu_method**: The D435i camera has built in IMU components which produce 2 unrelated streams: *gyro* - which shows angular velocity and *accel* which shows linear acceleration. Each with it's own frequency. By default, 2 corresponding topics are available, each with only the relevant fields of the message sensor_msgs::Imu are filled out. -Setting *unite_imu_method* creates a new topic, *imu*, that replaces the default *gyro* and *accel* topics. The *imu* topic is published at the rate of the gyro. All the fields of the Imu message under the *imu* topic are filled out. `unite_imu_method` parameter supported values are [0-2] meaning: [0 -> None, 1 -> Copy, 2 -> Linear_ interpolation] when: - - **linear_interpolation**: Every gyro message is attached by the an accel message interpolated to the gyro's timestamp. - - **copy**: Every gyro message is attached by the last accel message. -- **clip_distance**: remove from the depth image all values above a given value (meters). Disable by giving negative value (default) -- **linear_accel_cov**, **angular_velocity_cov**: sets the variance given to the Imu readings. -- **hold_back_imu_for_frames**: Images processing takes time. Therefor there is a time gap between the moment the image arrives at the wrapper and the moment the image is published to the ROS environment. During this time, Imu messages keep on arriving and a situation is created where an image with earlier timestamp is published after Imu message with later timestamp. If that is a problem, setting *hold_back_imu_for_frames* to *true* will hold the Imu messages back while processing the images and then publish them all in a burst, thus keeping the order of publication as the order of arrival. Note that in either case, the timestamp in each message's header reflects the time of it's origin. -- **publish_tf**: boolean, publish or not TF at all. Defaults to True. -- **diagnostics_period**: double, positive values set the period between diagnostics updates on the `/diagnostics` topic. 0 or negative values mean no diagnostics topic is published. Defaults to 0.
-The `/diagnostics` topic includes information regarding the device temperatures and actual frequency of the enabled streams. - -- **publish_odom_tf**: If True (default) publish TF from odom_frame to pose_frame. +
-### Available services: +

+ Available services +

+ - device_info : retrieve information about the device - serial_number, firmware_version etc. Type `ros2 interface show realsense2_camera_msgs/srv/DeviceInfo` for the full list. Call example: `ros2 service call /camera/device_info realsense2_camera_msgs/srv/DeviceInfo` - - Note that for **ROS2 Dashing** the command is `ros2 srv show realsense2_camera_msgs/srv/DeviceInfo` - -## Efficient intra-process communication: +
+

+ Efficient intra-process communication: +

+ Our ROS2 Wrapper node supports zero-copy communications if loaded in the same process as a subscriber node. This can reduce copy times on image topics (not point-cloud or others), especially with big frame resolutions and high FPS. You will need to launch a component container and launch our node as a component together with other component nodes. Further details on "Composing multiple nodes in a single process" can be found [here](https://docs.ros.org/en/rolling/Tutorials/Composition.html). Further details on efficient intra-process communication can be found [here](https://docs.ros.org/en/foxy/Tutorials/Intra-Process-Communication.html#efficient-intra-process-communication). -### Example + ### Example #### Manually loading multiple components into the same process * Start the component: ```bash @@ -290,37 +484,18 @@ The launch file accepts a parameter, `intra_process_comms`, controlling whether ros2 launch realsense2_camera rs_intra_process_demo_launch.py intra_process_comms:=true ``` - -## Still in the pipeline: - - -* Migrate infra_rgb option. - -### Unit tests: -Unit-tests are based on bag files saved on S3 server. These can be downloaded using the following commands: -```bash -cd ros2_ws -wget "http://realsense-hw-public.s3.amazonaws.com/rs-tests/TestData/outdoors.bag" -P "records/" -wget "http://realsense-hw-public.s3-eu-west-1.amazonaws.com/rs-tests/D435i_Depth_and_IMU_Stands_still.bag" -P "records/" -``` -Then, unit-tests can be run using the following command (use either python or python3): -```bash -python3 src/realsense-ros/realsense2_camera/scripts/rs2_test.py --all -``` - -## License -Copyright 2022 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* + + + +[rolling-badge]: https://img.shields.io/badge/-ROLLING-orange?style=flat-square&logo=ros +[rolling]: https://docs.ros.org/en/rolling/index.html +[humble-badge]: https://img.shields.io/badge/-HUMBLE-orange?style=flat-square&logo=ros +[humble]: https://docs.ros.org/en/humble/index.html +[foxy-badge]: https://img.shields.io/badge/-FOXY-orange?style=flat-square&logo=ros +[foxy]: https://docs.ros.org/en/foxy/index.html +[galactic-badge]: https://img.shields.io/badge/-GALACTIC-orange?style=flat-square&logo=ros +[galactic]: https://docs.ros.org/en/galactic/index.html +[ubuntu22-badge]: https://img.shields.io/badge/-UBUNTU%2022%2E04-blue?style=flat-square&logo=ubuntu&logoColor=white +[ubuntu22]: https://releases.ubuntu.com/jammy/ +[ubuntu20-badge]: https://img.shields.io/badge/-UBUNTU%2020%2E04-blue?style=flat-square&logo=ubuntu&logoColor=white +[ubuntu20]: https://releases.ubuntu.com/focal/