Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ROS2 compatibility mode #146

Merged
merged 38 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
75f0137
Factoring out Imu and Lidar packets handling
Samahu May 26, 2023
63484e3
Added os_driver which combines os_sensor and os_cloud +
Samahu May 31, 2023
4b08308
Move down pragma once in the handlers
Samahu May 31, 2023
fa93e0a
Adding unit tests for the ThreadSafeRingBuffer
Samahu Jun 1, 2023
129bf01
Add one more case to the unit test of ThreadSafeRingBuffer
Samahu Jun 1, 2023
f74a492
Quick hook up of the ThreadSafeRingBuffer for os_sensor and os_driver
Samahu Jun 2, 2023
a6e52f7
Add an option to select the point_cloud frame
Samahu Jun 2, 2023
82e1786
Keep transforms in Lidar Frame by default with option to switch
Samahu Jun 5, 2023
18e6658
Formatting os_sensor and os_driver
Samahu Jun 5, 2023
3b5023a
Provide support for parsing the community driver params file with app…
Samahu Jun 5, 2023
cf8ae16
Factor out tf transforms broadcast
Samahu Jun 5, 2023
bd01d65
Formatting imu and lidar packet handlers
Samahu Jun 5, 2023
3ec9f41
Fix build issue
Samahu Jun 6, 2023
4c45198
Incorporate LaserScan message composition
Samahu Jun 6, 2023
552581d
Refactor a bit and add the ability to process and publish point cloud…
Samahu Jun 7, 2023
3e98683
Restor os_cloud_node ability to process point clouds
Samahu Jun 7, 2023
cdb032f
Parse proc_mask and hook to launch files and config
Samahu Jun 7, 2023
acf7b9d
Add support for the selecting IMU + create topics/subs when their res…
Samahu Jun 7, 2023
c3f7f53
Reduce sync operations + restore sensor reset/reactivation
Samahu Jun 8, 2023
092330f
Add the ability to override current qos settings
Samahu Jun 8, 2023
78ce55c
Add minor note
Samahu Jun 8, 2023
48eadc6
More detailed explanation about the IMG node
Samahu Jun 8, 2023
b15b767
Rename the file os_sensor_cloud_image_params to os_sensor_cloud_image…
Samahu Jun 8, 2023
7a6329d
Expose use_system_default_qos parameter to xml launch file and use pr…
Samahu Jun 8, 2023
19c2ce7
Update minimal readme file and utilize os_driver by default +
Samahu Jun 8, 2023
8d28269
Update CHANGELOG.rst and package version
Samahu Jun 8, 2023
a15c588
Apply && to accepted method of ThreadSafeRingBuffer +
Samahu Jun 8, 2023
ecae950
Add missing parameter declaration
Samahu Jun 8, 2023
55ee132
Re-formatting CHANGELOG a bit
Samahu Jun 8, 2023
b14b42c
Added ImageProcessor to support IMG flag +
Samahu Jun 13, 2023
080d965
Expose scan_ring param and update relevant params description
Samahu Jun 13, 2023
22122ba
Added notes to size(), empty(), full()
Samahu Jun 14, 2023
879e15f
remove deprecated methods + naming nits
Samahu Jun 14, 2023
199c0ef
Update ChangeLog + Fix load_metadata_from_file
Samahu Jun 15, 2023
e82239c
Try out building against Iron + revise sensor_mtp.launch
Samahu Jun 15, 2023
2463778
Correct the params file name + document params
Samahu Jun 21, 2023
543f676
Carry over fixes from foxy branch
Samahu Jun 22, 2023
2dc60ae
Update README.md to mention compatibilty mode
Samahu Jun 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
ros_distro:
- rolling
- humble
- iron
steps:
- uses: actions/checkout@v3
with:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ ouster_ros(2)
* bugfix: fixed an issue that prevents running multiple instances of the sensor and cloud components
in the same process.
* switch to using static transform publisher for the ros2 driver.
* implemented a new node named ``os_driver`` which combines the functionality of ``os_sensor``,
``os_cloud`` and ``os_image`` into a single node.
* added support to parse the same parameters provided by the ``ros2_ouster_driver``, the parameters
are ``lidar_ip``, ``computer_ip``, ``proc_mask`` and ``use_system_default_qos``; the parameters
are fully functional and similar to what the ``ros2_ouster_driver`` provides.
* for convenience introduced a new launch file ``driver_launch.py`` that is compatible with the
``ros2_ouster_driver`` in terms of parameters it accepts and the name of published topics.
* introduced a new parameter ``point_cloud_frame`` to allow users to select which frame to use when
publishing the point cloud (choose between ``sensor`` and ``lidar``).
* breaking: ``lidar`` frame is the default frame used when publishing point clouds.
* added the ability to choose between ``SensorDataQoS`` or ``SystemDefaultQoS`` across all published
topics with ``SensorDataQoS`` selected by default for live sensor mode and ``SystemDefaultQoS``
enabled for record and replay modes.
* introduced a new topic ``/ouster/scan`` which publishes ``sensor_msgs::msg::LaserScan`` messages

