Skip to content

Commit

Permalink
feat(pose2twist): componentize Pose2Twist (#7113)
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 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
a-maumau and pre-commit-ci[bot] authored May 24, 2024
1 parent 583cd85 commit f2ae1af
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 34 deletions.
9 changes: 7 additions & 2 deletions localization/pose2twist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ project(pose2twist)
find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_executable(pose2twist
src/pose2twist_node.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/pose2twist_core.cpp
)

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

ament_auto_package(
INSTALL_TO_SHARE
launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class Pose2Twist : public rclcpp::Node
{
public:
Pose2Twist();
explicit Pose2Twist(const rclcpp::NodeOptions & options);
~Pose2Twist() = default;

private:
Expand Down
2 changes: 1 addition & 1 deletion localization/pose2twist/launch/pose2twist.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<arg name="input_pose_topic" default="/localization/pose_estimator/pose" description=""/>
<arg name="output_twist_topic" default="/estimate_twist" description=""/>

<node pkg="pose2twist" exec="pose2twist" name="pose2twist" output="log">
<node pkg="pose2twist" exec="pose2twist_node" output="both">
<remap from="pose" to="$(var input_pose_topic)"/>
<remap from="twist" to="$(var output_twist_topic)"/>
</node>
Expand Down
1 change: 1 addition & 0 deletions localization/pose2twist/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<depend>geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tier4_debug_msgs</depend>

Expand Down
5 changes: 4 additions & 1 deletion localization/pose2twist/src/pose2twist_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <cstddef>
#include <functional>

Pose2Twist::Pose2Twist() : Node("pose2twist_core")
Pose2Twist::Pose2Twist(const rclcpp::NodeOptions & options) : rclcpp::Node("pose2twist", options)
{
using std::placeholders::_1;

Expand Down Expand Up @@ -129,3 +129,6 @@ void Pose2Twist::callbackPose(geometry_msgs::msg::PoseStamped::SharedPtr pose_ms
angular_z_msg.data = twist_msg.twist.angular.z;
angular_z_pub_->publish(angular_z_msg);
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(Pose2Twist)
29 changes: 0 additions & 29 deletions localization/pose2twist/src/pose2twist_node.cpp

This file was deleted.

0 comments on commit f2ae1af

Please sign in to comment.