Skip to content

Commit

Permalink
feat(ar_tag_based_localizer): componentize ArTagBasedLocalizer (autow…
Browse files Browse the repository at this point in the history
…arefoundation#7187)

* remove unusing main func

Signed-off-by: a-maumau <[email protected]>

* mod to componentize and use glog

Signed-off-by: a-maumau <[email protected]>

* change exec name and change log output from log to both

Signed-off-by: a-maumau <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: a-maumau <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and karishma1911 committed Jun 3, 2024
1 parent 8510a7f commit b182577
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,33 @@ ament_auto_find_build_dependencies()

find_package(OpenCV REQUIRED)

ament_auto_add_executable(ar_tag_based_localizer
src/main.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/ar_tag_based_localizer.cpp
)
target_include_directories(ar_tag_based_localizer

target_include_directories(${PROJECT_NAME}
SYSTEM PUBLIC
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(ar_tag_based_localizer ${OpenCV_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES})

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "ArTagBasedLocalizer"
EXECUTABLE ${PROJECT_NAME}_node
EXECUTOR SingleThreadedExecutor
)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
ament_auto_add_gtest(test_ar_tag_based_localizer
ament_auto_add_gtest(test_${PROJECT_NAME}
test/test.cpp
src/ar_tag_based_localizer.cpp
)
target_include_directories(test_ar_tag_based_localizer
target_include_directories(test_${PROJECT_NAME}
SYSTEM PUBLIC
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(test_ar_tag_based_localizer ${OpenCV_LIBRARIES})
target_link_libraries(test_${PROJECT_NAME} ${OpenCV_LIBRARIES})
endif()

ament_auto_package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<arg name="debug_mapped_tag" default="~/debug/mapped_tag"/>
<arg name="debug_detected_tag" default="~/debug/detected_tag"/>

<node pkg="ar_tag_based_localizer" exec="ar_tag_based_localizer" name="$(var node_name)" output="log">
<node pkg="ar_tag_based_localizer" exec="ar_tag_based_localizer_node" name="$(var node_name)" output="both">
<remap from="~/input/lanelet2_map" to="$(var input_lanelet2_map)"/>
<remap from="~/input/image" to="$(var input_image)"/>
<remap from="~/input/camera_info" to="$(var input_camera_info)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<depend>lanelet2_extension</depend>
<depend>localization_util</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tf2_eigen</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#include <tier4_autoware_utils/geometry/geometry.hpp>

ArTagBasedLocalizer::ArTagBasedLocalizer(const rclcpp::NodeOptions & options)
: Node("ar_tag_based_localizer", options), cam_info_received_(false)
: rclcpp::Node("ar_tag_based_localizer", options), cam_info_received_(false)
{
/*
Declare node parameters
Expand Down Expand Up @@ -346,3 +346,6 @@ std::vector<landmark_manager::Landmark> ArTagBasedLocalizer::detect_landmarks(

return landmarks;
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(ArTagBasedLocalizer)

This file was deleted.

0 comments on commit b182577

Please sign in to comment.