Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 61 additions & 0 deletions .github/workflows/jazzy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: ROS 2 Jazzy CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ros_distro: [jazzy]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: src/qt_rviz2_tutorial

- name: Setup ROS 2 environment
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: ${{ matrix.ros_distro }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
python3-colcon-common-extensions \
python3-rosdep \
qtbase5-dev \
qtdeclarative5-dev \
libqt5svg5-dev

- name: Initialize rosdep
run: |
sudo rosdep init || true
rosdep update

- name: Install package dependencies
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
rosdep install --from-paths src --ignore-src -r -y

- name: Build workspace
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers console_direct+

- name: Run tests
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
source install/setup.bash
colcon test --event-handlers console_direct+
colcon test-result --verbose
65 changes: 65 additions & 0 deletions .github/workflows/ros2_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ROS 2 CI (Multi-Distribution)

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ros_distro: humble
ubuntu_version: ubuntu-22.04
- ros_distro: jazzy
ubuntu_version: ubuntu-24.04
- ros_distro: rolling
ubuntu_version: ubuntu-24.04

container:
image: ros:${{ matrix.ros_distro }}-ros-base

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: src/qt_rviz2_tutorial

- name: Install dependencies
run: |
apt-get update
apt-get install -y \
python3-colcon-common-extensions \
python3-rosdep \
qtbase5-dev \
qtdeclarative5-dev \
libqt5svg5-dev

- name: Initialize rosdep
run: |
rosdep init || true
rosdep update

- name: Install package dependencies
run: |
. /opt/ros/${{ matrix.ros_distro }}/setup.sh
rosdep install --from-paths src --ignore-src -r -y

- name: Build workspace
run: |
. /opt/ros/${{ matrix.ros_distro }}/setup.sh
colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers console_direct+

- name: Run tests
run: |
. /opt/ros/${{ matrix.ros_distro }}/setup.sh
. install/setup.sh
colcon test --event-handlers console_direct+
colcon test-result --verbose
4 changes: 3 additions & 1 deletion 10_rviz2panel_hello/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/
)
ament_auto_add_library(rviz2panel_hello SHARED
src/widget/rviz2panel_hello.ui
src/widget/rviz2panel_hello.ui
src/widget/widget.cpp)
target_link_libraries(rviz2panel_hello ${QT5_LIBS})

Expand All @@ -28,6 +28,8 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
set(ament_cmake_lint_cmake_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
1 change: 1 addition & 0 deletions 10_rviz2panel_hello/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>pluginlib</depend>
<depend>rviz_common</depend>
<depend>qtbase5-dev</depend>

Expand Down
8 changes: 5 additions & 3 deletions 11_rviz2panel_hello_template/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set(QT5_LIBS Qt5::Core Qt5::Gui Qt5::Widgets)

# ===== Widget =====
ament_auto_add_library(rviz2panel_hello_template_rviz SHARED
src/widget/base/rviz2panel_hello_template.ui
src/widget/base/rviz2panel_hello_template.ui
src/widget/base/base_widget.cpp
src/widget/rviz_widget.cpp
)
Expand All @@ -29,9 +29,9 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_WIDGET}_autogen/include
)
ament_auto_add_library(${TARGET_WIDGET} SHARED
src/widget/base/rviz2panel_hello_template.ui
src/widget/base/rviz2panel_hello_template.ui
src/widget/base/base_widget.cpp
src/widget/qt_widget.hpp
src/widget/qt_widget.cpp
)
target_link_libraries(${TARGET_WIDGET} ${QT5_LIBS})
set(QT5_LIBS ${QT5_LIBS} ${TARGET_WIDGET})
Expand All @@ -52,6 +52,8 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
set(ament_cmake_lint_cmake_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
1 change: 1 addition & 0 deletions 11_rviz2panel_hello_template/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>pluginlib</depend>
<depend>rviz_common</depend>
<depend>qtbase5-dev</depend>

Expand Down
4 changes: 3 additions & 1 deletion 12_rviz2panel_pubsub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/
)
ament_auto_add_library(rviz2panel_pubsub SHARED
src/widget/rviz2panel_pubsub.ui
src/widget/rviz2panel_pubsub.ui
src/widget/widget.cpp)
target_link_libraries(rviz2panel_pubsub ${QT5_LIBS})

