Skip to content

Commit 4ff30bf

Browse files
move parameter handling to dedicated class
1 parent 8dae57b commit 4ff30bf

File tree

4 files changed

+820
-225
lines changed

4 files changed

+820
-225
lines changed

CMakeLists.txt

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,42 @@ find_package(camera_info_manager REQUIRED)
2020
find_package(cv_bridge REQUIRED)
2121
pkg_check_modules(libcamera REQUIRED libcamera>=0.1)
2222

23+
# new param callbacks need at least 17.0.0
24+
if(${rclcpp_VERSION} VERSION_GREATER_EQUAL "17")
25+
add_compile_definitions(RCLCPP_HAS_PARAM_EXT_CB)
26+
endif()
27+
2328
# library with common utility functions for type conversions
2429
add_library(utils OBJECT
25-
src/clamp.cpp
26-
src/cv_to_pv.cpp
2730
src/format_mapping.cpp
28-
src/parameter_conflict_check.cpp
2931
src/pretty_print.cpp
30-
src/pv_to_cv.cpp
31-
src/types.cpp
32-
src/type_extent.cpp
3332
)
3433
target_include_directories(utils PUBLIC ${libcamera_INCLUDE_DIRS})
3534
target_link_libraries(utils ${libcamera_LINK_LIBRARIES})
3635
ament_target_dependencies(
3736
utils
38-
"rclcpp"
3937
"sensor_msgs"
4038
)
4139
set_property(TARGET utils PROPERTY POSITION_INDEPENDENT_CODE ON)
4240

41+
# library for parameter/controls handling and conversion
42+
add_library(param OBJECT
43+
src/clamp.cpp
44+
src/cv_to_pv.cpp
45+
# src/parameter_conflict_check.cpp
46+
src/pv_to_cv.cpp
47+
src/types.cpp
48+
src/type_extent.cpp
49+
src/ParameterHandler.cpp
50+
)
51+
target_include_directories(param PUBLIC ${libcamera_INCLUDE_DIRS})
52+
target_link_libraries(param ${libcamera_LINK_LIBRARIES})
53+
ament_target_dependencies(
54+
param
55+
"rclcpp"
56+
)
57+
set_property(TARGET param PROPERTY POSITION_INDEPENDENT_CODE ON)
58+
4359
# composable ROS2 node
4460
add_library(camera_component SHARED src/CameraNode.cpp)
4561
rclcpp_components_register_node(camera_component PLUGIN "camera::CameraNode" EXECUTABLE "camera_node")
@@ -57,7 +73,7 @@ ament_target_dependencies(
5773
)
5874

5975
target_include_directories(camera_component PUBLIC ${libcamera_INCLUDE_DIRS})
60-
target_link_libraries(camera_component ${libcamera_LINK_LIBRARIES} utils)
76+
target_link_libraries(camera_component ${libcamera_LINK_LIBRARIES} utils param)
6177

6278
install(TARGETS camera_component
6379
DESTINATION lib)

0 commit comments

Comments
 (0)