Skip to content

Commit

Permalink
move parameter handling to dedicated class
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Dec 2, 2024
1 parent a51de05 commit 28895f0
Show file tree
Hide file tree
Showing 4 changed files with 820 additions and 226 deletions.
32 changes: 24 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,42 @@ find_package(camera_info_manager REQUIRED)
find_package(cv_bridge REQUIRED)
pkg_check_modules(libcamera REQUIRED libcamera>=0.1)

# new param callbacks need at least 17.0.0
if(${rclcpp_VERSION} VERSION_GREATER_EQUAL "17")
add_compile_definitions(RCLCPP_HAS_PARAM_EXT_CB)
endif()

# library with common utility functions for type conversions
add_library(utils OBJECT
src/clamp.cpp
src/cv_to_pv.cpp
src/format_mapping.cpp
src/parameter_conflict_check.cpp
src/pretty_print.cpp
src/pv_to_cv.cpp
src/types.cpp
src/type_extent.cpp
)
target_include_directories(utils PUBLIC ${libcamera_INCLUDE_DIRS})
target_link_libraries(utils ${libcamera_LINK_LIBRARIES})
ament_target_dependencies(
utils
"rclcpp"
"sensor_msgs"
)
set_property(TARGET utils PROPERTY POSITION_INDEPENDENT_CODE ON)

# library for parameter/controls handling and conversion
add_library(param OBJECT
src/clamp.cpp
src/cv_to_pv.cpp
# src/parameter_conflict_check.cpp
src/pv_to_cv.cpp
src/types.cpp
src/type_extent.cpp
src/ParameterHandler.cpp
)
target_include_directories(param PUBLIC ${libcamera_INCLUDE_DIRS})
target_link_libraries(param ${libcamera_LINK_LIBRARIES})
ament_target_dependencies(
param
"rclcpp"
)
set_property(TARGET param PROPERTY POSITION_INDEPENDENT_CODE ON)

# composable ROS2 node
add_library(camera_component SHARED src/CameraNode.cpp)
rclcpp_components_register_node(camera_component PLUGIN "camera::CameraNode" EXECUTABLE "camera_node")
Expand All @@ -53,7 +69,7 @@ set(PACKAGE_DEPENDENCIES
ament_target_dependencies(camera_component PUBLIC ${PACKAGE_DEPENDENCIES})
target_include_directories(camera_component PUBLIC ${libcamera_INCLUDE_DIRS})
target_link_libraries(camera_component PUBLIC ${libcamera_LINK_LIBRARIES})
target_link_libraries(camera_component PRIVATE utils)
target_link_libraries(camera_component PRIVATE utils param)

ament_export_targets(camera_componentTargets HAS_LIBRARY_TARGET)
ament_export_dependencies(${PACKAGE_DEPENDENCIES})
Expand Down
Loading

0 comments on commit 28895f0

Please sign in to comment.