Skip to content

Commit

Permalink
feat(yabloc_pose_initializer): componentize yabloc_pose_initializer n…
Browse files Browse the repository at this point in the history
…ode (autowarefoundation#7506)

* change the node to component

Signed-off-by: Kento Yabuuchi <[email protected]>

* remove useless node.cpp

Signed-off-by: Kento Yabuuchi <[email protected]>

* add rclcpp_components as dependency

Signed-off-by: Kento Yabuuchi <[email protected]>

---------

Signed-off-by: Kento Yabuuchi <[email protected]>
Signed-off-by: Simon Eisenmann <[email protected]>
  • Loading branch information
KYabuuchi authored and simon-eisenmann-driveblocks committed Jun 26, 2024
1 parent 79bb920 commit 49e69bd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 38 deletions.
20 changes: 12 additions & 8 deletions localization/yabloc/yabloc_pose_initializer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ find_package(OpenCV REQUIRED)
# ===================================================
# Executable
# Camera
set(TARGET camera_pose_initializer_node)
ament_auto_add_executable(${TARGET}
ament_auto_add_library(${PROJECT_NAME}
src/camera/lane_image.cpp
src/camera/marker_module.cpp
src/camera/projector_module.cpp
src/camera/semantic_segmentation.cpp
src/camera/camera_pose_initializer_core.cpp
src/camera/camera_pose_initializer_node.cpp)
target_include_directories(${TARGET} PUBLIC include)
target_include_directories(${TARGET} SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})
target_link_libraries(${TARGET} ${PCL_LIBRARIES} Sophus::Sophus)
ament_target_dependencies(${TARGET} OpenCV)
src/camera/camera_pose_initializer_core.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC include)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES} Sophus::Sophus)
ament_target_dependencies(${PROJECT_NAME} OpenCV)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "yabloc::CameraPoseInitializer"
EXECUTABLE ${PROJECT_NAME}_node
EXECUTOR MultiThreadedExecutor
)

# ===================================================
ament_auto_package(INSTALL_TO_SHARE config launch)
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CameraPoseInitializer : public rclcpp::Node
using LaneletMapBin = autoware_map_msgs::msg::LaneletMapBin;
using RequestPoseAlignment = tier4_localization_msgs::srv::PoseWithCovarianceStamped;

CameraPoseInitializer();
explicit CameraPoseInitializer(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());

private:
const int angle_resolution_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<arg name="data_path" default="$(env HOME)/autoware_data"/>
<arg name="model_path" default="$(var data_path)/yabloc_pose_initializer/saved_model/model_float32.pb"/>

<node name="camera_pose_initializer_node" pkg="yabloc_pose_initializer" exec="camera_pose_initializer_node" output="screen" args="--ros-args --log-level info">
<node pkg="yabloc_pose_initializer" exec="yabloc_pose_initializer_node" output="both">
<param from="$(var camera_pose_initializer_param_path)"/>
<param name="model_path" value="$(var model_path)"/>
<remap from="~/input/camera_info" to="/localization/pose_estimator/yabloc/image_processing/undistorted/camera_info"/>
Expand Down
1 change: 1 addition & 0 deletions localization/yabloc/yabloc_pose_initializer/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<depend>lanelet2_extension</depend>
<depend>libopencv-dev</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>sensor_msgs</depend>
<depend>tier4_localization_msgs</depend>
<depend>visualization_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@

namespace yabloc
{
CameraPoseInitializer::CameraPoseInitializer()
: Node("camera_pose_initializer"), angle_resolution_(declare_parameter<int>("angle_resolution"))
CameraPoseInitializer::CameraPoseInitializer(const rclcpp::NodeOptions & options)
: Node("camera_pose_initializer", options),
angle_resolution_(declare_parameter<int>("angle_resolution"))
{
using std::placeholders::_1;
using std::placeholders::_2;
Expand Down Expand Up @@ -216,3 +217,6 @@ CameraPoseInitializer::PoseCovStamped CameraPoseInitializer::create_rectified_in
}

} // namespace yabloc

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(yabloc::CameraPoseInitializer)

This file was deleted.

0 comments on commit 49e69bd

Please sign in to comment.