Expand All @@ -28,6 +28,8 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
set(ament_cmake_lint_cmake_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
1 change: 1 addition & 0 deletions 12_rviz2panel_pubsub/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>pluginlib</depend>
<depend>rviz_common</depend>
<depend>qtbase5-dev</depend>

Expand Down
4 changes: 3 additions & 1 deletion 13_rviz2panel_service_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/
)
ament_auto_add_library(rviz2panel_service_client SHARED
src/widget/rviz2panel_service_client.ui
src/widget/rviz2panel_service_client.ui
src/widget/widget.cpp)
target_link_libraries(rviz2panel_service_client ${QT5_LIBS})

Expand All @@ -28,6 +28,8 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
set(ament_cmake_lint_cmake_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
1 change: 1 addition & 0 deletions 13_rviz2panel_service_client/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>example_interfaces</depend>
<depend>pluginlib</depend>
<depend>rviz_common</depend>
<depend>qtbase5-dev</depend>

Expand Down
4 changes: 3 additions & 1 deletion 14_rviz2panel_action_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/
)
ament_auto_add_library(rviz2panel_action_client SHARED
src/widget/rviz2panel_action_client.ui
src/widget/rviz2panel_action_client.ui
src/widget/widget.cpp)
target_link_libraries(rviz2panel_action_client ${QT5_LIBS})

Expand All @@ -28,6 +28,8 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
set(ament_cmake_lint_cmake_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
1 change: 1 addition & 0 deletions 14_rviz2panel_action_client/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>example_interfaces</depend>
<depend>pluginlib</depend>
<depend>rviz_common</depend>
<depend>qtbase5-dev</depend>

Expand Down
11 changes: 10 additions & 1 deletion 20_qt5_hello_ros2_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_WIDGET}_autogen/include
)
add_library(${TARGET_WIDGET}
src/widget/qt5_hello_ros2_cmake.ui
src/widget/qt5_hello_ros2_cmake.ui
src/widget/widget.cpp)
target_link_libraries(${TARGET_WIDGET} ${QT5_LIBS})
set(QT5_LIBS ${QT5_LIBS} ${TARGET_WIDGET})
Expand All @@ -41,5 +41,14 @@ ament_auto_add_executable(qt5_hello_ros2_cmake_exec
src/main.cpp)
target_link_libraries(qt5_hello_ros2_cmake_exec ${QT5_LIBS})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
set(ament_cmake_uncrustify_FOUND TRUE)
set(ament_cmake_lint_cmake_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

# amentのパッケージ情報を生成
ament_auto_package()
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
# qt_rviz2_tutorial

[![ROS 2 CI (Multi-Distribution)](https://github.com/NITKK-ROS-Team/qt_rviz2_tutorial/actions/workflows/ros2_ci.yml/badge.svg)](https://github.com/NITKK-ROS-Team/qt_rviz2_tutorial/actions/workflows/ros2_ci.yml)
[![ROS 2 Jazzy CI](https://github.com/NITKK-ROS-Team/qt_rviz2_tutorial/actions/workflows/jazzy.yml/badge.svg)](https://github.com/NITKK-ROS-Team/qt_rviz2_tutorial/actions/workflows/jazzy.yml)

QtはC++を使用したGUI開発によく使われるツールキットであり、Rviz2のpanelに使用できます。

このチュートリアルでは、Qtの基本からRviz2プラグインの作成までを目標としています。

<br>

## サポートされているROS 2ディストリビューション

このプロジェクトは以下のROS 2ディストリビューションでテストされています:

- ROS 2 Humble Hawksbill (Ubuntu 22.04)
- ROS 2 Jazzy Jalisco (Ubuntu 24.04)
- ROS 2 Rolling Ridley (Ubuntu 24.04)

CI(継続的インテグレーション)により、各ディストリビューションでのビルドとテストが自動的に実行されます。

**注記**: ROS 2 Iron Irwiniは、`ament_cmake_auto`とrviz_commonの互換性の問題により、サポートから除外されています。

<br>

## 対象

C++とCMakeListsが読める人。
Expand Down