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
13 changes: 13 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
BasedOnStyle: LLVM
IndentWidth: 2
TabWidth: 2
UseTab: Never
ColumnLimit: 100
PointerAlignment: Left
SortIncludes: CaseSensitive
AlignTrailingComments: true
AllowShortFunctionsOnASingleLine: Empty
BreakBeforeBraces: Attach
Standard: c++17
...
10 changes: 10 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Checks: >
-*,
bugprone-*,
performance-*,
readability-*,
modernize-*,
cppcoreguidelines-*
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
FormatStyle: file
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.{cpp,hpp,py,xml,yaml,yml,cmake,txt,md}]
indent_size = 2

[Makefile]
indent_style = tab
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: ros2-gst-video-bridge-ci

on:
pull_request:
push:
branches: ["main", "ft/1stversion_w_srt"]
schedule:
- cron: "0 3 * * *"

jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup ROS 2 Humble
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: humble

- name: Build
run: |
source /opt/ros/humble/setup.bash
colcon build --event-handlers console_direct+

- name: Test
run: |
source /opt/ros/humble/setup.bash
colcon test --event-handlers console_direct+
colcon test-result --all --verbose

nightly-matrix:
if: github.event_name == 'schedule'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup ROS 2 Humble
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: humble

- name: Build
run: |
source /opt/ros/humble/setup.bash
colcon build --event-handlers console_direct+

- name: Run matrix
run: |
chmod +x src/ros2_gst_video_bridge/scripts/run_transport_codec_matrix.zsh
src/ros2_gst_video_bridge/scripts/run_transport_codec_matrix.zsh "$PWD" /tmp/matrix.csv

