Skip to content

Commit

Permalink
better launching
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrhm committed Oct 22, 2024
1 parent 98c56cc commit 7fa9911
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ if(ZED_FOUND AND CUDA_FOUND)
# rclcpp_components_register_nodes(zed "mrover::ZedWrapper")
# set(node_plugins "${node_plugins}mrover::ZedWrapper;$<TARGET_FILE:zed_wrapper>\n")

mrover_add_component(zed ZedWrapper perception/zed_wrapper/*.c* perception/zed_wrapper/pch.hpp)
mrover_add_component(zed perception/zed_wrapper/*.c* perception/zed_wrapper/pch.hpp ZedWrapper)
mrover_link_component(zed parameter_utils lie MANIF::manif ${CUDA_LIBRARIES} loop_profiler cuda_compiler_flags)
mrover_ament_component(zed rclcpp rclcpp_components sensor_msgs ZED CUDA tf2 tf2_ros)

Expand All @@ -270,7 +270,7 @@ if(ZED_FOUND AND CUDA_FOUND)
target_link_libraries(tensorrt PRIVATE opencv_core opencv_dnn opencv_imgproc lie nvinfer nvonnxparser tbb cuda_compiler_flags)

# Object Detector
mrover_add_component(object_detector StereoObjectDetector perception/object_detector/*.c* src/perception/object_detector/pch.hpp)
mrover_add_component(object_detector perception/object_detector/*.c* src/perception/object_detector/pch.hpp StereoObjectDetector ImageObjectDetector)
target_compile_options(zed PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-std=c++20>)
mrover_link_component(object_detector opencv_core opencv_dnn opencv_imgproc lie tbb tensorrt opencv_imgcodecs opencv_highgui loop_profiler parameter_utils cuda_compiler_flags)
mrover_ament_component(object_detector rclcpp sensor_msgs rclcpp_components CUDA tf2 tf2_ros)
Expand Down Expand Up @@ -302,7 +302,7 @@ if (Gst_FOUND AND GstApp_FOUND)
target_compile_definitions(websocket_server PUBLIC BOOST_ASIO_NO_DEPRECATED)
ament_target_dependencies(websocket_server rclcpp)

mrover_add_component(gst_websocket_streamer GstWebsocketStreamer esw/gst_websocket_streamer/*.c* esw/gst_websocket_streamer/pch.hpp)
mrover_add_component(gst_websocket_streamer esw/gst_websocket_streamer/*.c* esw/gst_websocket_streamer/pch.hpp GstWebsocketStreamer)
mrover_link_component(gst_websocket_streamer PkgConfig::Gst PkgConfig::GstApp PkgConfig::LibUdev opencv_core opencv_imgcodecs websocket_server)
mrover_ament_component(gst_websocket_streamer rclcpp rclcpp_components sensor_msgs)
endif ()
Expand Down
9 changes: 6 additions & 3 deletions cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ macro(mrover_add_node name sources)
endif ()
endmacro()

macro(mrover_add_component name class_name sources includes)
macro(mrover_add_component name sources includes)
# Create Executable
mrover_add_node(${name} ${sources})
rosidl_target_interfaces(${name} ${PROJECT_NAME} "rosidl_typesupport_cpp")
Expand All @@ -54,9 +54,12 @@ macro(mrover_add_component name class_name sources includes)
set(component_name ${name}_component)
mrover_add_library(${component_name} ${sources} ${includes} SHARED)
rosidl_target_interfaces(${component_name} ${PROJECT_NAME} "rosidl_typesupport_cpp")
rclcpp_components_register_nodes(${component_name} "mrover::${class_name}")
foreach(node ${ARGN})
message("Registering ${node}")
rclcpp_components_register_nodes(${component_name} "mrover::${node}")
set(node_plugins "${node_plugins}mrover::${node};$<TARGET_FILE:${component_name}>\n")
endforeach()
target_compile_definitions(${component_name} PRIVATE "COMPOSITION_BUILDING_DLL")
set(node_plugins "${node_plugins}mrover::${class_name};$<TARGET_FILE:${component_name}>\n")
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_CURRENT_LIST_DIR}/../../build/${PROJECT_NAME}/lib${component_name}.so \
Expand Down
12 changes: 9 additions & 3 deletions launch/perception.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ def generate_launch_description():
composable_node_descriptions=[
ComposableNode(
package="mrover",
plugin="mrover::object_detector_component",
plugin="mrover::StereoObjectDetector",
name="object_detector_component",
parameters=[Path(get_package_share_directory("mrover"), "config", "object_detector.yaml")],
),
ComposableNode(
package="mrover",
plugin="mrover::zed_wrapper_component",
name="zed_wrapper_component",
plugin="mrover::ImageObjectDetector",
name="object_detector_component",
parameters=[Path(get_package_share_directory("mrover"), "config", "object_detector.yaml")],
),
ComposableNode(
package="mrover",
plugin="mrover::ZedWrapper",
name="zed_component",
parameters=[Path(get_package_share_directory("mrover"), "config", "zed.yaml")],
),
],
Expand Down

0 comments on commit 7fa9911

Please sign in to comment.