Skip to content

Commit

Permalink
feat(geo_pose_projector): componentize GeoPoseProjector (#7138)
Browse files Browse the repository at this point in the history
* remove unusing main func file

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

* mod to componentize and use glog

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

* change log output from screen to both

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

---------

Signed-off-by: a-maumau <[email protected]>
  • Loading branch information
a-maumau authored May 28, 2024
1 parent 967f4a7 commit f28a757
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 36 deletions.
10 changes: 7 additions & 3 deletions localization/geo_pose_projector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ project(geo_pose_projector)
find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_executable(geo_pose_projector
src/geo_pose_projector_node.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/geo_pose_projector.cpp
)
ament_target_dependencies(geo_pose_projector)

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

ament_auto_package(
INSTALL_TO_SHARE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<arg name="output_pose" default="/pose_with_covariance"/>
<arg name="param_path" default="$(find-pkg-share geo_pose_projector)/config/geo_pose_projector.param.yaml"/>

<node pkg="geo_pose_projector" exec="geo_pose_projector" name="geo_pose_projector" output="screen">
<node pkg="geo_pose_projector" exec="geo_pose_projector_node" output="both">
<remap from="input_geo_pose" to="$(var input_geo_pose)"/>
<remap from="output_pose" to="$(var output_pose)"/>

Expand Down
1 change: 1 addition & 0 deletions localization/geo_pose_projector/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<depend>geography_utils</depend>
<depend>geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>

Expand Down
7 changes: 5 additions & 2 deletions localization/geo_pose_projector/src/geo_pose_projector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

#include <string>

GeoPoseProjector::GeoPoseProjector()
: Node("geo_pose_projector"), publish_tf_(declare_parameter<bool>("publish_tf"))
GeoPoseProjector::GeoPoseProjector(const rclcpp::NodeOptions & options)
: rclcpp::Node("geo_pose_projector", options), publish_tf_(declare_parameter<bool>("publish_tf"))
{
// Subscribe to map_projector_info topic
const auto adaptor = component_interface_utils::NodeAdaptor(this);
Expand Down Expand Up @@ -102,3 +102,6 @@ void GeoPoseProjector::on_geo_pose(const GeoPoseWithCovariance::ConstSharedPtr m
tf_broadcaster_->sendTransform(transform_stamped);
}
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(GeoPoseProjector)
2 changes: 1 addition & 1 deletion localization/geo_pose_projector/src/geo_pose_projector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GeoPoseProjector : public rclcpp::Node
using MapProjectorInfo = map_interface::MapProjectorInfo;

public:
GeoPoseProjector();
explicit GeoPoseProjector(const rclcpp::NodeOptions & options);

private:
void on_geo_pose(const GeoPoseWithCovariance::ConstSharedPtr msg);
Expand Down
29 changes: 0 additions & 29 deletions localization/geo_pose_projector/src/geo_pose_projector_node.cpp

This file was deleted.

0 comments on commit f28a757

Please sign in to comment.