Skip to content

Commit 83ec345

Browse files
authored
Merge pull request #197 from conan-io/danimtb/update-ros2-examples
Update ROS examples to ROS Kilted version
2 parents 88d3368 + a32bc83 commit 83ec345

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

.github/workflows/ros-tests.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,46 @@ jobs:
1212
test_conan_release:
1313
runs-on: ubuntu-latest
1414
container:
15-
image: osrf/ros:humble-desktop
15+
image: osrf/ros:kilted-desktop
1616

1717
steps:
1818
- name: Checkout repository
1919
uses: actions/checkout@v3
2020

2121
- name: Configure environment and install Conan release
2222
run: |
23-
apt-get update && apt-get install -y python3 python3-pip
24-
python3 -m pip install conan
23+
apt-get update && apt-get install -y python3 python3-pip python3-venv pipx ros-kilted-nav2-msgs
24+
pipx install conan
2525
chmod +x ./examples/tools/ros/rosenv/workspace/test_ros.sh
26+
chmod +x ./examples/tools/ros/rosenv/navigation_ws/test_ros.sh
2627
27-
- name: Run example with latest Conan release
28+
- name: Run printer example
2829
shell: bash
2930
run: |
3031
cd examples/tools/ros/rosenv/workspace
3132
./test_ros.sh
3233
34+
- name: Run navigator example
35+
shell: bash
36+
run: |
37+
cd examples/tools/ros/rosenv/navigation_ws
38+
./test_ros.sh
39+
3340
test_conan_develop2:
3441
runs-on: ubuntu-latest
3542
container:
36-
image: osrf/ros:humble-desktop
43+
image: osrf/ros:kilted-desktop
3744

3845
steps:
3946
- name: Checkout repository
4047
uses: actions/checkout@v3
4148

4249
- name: Configure environment and install Conan from develop2 branch
4350
run: |
44-
apt-get update && apt-get install -y python3 python3-pip
45-
python3 -m pip install git+https://github.com/conan-io/conan.git
51+
apt-get update && apt-get install -y python3 python3-pip python3-venv pipx ros-kilted-nav2-msgs
52+
pipx install git+https://github.com/conan-io/conan.git
4653
chmod +x ./examples/tools/ros/rosenv/workspace/test_ros.sh
54+
chmod +x ./examples/tools/ros/rosenv/navigation_ws/test_ros.sh
4755
4856
- name: Run printer example
4957
shell: bash

examples/tools/ros/rosenv/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM osrf/ros:humble-desktop
1+
FROM osrf/ros:kilted-desktop
22
RUN apt-get update && apt-get install -y \
33
curl \
44
python3-pip \
55
git \
6-
ros-humble-nav2-msgs \
6+
ros-kilted-nav2-msgs \
77
&& rm -rf /var/lib/apt/lists/*
88
RUN pip3 install --upgrade pip && pip3 install conan
99
RUN conan profile detect

examples/tools/ros/rosenv/navigation_ws/navigation_package/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.15)
22
project(navigation_package)
33

44
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -17,7 +17,12 @@ find_package(yaml-cpp REQUIRED)
1717
add_executable(navigator src/navigator.cpp)
1818

1919
target_compile_features(navigator PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
20-
ament_target_dependencies(navigator rclcpp rclcpp_action nav2_msgs yaml-cpp)
20+
target_link_libraries(navigator PUBLIC
21+
${nav2_msgs_TARGETS}
22+
rclcpp::rclcpp
23+
rclcpp_action::rclcpp_action
24+
yaml-cpp::yaml-cpp
25+
)
2126

2227
install(TARGETS navigator
2328
DESTINATION lib/${PROJECT_NAME})

examples/tools/ros/rosenv/navigation_ws/test_ros.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
source /opt/ros/humble/setup.bash
1+
pipx ensurepath
2+
source ~/.bashrc
3+
4+
source /opt/ros/kilted/setup.bash
25
rosdep init
36
rosdep update
47
rosdep install --from-paths navigation_package/

examples/tools/ros/rosenv/workspace/consumer/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.15)
22
project(consumer)
33

44
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -16,7 +16,7 @@ target_include_directories(main PUBLIC
1616
$<INSTALL_INTERFACE:include>)
1717

1818
target_compile_features(main PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
19-
ament_target_dependencies(main str_printer)
19+
target_link_libraries(main PUBLIC str_printer::str_printer)
2020

2121
install(TARGETS main
2222
DESTINATION lib/${PROJECT_NAME})

examples/tools/ros/rosenv/workspace/str_printer/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.15)
22
project(str_printer)
33

44
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -16,7 +16,7 @@ target_include_directories(str_printer PUBLIC
1616
$<INSTALL_INTERFACE:include>)
1717

1818
target_compile_features(str_printer PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
19-
ament_target_dependencies(str_printer fmt)
19+
target_link_libraries(str_printer PUBLIC fmt::fmt)
2020

2121
ament_export_targets(str_printerTargets HAS_LIBRARY_TARGET)
2222
ament_export_dependencies(fmt)

examples/tools/ros/rosenv/workspace/test_ros.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
source /opt/ros/humble/setup.bash
1+
pipx ensurepath
2+
source ~/.bashrc
3+
4+
source /opt/ros/kilted/setup.bash
25
conan profile detect --force
36
conan install str_printer/conanfile.txt --build=missing --output-folder install/conan
47
source install/conan/conanrosenv.sh

0 commit comments

Comments
 (0)