- name: Upload report
uses: actions/upload-artifact@v4
with:
name: transport-codec-matrix-report
path: /tmp/matrix.csv
62 changes: 18 additions & 44 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,51 +1,25 @@
devel/
logs/
# ROS 2 / colcon
build/
bin/
lib/
msg_gen/
srv_gen/
msg/*Action.msg
msg/*ActionFeedback.msg
msg/*ActionGoal.msg
msg/*ActionResult.msg
msg/*Feedback.msg
msg/*Goal.msg
msg/*Result.msg
msg/_*.py
build_isolated/
devel_isolated/
install/
log/

# Generated by dynamic reconfigure
*.cfgc
/cfg/cpp/
/cfg/*.py

# Ignore generated docs
*.dox
*.wikidoc

# eclipse stuff
.project
.cproject

# qcreator stuff
CMakeLists.txt.user

srv/_*.py
*.pcd
# Python
__pycache__/
*.pyc
qtcreator-*
*.user

/planning/cfg
/planning/docs
/planning/src
# C/C++ build systems
*.o
*.so
*.a
*.dSYM/
compile_commands.json

# Editors / IDEs
.vscode/
.idea/
*.user
*.swp
*~

# Emacs
.#*

# Catkin custom files
CATKIN_IGNORE
# Local planning
TODO.md
140 changes: 140 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
cmake_minimum_required(VERSION 3.8)
project(ros2_gst_video_bridge)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

option(ROS2_GST_VIDEO_BRIDGE_ENABLE_CLANG_TIDY "Enable clang-tidy during C++ compilation" ON)
option(ROS2_GST_VIDEO_BRIDGE_ENABLE_CLANG_FORMAT_CHECK "Enable clang-format check target" ON)
option(ROS2_GST_VIDEO_BRIDGE_ENABLE_AMENT_LINT "Enable ament_lint_auto checks" OFF)

if(ROS2_GST_VIDEO_BRIDGE_ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES clang-tidy clang-tidy-18 clang-tidy-17 clang-tidy-16 clang-tidy-15)
if(CLANG_TIDY_EXE)
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE})
message(STATUS "clang-tidy enabled: ${CLANG_TIDY_EXE}")
else()
message(WARNING "clang-tidy requested but not found. Continuing without clang-tidy.")
endif()
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(ros2_gst_video_bridge_msgs REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0 gstreamer-app-1.0)

if(ROS2_GST_VIDEO_BRIDGE_ENABLE_CLANG_FORMAT_CHECK)
find_program(CLANG_FORMAT_EXE NAMES clang-format clang-format-18 clang-format-17 clang-format-16 clang-format-15)
if(CLANG_FORMAT_EXE)
file(GLOB_RECURSE ROS2_GST_VIDEO_BRIDGE_FORMAT_FILES CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc"
)
add_custom_target(clang_format_check
COMMAND ${CLANG_FORMAT_EXE} --dry-run --Werror ${ROS2_GST_VIDEO_BRIDGE_FORMAT_FILES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running clang-format check on C++ source files"
VERBATIM
)
else()
message(WARNING "clang-format check requested but clang-format was not found.")
endif()
endif()

add_executable(gst_video_bridge_node
src/main.cc
src/gst_video_bridge_node.cc
src/node/core.cc
src/node/lifecycle.cc
src/node/modes.cc
src/node/streaming.cc
src/node/recovery.cc
src/node/fallback.cc
src/node/observability.cc
src/core/config_loader.cc
src/core/pipeline_builder.cc
src/runtime/capability_probe.cc
src/runtime/topic_introspector.cc
src/runtime/stream_engine.cc
src/runtime/metrics_publisher.cc
)

target_include_directories(gst_video_bridge_node
PRIVATE
include
${GSTREAMER_INCLUDE_DIRS}
)

target_link_libraries(gst_video_bridge_node
${GSTREAMER_LIBRARIES}
)

target_compile_options(gst_video_bridge_node PRIVATE ${GSTREAMER_CFLAGS_OTHER})

ament_target_dependencies(gst_video_bridge_node
rclcpp
sensor_msgs
std_msgs
ros2_gst_video_bridge_msgs
)

install(TARGETS gst_video_bridge_node
DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY launch config
DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)

ament_add_gtest(test_config_loader test/test_config_loader.cpp src/core/config_loader.cc)
target_include_directories(test_config_loader PRIVATE include)
ament_target_dependencies(test_config_loader rclcpp)

ament_add_gtest(test_pipeline_builder test/test_pipeline_builder.cpp src/core/pipeline_builder.cc)
target_include_directories(test_pipeline_builder PRIVATE include)

add_test(
NAME smoke_runtime_validate_config
COMMAND $<TARGET_FILE:gst_video_bridge_node> --ros-args -p runtime.mode:=validate_config)

add_test(
NAME smoke_runtime_list_capabilities
COMMAND $<TARGET_FILE:gst_video_bridge_node> --ros-args -p runtime.mode:=list_capabilities)

add_test(
NAME smoke_launch_minimal_show_args
COMMAND ros2 launch ros2_gst_video_bridge gst_video_bridge_minimal.launch.py --show-args)

add_test(
NAME smoke_launch_advanced_show_args
COMMAND ros2 launch ros2_gst_video_bridge gst_video_bridge_advanced.launch.py --show-args)

add_test(
NAME smoke_launch_compat_show_args
COMMAND ros2 launch ros2_gst_video_bridge gst_video_bridge.launch.py --show-args)

set_tests_properties(smoke_runtime_validate_config PROPERTIES TIMEOUT 20)
set_tests_properties(smoke_runtime_list_capabilities PROPERTIES TIMEOUT 20)
set_tests_properties(smoke_launch_minimal_show_args PROPERTIES TIMEOUT 20)
set_tests_properties(smoke_launch_advanced_show_args PROPERTIES TIMEOUT 20)
set_tests_properties(smoke_launch_compat_show_args PROPERTIES TIMEOUT 20)

if(ROS2_GST_VIDEO_BRIDGE_ENABLE_AMENT_LINT)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
endif()

ament_package()
Loading
Loading