Skip to content

Commit b5caf71

Browse files
authored
Merge pull request #36 from tfoldi/ros2_humble_build_fix
build: fix Ros2 humble build
2 parents 06bd1be + 76ca478 commit b5caf71

File tree

3 files changed

+81
-45
lines changed

3 files changed

+81
-45
lines changed

.github/workflows/build_test.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ROS2 CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'develop'
7+
- 'ros2'
8+
push:
9+
branches:
10+
- 'ros2'
11+
12+
jobs:
13+
test_environment:
14+
runs-on: [ubuntu-latest]
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
ros_distribution:
19+
- humble
20+
- iron
21+
- rolling
22+
include:
23+
# Humble Hawksbill (May 2022 - May 2027)
24+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
25+
ros_distribution: humble
26+
ros_version: 2
27+
# Iron Irwini (May 2023 - May 2028)
28+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
29+
ros_distribution: iron
30+
ros_version: 2
31+
# Rolling Ridley (June 2020 - Present)
32+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
33+
ros_distribution: rolling
34+
ros_version: 2
35+
container:
36+
image: ${{ matrix.docker_image }}
37+
steps:
38+
- name: checkout
39+
uses: actions/checkout@v2
40+
- name: install deps
41+
run: sudo apt-get -y install qtbase5-dev libqt5serialport5-dev
42+
- name: build and test
43+
uses: ros-tooling/action-ros-ci@master
44+
with:
45+
target-ros2-distro: ${{ matrix.ros_distribution }}
46+
vcs-repo-file-url: ""
47+
skip-tests: true

CMakeLists.txt

+18-20
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,8 @@ endif()
1919

2020
add_subdirectory(witmotion-uart-qt)
2121

22-
#set(CMAKE_AUTOMOC ON)
23-
#qt5_wrap_cpp(MOC_SOURCES include/witmotion_ros.h)
2422
include_directories(include)
25-
include_directories(/opt/ros/humble/include/tf2_geometry_msgs)
26-
include_directories(/opt/ros/iron/include/tf2_geometry_msgs)
2723
include_directories(witmotion-uart-qt/include)
28-
#add_library(witmotion_ros src/witmotion_ros.cpp include/witmotion_ros.h)
2924

3025

