Commit 9cb0b59
authored
fix: detect rclcpp API differences via RCLCPP_VERSION_GTE (#115)
* fix: detect Humble via rclcpp_VERSION instead of ROS_DISTRO env var
Commit 63e6e28 added a ROS_HUMBLE compile flag guarded by
`if("$ENV{ROS_DISTRO}" STREQUAL "humble")`, but in the GitHub Actions
build farm that check did not match even though ROS_DISTRO was "humble"
at configure time. As a result the Humble build compiled the Jazzy+
branch and failed with:
'get_message_typesupport_handle' is not a member of 'rclcpp';
did you mean 'get_typesupport_handle'?
Switch the detection to the rclcpp_VERSION variable populated by
find_package(rclcpp). Humble ships rclcpp 16.x (threshold <17); Jazzy
and newer ship 28.x+. This is deterministic and independent of the
invoking shell's environment.
* docs: point README CI badges at the actual workflow files
The previous badge referenced a legacy `ros2.yaml` workflow that no
longer exists. Replace with badges for the current workflows:
ros-humble, ros-jazzy, ros-rolling, and pre-commit.
* refactor: replace ROS_HUMBLE define with RCLCPP_VERSION_GTE checks
Relying on CMake `if("$ENV{ROS_DISTRO}" STREQUAL "humble")` to forward
a ROS_HUMBLE compile flag is brittle — it broke in the Humble CI
runner even though ROS_DISTRO printed as "humble". Move the
conditional compilation to the `RCLCPP_VERSION_GTE(major,minor,patch)`
preprocessor macro from `<rclcpp/version.h>`, which is the authoritative
version shipped by rclcpp itself via ament_generate_version_header.
Per-site thresholds now reflect when each API actually changed rather
than using a single rough ROS_HUMBLE flag:
- typesupport_wrapper.cpp: rclcpp::get_message_typesupport_handle was
added in Jazzy (rclcpp 28). Use it at >=28 and fall back to the
(still existing) rclcpp::get_typesupport_handle below. Humble's
rclcpp has that name too, so the rosbag2_cpp/typesupport_helpers
include is no longer needed.
- generic_publisher.h: the 6-arg rclcpp::PublisherBase constructor
(callbacks + use_default_events) was introduced between Humble and
Iron (rclcpp 17+). Guard the extra args and the callbacks_ member
on RCLCPP_VERSION_GTE(17, 0, 0).
- dataload_ros2.cpp: rosbag2 SerializedBagMessage::time_stamp was
split into recv_timestamp/send_timestamp in Jazzy; gate the new
field name on >=28 too.
With everything moved to compile-time checks the `ROS_HUMBLE` compile
definition and its CMake detection are unnecessary and have been
removed from src/CMakeLists.txt.
As a side benefit this also makes Iron compile, since the old setup
unconditionally took the Jazzy path when ROS_HUMBLE wasn't defined.1 parent 63e6e28 commit 9cb0b59
5 files changed
Lines changed: 22 additions & 33 deletions
File tree
- src
- DataLoadROS2
- TopicPublisherROS2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 48 | | |
59 | 49 | | |
60 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | | - | |
5 | 2 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 3 | | |
10 | | - | |
| 4 | + | |
| 5 | + | |
11 | 6 | | |
12 | 7 | | |
13 | 8 | | |
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 12 | | |
21 | | - | |
22 | 13 | | |
23 | 14 | | |
24 | 15 | | |
25 | 16 | | |
26 | 17 | | |
27 | 18 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
31 | 22 | | |
| 23 | + | |
| 24 | + | |
32 | 25 | | |
33 | 26 | | |
34 | 27 | | |
0 commit comments