Skip to content

Commit 51e09e8

Browse files
authored
Support ROS2 Jazzy (#334)
* Use cuda::std::complex instead of thrust::complex thrust types do not have a consistent ABI between TUs compiled with and without nvcc * Support ROS2 jazzy * Use std::complex in host code & cuda::std::complex in device code * Remove debugging leftover * Support ROS2 Jazzy standalone on Windows * Update docs
1 parent c7ea149 commit 51e09e8

File tree

10 files changed

+126
-88
lines changed

10 files changed

+126
-88
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ if (RGL_BUILD_PCL_EXTENSION)
158158
endif()
159159

160160
if (RGL_BUILD_ROS2_EXTENSION)
161+
if (WIN32) # Workaround for compilation on Windows. fastcdr must be found from the top-level of cmake.
162+
find_package(fastcdr REQUIRED)
163+
endif()
161164
add_subdirectory(extensions/ros2)
162165
endif()
163166

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ And more:
4545

4646
## Runtime requirements
4747

48-
|Hardware|Requirement|
49-
|:--|:--|
50-
|GPU|CUDA-enabled|
48+
| Hardware | Requirement |
49+
|:---------|:-------------|
50+
| GPU | CUDA-enabled |
5151

52-
|Software|Requirement|
53-
|:--|:--|
54-
|Nvidia Driver (Linux)|>=515.43.04|
55-
|Nvidia Driver (Windows)|>=472.50|
52+
| Software | Requirement |
53+
|:--------------|:-------------------------------------------------------------------------------------------------|
54+
| Nvidia Driver | - Ubuntu 22.04 `>=515.43.04` <br/> - Ubuntu 24.04 `>=555.42.02` <br/> - Windows 10/11 `>=472.50` |
5655

5756
## Usage
5857

@@ -62,8 +61,8 @@ An introduction to the RGL API along with an example can be found [here](docs/Us
6261

6362
`RobotecGPULidar` library can be built with extensions enhancing RGL with additional functions:
6463
- `PCL` - adds nodes and functions for point cloud processing that uses [Point Cloud Library](https://pointclouds.org/). See [documentation](docs/PclExtension.md).
65-
- `ROS2` - adds a node to publish point cloud messages to [ROS2](https://www.ros.org/). Check [ROS2 extension doc](docs/Ros2Extension.md) for more information, build instructions, and usage.
66-
- `UDP` - adds a node to publish raw lidar packets, as emitted by physical lidar. Only available in the closed-source version.
64+
- `ROS2` - adds a nodes for point cloud publishing to [ROS2](https://www.ros.org/). See [documentation](docs/Ros2Extension.md).
65+
- `UDP` - adds a nodes for raw lidar packets publishing, as emitted by physical lidar. Only available in the closed-source version.
6766

6867
## Building in Docker (Linux)
6968

@@ -94,9 +93,11 @@ docker build \
9493
--output=build .
9594
```
9695

97-
## Building on Ubuntu 22
96+
## Building on Ubuntu 22/24
9897

99-
1. Install [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) **11.7+**.
98+
1. Install [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads)
99+
- Ubuntu 22.04: **11.7+**
100+
- Ubuntu 24.04: **12.6+**
100101
2. Download [NVidia OptiX](https://developer.nvidia.com/designworks/optix/downloads/legacy) **7.2**.
101102
1. You may be asked to create a Nvidia account to download
102103
3. Export environment variable:

docs/Ros2Extension.md

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# RGL ROS2 extension
22

3-
The extension introduces the node to publish [PointCloud2](https://docs.ros2.org/foxy/api/sensor_msgs/msg/PointCloud2.html) messages to ROS2. RGL creates a ROS2 node named `RobotecGPULidar` and registers publishers based on constructed RGL nodes.
3+
The extension introduces nodes to publish [PointCloud2](https://docs.ros2.org/foxy/api/sensor_msgs/msg/PointCloud2.html) messages to ROS2. RGL creates a ROS2 node named `RobotecGPULidar` and registers publishers based on constructed RGL nodes.
44

55
Supported ROS2 distributions:
66
- Humble
7+
- Jazzy
78

89
Supported DDS implementations for ROS2 standalone build:
910
- Eclipse Cyclone DDS
@@ -14,24 +15,29 @@ Supported DDS implementations for ROS2 standalone build:
1415
RGL ROS2 extension can be built in two flavors:
1516

1617
- **standalone** - ROS2 installation is not required on the target machine. RGL build will include all required ROS2 dependencies.
17-
- **overlay** - Assumes the existence of supported ROS2 installation on the target machine. RGL will try to use the existing installation of ROS2 dependencies.
18+
- **overlay** - Assumes the existence of supported ROS2 installation on the target machine. RGL will use ROS2 libraries already installed on the system.
1819

19-
Before building RGL PCL extension, it is necessary to get the required dependencies.
20+
Before building RGL ROS2 extension, it is necessary to get the required dependencies.
2021
For some, the process has been automated - run `setup.py --install-ros2-deps` to get them.
2122

22-
### Ubuntu 22
23+
### Ubuntu 22/24
2324

2425
#### Prerequisites
2526

26-
- Requirements listed in the main [README](../README.md) (section `Building on Ubuntu`).
27-
- ROS2 installed on the system and sourced.
27+
- Requirements listed in the main [README](../README.md#building-on-ubuntu-2224).
28+
- ROS2 installed on the system and sourced:
29+
- ROS2 Humble for Ubuntu 22
30+
- ROS2 Jazzy for Ubuntu 24
31+
- Radar messages installed:
32+
```bash
33+
apt install -y ros-${ROS_DISTRO}-radar-msgs
34+
```
2835
- For standalone build:
2936
- ROS2 `cyclonedds` and `fastrtps` packages.
3037
- `patchelf` tool.
3138
```bash
3239
apt install -y ros-${ROS_DISTRO}-cyclonedds ros-${ROS_DISTRO}-rmw-cyclonedds-cpp
3340
apt install -y ros-${ROS_DISTRO}-fastrtps ros-${ROS_DISTRO}-rmw-fastrtps-cpp
34-
apt install -y ros-${ROS_DISTRO}-radar-msgs
3541
apt install patchelf
3642
```
3743

@@ -40,45 +46,38 @@ For some, the process has been automated - run `setup.py --install-ros2-deps` to
4046

4147
#### Steps for standalone
4248
1. Use script `setup.py` with option `--with-ros2-standalone`
43-
- You can specify run-time search path(s) of RGL dependencies by adding the option `--lib-rpath <paths>`. This can be useful if you want RGL to search for ROS2 libraries in a different directory than RGL, e.g., if you work with a library providing its own ROS2 libraries, such as [ROS2ForUnity](https://github.com/RobotecAI/ros2-for-unity).
44-
2. Copy all ROS2 libraries from `<build-dir>/ros2_standalone/` to `libRobotecGPULidar.so` location (or location defined with `--lib-rpath`).
49+
- You can specify run-time search path(s) of RGL dependencies by adding the option `--lib-rpath <paths>`. This can be useful if you want RGL to search for ROS2 libraries in a different directory than RGL, e.g., if you work with a library that also provides its ROS2 libraries, such as [ROS2ForUnity](https://github.com/RobotecAI/ros2-for-unity).
50+
2. Copy all ROS2 libraries from `<build-dir>/lib/ros2_standalone/` to `libRobotecGPULidar.so` location (or location defined with `--lib-rpath`).
51+
52+
#### Tips for integrating RGL with [AWSIM](https://github.com/tier4/AWSIM/tree/main)
53+
54+
AWSIM project includes two ROS-based plugins: [ROS2ForUnity](https://github.com/RobotecAI/ros2-for-unity) and [RGLUnityPlugin](https://github.com/tier4/AWSIM/tree/main/Assets/RGLUnityPlugin). Since AWSIM is configured to run in a standalone mode (where ROS does not need to be installed on the host machine), all necessary ROS libraries are included within the project.
55+
Ros2ForUnity and RGLUnityPlugin share a common set of ROS libraries (e.g., `librcl.so`).
56+
To avoid duplication - since Unity does not support having multiple instances of the same libraries - one of the solutions is to store all ROS libraries in a single plugin.
57+
In this case, the ROS libraries are stored in the ROS2ForUnity plugin, and RGL is configured with a runtime search path to access them.
4558

46-
#### Tips for integrating RGL + ROS2 standalone with Unity and [ROS2ForUnity](https://github.com/RobotecAI/ros2-for-unity) plugin.
4759
1. Build RGL with the command:
4860
```bash
4961
./setup.py --with-ros2-standalone --lib-rpath \$ORIGIN/../../../../Ros2ForUnity/Plugins/Linux/x86_64/
5062
```
5163
*$ORIGIN represents the directory in which an object (library) originated. It is resolved at run-time.*\
5264
*Your rpath may differ. It depends on your relative location between RGLUnityPlugin and Ros2ForUnity.*
53-
2. Copy library `<build-dir>/libRobotecGPULidar.so` to the appropriate directory in your RGLUnityPlugin.
54-
3. Copy all ROS2 libraries from `<build-dir>/ros2_standalone/` to `Ros2ForUnity\Plugins\Linux\x86_64` directory. Skip for duplicates.
55-
56-
RGL's ROS2 standalone build is dependent on ROS2ForUnity's ROS2 standalone build. RobotecGPULidar library will find ROS2 because we have set the appropriate rpath for the ROS2 libraries in ROS2ForUnity.
65+
2. Copy library `<build-dir>/lib/libRobotecGPULidar.so` to the appropriate directory in your RGLUnityPlugin.
66+
3. Copy all ROS2 libraries from `<build-dir>/lib/ros2_standalone/` to `Ros2ForUnity\Plugins\Linux\x86_64` directory. **Skip for duplicates**.
5767

5868
### Windows
5969

6070
#### Prerequisites
6171

62-
- Requirements listed in the main [README](../README.md) (section `Building on Windows`).
63-
- ROS2 installed on the system and sourced.
64-
- Fixed ROS2 logging macros in rclcpp package to make it compile with C++20. More about this bug: [github PR](https://github.com/ros2/rclcpp/pull/2063).
72+
- Requirements listed in the main [README](../README.md#building-on-windows).
73+
- ROS2 installed on the system and sourced. We recommend installation from a pre-built binary package:
74+
- [ROS2 Humble](https://docs.ros.org/en/humble/Installation/Windows-Install-Binary.html)
75+
- [ROS2 Jazzy](https://docs.ros.org/en/jazzy/Installation/Windows-Install-Binary.html)
76+
- [ROS2 Humble only] Fixed ROS2 logging macros in rclcpp package to make it compile with C++20. More about this bug: [github PR](https://github.com/ros2/rclcpp/pull/2063).
6577
- Use `fix_ros2_humble.py` script to apply those changes:
6678
```bash
6779
python ros2_standalone\fix_ros2_humble.py <your-path-to-ros2>
6880
```
69-
- For standalone build:
70-
- If you have installed ROS2 from pre-built binaries, there is `rmw_cyclonedds_cpp` package missing. You need to build this one from the source:
71-
1. Make sure you have installed [ROS2 prerequisites](https://docs.ros.org/en/humble/Installation/Alternatives/Windows-Development-Setup.html#installing-prerequisites).
72-
2. A good practice is to disable Windows path limits, [see](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry).
73-
3. Run `x64 Native Tools Command Prompt for VS 2019`, setup development folder (e.g., `C:\rosrmw`), clone ROS2 repos, and build:
74-
```bash
75-
md \rosrmw\src
76-
cd \rosrmw
77-
vcs import --input https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos src
78-
colcon build --merge-install --packages-up-to rmw_cyclonedds_cpp
79-
```
80-
4. Before building RGL, source `rosrmw` workspace: `call C:\rosrmw\install\setup.bat`.
81-
8281

8382
#### Steps for overlay
8483
1. Run `x64 Native Tools Command Prompt for VS 2019` and navigate to RGL repository.
@@ -87,14 +86,17 @@ RGL's ROS2 standalone build is dependent on ROS2ForUnity's ROS2 standalone build
8786
#### Steps for standalone
8887
1. Run `x64 Native Tools Command Prompt for VS 2019` and navigate to RGL repository.
8988
2. Run `python setup.py --with-ros2-standalone` command to build RGL with ROS2 extension and install ROS2 libraries.
90-
3. Copy all ROS2 libraries from `<build-dir>/ros2_standalone/` into `RobotecGPULidar.dll` location, or extend environment variable `Path` appropriately.
89+
3. Copy all ROS2 libraries from `<build-dir>/lib/ros2_standalone/` into `RobotecGPULidar.dll` location, or extend environment variable `Path` appropriately.
90+
91+
#### Tips for integrating RGL with [AWSIM](https://github.com/tier4/AWSIM/tree/main)
92+
93+
See description from [Ubuntu section](#tips-for-integrating-rgl-with-awsim) for more details.
9194

92-
#### Tips for integrating RGL + ROS2 standalone with Unity and [ROS2ForUnity](https://github.com/RobotecAI/ros2-for-unity) plugin.
9395
1. Build RGL with ROS2 standalone as described above.
94-
2. Copy `<build-dir>/RobotecGPULidar.dll` and all depend libraries located in `<build-dir>` to the appropriate directory in your RGLUnityPlugin.
95-
3. Copy all ROS2 libraries from `<build-dir>/ros2_standalone/` to `Ros2ForUnity\Plugins\Windows\x86_64` directory. Skip for duplicates.
96+
2. Copy `<build-dir>/RobotecGPULidar.dll` and all dependent libraries located in `<build-dir>` to the appropriate directory in your RGLUnityPlugin.
97+
3. Copy all ROS2 libraries from `<build-dir>/lib/ros2_standalone/` to `Ros2ForUnity\Plugins\Windows\x86_64` directory. Skip for duplicates.
9698

97-
RGL's ROS2 standalone build is dependent on ROS2ForUnity's ROS2 standalone build. RobotecGPULidar library will find ROS2 because ROS2ForUnity sets the environment variable `Path` for the ROS2 libraries.
99+
*Note:* On Windows there is no `-rpath` linker flag to modify an executable’s search path. Instead, the `Path` environment variable can be set. ROS2ForUnity handles this automatically before the simulation starts.
98100

99101
## Usage
100102

extensions/ros2/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

2-
if (NOT $ENV{ROS_DISTRO} STREQUAL "humble")
3-
message(FATAL_ERROR "ROS $ENV{ROS_DISTRO} not supported. Only humble is available.")
2+
set(SUPPORTED_ROS_DISTROS humble jazzy)
3+
4+
list(FIND SUPPORTED_ROS_DISTROS $ENV{ROS_DISTRO} ROS_DISTRO_INDEX)
5+
if (ROS_DISTRO_INDEX EQUAL -1)
6+
message(FATAL_ERROR "ROS $ENV{ROS_DISTRO} not supported. Choose one of: '${SUPPORTED_ROS_DISTROS}'.")
47
endif()
58

69
find_package(rclcpp REQUIRED)

extensions/ros2/install_deps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class Config:
10-
SUPPORTED_ROS_DISTROS = ["humble"]
10+
SUPPORTED_ROS_DISTROS = ["humble", "jazzy"]
1111

1212
# Paths relative to project root
1313
RADAR_MSGS_DIR = os.path.join("external", "radar_msgs")
@@ -39,7 +39,6 @@ def install_ros2_deps(cfg):
3939
run_subprocess_command("sudo apt-get install -y python3-colcon-common-extensions")
4040
# Clone radar msgs
4141
if not os.path.isdir(cfg.RADAR_MSGS_DIR):
42-
run_subprocess_command("ls")
4342
run_subprocess_command(
4443
f"git clone --single-branch --depth 1 https://github.com/ros-perception/radar_msgs.git {cfg.RADAR_MSGS_DIR}")
4544
run_subprocess_command(f"cd {cfg.RADAR_MSGS_DIR} && git checkout {cfg.RADAR_MSGS_COMMIT} && cd ..")

ros2_standalone/CMakeLists.txt

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ set(REQ_THIRD_PARTY_STANDALONE_LIBS "")
1717
set(REQ_STANDALONE_DLLS "")
1818

1919
set(INSTALL_DESTINATION_DIR "lib/ros2_standalone")
20+
set(ROS_DISTRO "$ENV{ROS_DISTRO}")
2021

2122
# Extend REQ_THIRD_PARTY_STANDALONE_LIBS with _library_name third party dependencies
2223
macro(get_standalone_third_party_dependencies _library_name)
@@ -104,6 +105,12 @@ macro(get_standalone_dependencies _library_name)
104105
endif()
105106
endif()
106107

108+
# Get rosidl_dynamic_typesupport_fastrtps
109+
if("${_library_name}" STREQUAL "rosidl_dynamic_typesupport_fastrtps")
110+
fetch_target_lib(rosidl_dynamic_typesupport_fastrtps::rosidl_dynamic_typesupport_fastrtps)
111+
list(APPEND REQ_STANDALONE_LIBS ${rosidl_dynamic_typesupport_fastrtps_rosidl_dynamic_typesupport_fastrtps_LIB_PATH})
112+
endif()
113+
107114
# If library is msgs, fetch all targets to get libraries for dynamic type support
108115
# Those libraries are not listed in <XX>_LIBRARIES (which stands for libraries to link against to use <XX>)
109116
if(${_library_name} MATCHES ".*\_msgs$")
@@ -116,12 +123,20 @@ macro(get_standalone_dependencies _library_name)
116123
endif()
117124

118125
# Get spdlog and dependency
119-
if(UNIX AND "${_library_name}" STREQUAL "spdlog")
126+
if("${_library_name}" STREQUAL "spdlog")
120127
include(${${_library_name}_CONFIG})
121128
fetch_target_lib(spdlog::spdlog)
122129
list(APPEND REQ_STANDALONE_LIBS ${spdlog_spdlog_LIB_PATH})
123-
fetch_target_lib(fmt::fmt)
124-
list(APPEND REQ_STANDALONE_LIBS ${fmt_fmt_LIB_PATH})
130+
if(UNIX)
131+
fetch_target_lib(fmt::fmt)
132+
list(APPEND REQ_STANDALONE_LIBS ${fmt_fmt_LIB_PATH})
133+
endif()
134+
endif()
135+
136+
# Get yaml
137+
if(WIN32 AND "${_library_name}" STREQUAL "yaml")
138+
fetch_target_lib(yaml)
139+
list(APPEND REQ_STANDALONE_LIBS ${yaml_LIB_PATH})
125140
endif()
126141

127142
# We skip python libs
@@ -223,14 +238,23 @@ set(ros2_standalone_libs
223238
rosidl_typesupport_cpp
224239
rosidl_typesupport_introspection_c
225240
rosidl_typesupport_introspection_cpp
226-
spdlog
227241
tracetools
228-
yaml
229242
tinyxml2
230243
)
231244

232245
if(UNIX)
233-
list(APPEND ros2_standalone_libs iceoryx_binding_c iceoryx_posh iceoryx_hoofs)
246+
list(APPEND ros2_standalone_libs spdlog iceoryx_binding_c iceoryx_posh iceoryx_hoofs)
247+
endif()
248+
249+
if(ROS_DISTRO STREQUAL "humble")
250+
list(APPEND ros2_standalone_libs yaml)
251+
endif()
252+
253+
if(ROS_DISTRO STREQUAL "jazzy")
254+
list(APPEND ros2_standalone_libs rcl_logging_spdlog rcl_interfaces rosidl_dynamic_typesupport_fastrtps)
255+
if(WIN32)
256+
list(APPEND ros2_standalone_libs yaml spdlog)
257+
endif()
234258
endif()
235259

236260
foreach(ros2_standalone_lib ${ros2_standalone_libs})

0 commit comments

Comments
 (0)