3126
find_package(ament_cmake REQUIRED)
@@ -55,27 +50,30 @@ add_library(witmotion_ros
5550

5651
message(WARNING "tf2_geometry_msgs include dir: ${tf2_geometry_msgs_INCLUDE_DIRS} ")
5752

58-
#find_package(Qt5 REQUIRED COMPONENTS Core SerialPort)
59-
set(INCLUDE_DIRS ${ament_cmake_INCLUDE_DIRS} ${tf2_INCLUDE_DIRS}
60-
${tf2_geometry_msgs_INCLUDE_DIRS} ${rclcpp_INCLUDE_DIRS}
61-
${std_srvs_INCLUDE_DIRS} ${sensor_msgs_INCLUDE_DIRS}
62-
${geometry_msgs_INCLUDE_DIRS} ${nav_msgs_INCLUDE_DIRS}
63-
${rosgraph_msgs_INCLUDE_DIRS} ${std_msgs_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5SerialPort_INCLUDE_DIRS} ${rcl_interfaces_INCLUDE_DIRS}
64-
${rclcpp_lifecycle_INCLUDE_DIRS} ${lifecycle_msgs_INCLUDE_DIRS})
65-
include_directories(${INCLUDE_DIRS})
53+
54+
set(dependencies
55+
tf2
56+
tf2_geometry_msgs
57+
rclcpp
58+
std_srvs
59+
sensor_msgs
60+
std_msgs
61+
rcl_interfaces
62+
rclcpp_lifecycle
63+
lifecycle_msgs
64+
)
65+
ament_target_dependencies(witmotion_ros ${dependencies})
66+
67+
find_package(ament_cmake_auto REQUIRED)
68+
ament_auto_find_build_dependencies()
69+
70+
6671
set(LIBRARY_DIRS ${ament_cmake_LIBRARIES} ${tf2_LIBRARIES}
6772
${tf2_geometry_msgs_LIBRARIES} ${rclcpp_LIBRARIES} ${std_srvs_LIBRARIES}
6873
${sensor_msgs_LIBRARIES} ${geometry_msgs_LIBRARIES}
6974
${nav_msgs_LIBRARIES} ${rosgraph_msgs_LIBRARIES}
7075
${std_msgs_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5SerialPort_LIBRARIES} ${rcl_interfaces_LIBRARIES} ${rclcpp_lifecycle_LIBRARIES} ${lifecycle_msgs_LIBRARIES})
7176

72-
#target_link_libraries(another PUBLIC one)
73-
set(LIBS ${ament_cmake_LIBRARIES} ${tf2_LIBRARIES}
74-
${tf2_geometry_msgs_LIBRARIES} ${rclcpp_LIBRARIES} ${std_srvs_LIBRARIES}
75-
${sensor_msgs_LIBRARIES} ${geometry_msgs_LIBRARIES}
76-
${nav_msgs_LIBRARIES} ${rosgraph_msgs_LIBRARIES}
77-
${std_msgs_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5SerialPort_LIBRARIES} ${rcl_interfaces_LIBRARIES} ${rclcpp_lifecycle_LIBRARIES} ${lifecycle_msgs_LIBRARIES})
78-
7977
target_link_libraries(witmotion_ros ${LIBRARY_DIRS} witmotion-uart Qt5::Core Qt5::SerialPort)
8078

8179

package.xml

+16-25
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,25 @@
33
<package format="3">
44
<name>witmotion_ros</name>
55
<version>0.0.0</version>
6-
<description>TODO: Package description</description>
6+
<description>Witmotion IMU sensor driver for ROS</description>
77
<maintainer email="[email protected]">pi</maintainer>
8-
<license>TODO: License declaration</license>
8+
<license>MIT</license>
99

1010
<buildtool_depend>ament_cmake</buildtool_depend>
11-
<build_depend>rclcpp</build_depend>
12-
<build_depend>sensor_msgs</build_depend>
13-
<build_depend>geometry_msgs</build_depend>
14-
<build_depend>message_runtime</build_depend>
15-
<build_depend>std_msgs</build_depend>
16-
<build_depend>std_srvs</build_depend>
17-
<build_depend>nav_core</build_depend>
18-
<build_depend>nav_msgs</build_depend>
19-
<build_depend>tf2</build_depend>
20-
<build_depend>tf2_geometry_msgs</build_depend>
21-
<build_depend>rosgraph_msgs</build_depend>
22-
<exec_depend>rclcpp</exec_depend>
23-
<exec_depend>sensor_msgs</exec_depend>
24-
<exec_depend>geometry_msgs</exec_depend>
25-
<exec_depend>message_runtime</exec_depend>
26-
<exec_depend>std_msgs</exec_depend>
27-
<exec_depend>std_srvs</exec_depend>
28-
<exec_depend>nav_core</exec_depend>
29-
<exec_depend>nav_msgs</exec_depend>
30-
<exec_depend>rosgraph_msgs</exec_depend>
31-
<exec_depend>tf2</exec_depend>
32-
<exec_depend>tf2_geometry_msgs</exec_depend>
33-
<exec_depend>libqt5-serialport-dev</exec_depend>
11+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
12+
13+
<depend>tf2_geometry_msgs</depend>
14+
<depend>rclcpp</depend>
15+
<depend>std_srvs</depend>
16+
<depend>rcl_interfaces</depend>
17+
<depend>rclcpp_lifecycle</depend>
18+
<depend>lifecycle_msgs</depend>
19+
<depend>qtbase5-dev</depend>
20+
<depend>libqt5-serialport</depend>
21+
<depend>boost</depend>
22+
<depend>nav_msgs</depend>
23+
<depend>std_msgs</depend>
24+
<depend>tf2</depend>
3425

3526
<test_depend>ament_lint_auto</test_depend>
3627
<test_depend>ament_lint_common</test_depend>

0 commit comments

Comments
 (0)