ouster_client
-------------
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ RUN set -xe \
FROM build-env

SHELL ["/bin/bash", "-c"]

RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build \
--symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"

RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon test \
--ctest-args tests ouster_ros --rerun-failed --output-on-failure

# Entrypoint for running Ouster ros:
#
# Usage: docker run --rm -it ouster-ros [sensor.launch parameters ..]
Expand Down
72 changes: 48 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
# Official ROS driver for Ouster sensors

[ROS1 (melodic/noetic)](https://github.com/ouster-lidar/ouster-ros/tree/master) |
[ROS2 (rolling/humble)](https://github.com/ouster-lidar/ouster-ros/tree/ros2) |
[ROS2 (rolling/humble/iron)](https://github.com/ouster-lidar/ouster-ros/tree/ros2) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

[ROS2 (foxy)](https://github.com/ouster-lidar/ouster-ros/tree/ros2-foxy)

<p style="float: right;"><img width="20%" src="docs/images/logo.png" /></p>

| ROS Version | Build Status (Linux) |
|:-----------:|:------:|
| ROS1 (melodic/noetic) | [![melodic/noetic](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml/badge.svg?branch=master)](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml)
| ROS2 (rolling/humble) | [![rolling/humble](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml/badge.svg?branch=ros2)](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml)
| ROS2 (rolling/humble/iron) | [![rolling/humble/iron](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml/badge.svg?branch=ros2)](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml)
| ROS2 (foxy) | [![foxy](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml/badge.svg?branch=ros2-foxy)](https://github.com/ouster-lidar/ouster-ros/actions/workflows/docker-image.yml)

- [Overview](#overview)
- [Requirements](#requirements)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Launching Nodes](#launching-nodes)
- [Sensor Mode](#sensor-mode)
- [Recording Mode](#recording-mode)
- [Replay Mode](#replay-mode)
- [Multicast Mode (experimental)](#multicast-mode-experimental)
- [Invoking Services](#invoking-services)
- [GetMetadata](#getmetadata)
- [GetConfig](#getconfig)
- [SetConfig (experimental)](#setconfig-experimental)
- [License](#license)
- [Official ROS driver for Ouster sensors](#official-ros-driver-for-ouster-sensors)
- [Overview](#overview)
- [Requirements](#requirements)
- [Linux](#linux)
- [Windows](#windows)
- [Mac](#mac)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Launching Nodes](#launching-nodes)
- [Sensor Mode](#sensor-mode)
- [Recording Mode](#recording-mode)
- [Replay Mode](#replay-mode)
- [Multicast Mode (experimental)](#multicast-mode-experimental)
- [Invoking Services](#invoking-services)
- [GetMetadata](#getmetadata)
- [GetConfig](#getconfig)
- [SetConfig](#setconfig)
- [Reset](#reset)
- [License](#license)


## Overview
Expand All @@ -38,8 +43,9 @@ dual return and it was configured to use this capability, then another topic wil
name `/ouster/points2` which corresponds to the second point cloud.

## Requirements
This driver only supports **Rolling** and **Humble** ROS 2 distros. Please refer to ROS 2 online
documentation on how to setup ros on your machine before proceeding with the remainder of this guide.
This branch is only intended for use with **Rolling**, **Humble** and **Iron** ROS 2 distros. Please
refer to ROS 2 online documentation on how to setup ROS on your machine before proceeding with the
remainder of this guide.

> **Note**
> If you have _rosdep_ tool installed on your system you can then use the following command to get all
Expand All @@ -57,7 +63,7 @@ sudo apt install -y \
ros-$ROS_DISTRO-tf2-eigen \
ros-$ROS_DISTRO-rviz2
```
where `$ROS_DISTRO` is either ``rolling`` or ``humble``.
where `$ROS_DISTRO` can be either ``rolling``, ``humble`` or ``iron``.

> **Note**
> Installing `ros-$ROS_DISTRO-rviz` package is optional in case you didn't need to visualize the
Expand Down Expand Up @@ -99,7 +105,7 @@ git clone -b ros2 --recurse-submodules https://github.com/ouster-lidar/ouster-ro

Next to compile the driver you need to source the ROS environemt into the active termainl:
```bash
source /opt/ros/<ros-distro>/setup.bash # replace ros-distro with 'rolling' or 'humble'
source /opt/ros/<ros-distro>/setup.bash # replace ros-distro with 'rolling', 'humble', or 'iron'
```

Finally, invoke `colcon build` command from within the catkin workspace as shown below:
Expand All @@ -119,14 +125,32 @@ source ros2_ws/install/setup.bash
## Usage

### Launching Nodes
The package supports three modes of interaction, you can connect to a _live sensor_, _replay_ a recorded bag or _record_ a new bag file using the corresponding launch files. Recently, we have
added a new mode that supports multicast. The commands are listed below:
The package supports three modes of interaction, you can connect to a _live sensor_, _replay_ a recorded
bag or _record_ a new bag file using the corresponding launch files. Recently, we have added a new mode
that supports multicast. The commands are listed below, for convenience we do provide both launch file
formats (xml and python) but the python format is the preferred method:

#### Sensor Mode
To connect to a live sensor you use the following launch file
```bash
ros2 launch ouster_ros sensor.launch.xml \
sensor_hostname:=<sensor host name>
```
The equivalent python file is:
```bash
ros2 launch ouster_ros driver.launch.py \
params_files:=<path to params yaml file>
```
If you don't pass a params_file then the file located at `ouster/config/driver_params.yaml` will be used. Note that in
the params you can start with default options for everything except the `sensor_hostname` param which you should adjust
to match the hostname or ip address of the Ouster sensor you are trying to connect to.

**comptability mode**
If you are migrating from https://github.com/ros-drivers/ros2_ouster_drivers to the official ouster drivers
we supply you with a file `driver_launch.py` which provides users with same topic name and accepts the same
parameter file `community_driver_config.yaml`. Please note that this is provided for backward compatibilty
it may not be maintained in the future, so it would be better to update to the new format `driver_params.yaml`
which offers the same options and more.

#### Recording Mode
> Note
Expand Down Expand Up @@ -197,14 +221,14 @@ To get the current config of a live sensor, invoke the command:
ros2 service call /ouster/get_config ouster_srvs/srv/GetConfig
```

#### SetConfig (experimental)
#### SetConfig
To change config via a file while connected to a live sensor, invoke the command:
```bash
ros2 service call /ouster/set_config ouster_srvs/srv/SetConfig \
"{config_file: 'some_config.json'}"
```

#### Reset (experimental)
#### Reset
To reset the new reset service, execute the following commnad:
```bash
ros2 service call /ouster/reset std_srvs/srv/Empty
Expand Down
23 changes: 23 additions & 0 deletions ouster-ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,28 @@ rclcpp_components_register_node(os_image_component
EXECUTABLE os_image
)

# ==== os_sensor_component ====
create_ros2_component(os_driver_component
"src/os_sensor_node_base.cpp;src/os_sensor_node.cpp;src/os_driver_node.cpp"
"std_srvs"
)
rclcpp_components_register_node(os_driver_component
PLUGIN "ouster_ros::OusterDriver"
EXECUTABLE os_driver
)


# ==== Test ====
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
ament_add_gtest(${PROJECT_NAME}_test test/ring_buffer_test.cpp)
target_include_directories(${PROJECT_NAME}_test PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
endif()


# ==== Install ====
install(
TARGETS
Expand All @@ -164,6 +186,7 @@ install(
os_replay_component
os_cloud_component
os_image_component
os_driver_component
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
Expand Down
Loading