Skip to content

Commit 23f99a7

Browse files
authoredMay 2, 2024··
feat(mission_planner): publish initial and goal poses to logs (#6918)
* feat(mission_planner): publish initial and goal poses to logs Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * refactoring to a function Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> --------- Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
1 parent 52f4b3e commit 23f99a7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
 

‎planning/mission_planner/src/mission_planner/mission_planner.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ MissionPlanner::MissionPlanner(const rclcpp::NodeOptions & options)
8787
logger_configure_ = std::make_unique<tier4_autoware_utils::LoggerLevelConfigure>(this);
8888
}
8989

90+
void MissionPlanner::publish_pose_log(const Pose & pose, const std::string & pose_type)
91+
{
92+
const auto & p = pose.position;
93+
RCLCPP_INFO(
94+
this->get_logger(), "%s pose - x: %f, y: %f, z: %f", pose_type.c_str(), p.x, p.y, p.z);
95+
const auto & quaternion = pose.orientation;
96+
RCLCPP_INFO(
97+
this->get_logger(), "%s orientation - qx: %f, qy: %f, qz: %f, qw: %f", pose_type.c_str(),
98+
quaternion.x, quaternion.y, quaternion.z, quaternion.w);
99+
}
100+
90101
void MissionPlanner::check_initialization()
91102
{
92103
auto logger = get_logger();
@@ -247,6 +258,9 @@ void MissionPlanner::on_set_lanelet_route(
247258
change_route(route);
248259
change_state(RouteState::SET);
249260
res->status.success = true;
261+
262+
publish_pose_log(odometry_->pose.pose, "initial");
263+
publish_pose_log(req->goal_pose, "goal");
250264
}
251265

252266
void MissionPlanner::on_set_waypoint_route(
@@ -292,6 +306,9 @@ void MissionPlanner::on_set_waypoint_route(
292306
change_route(route);
293307
change_state(RouteState::SET);
294308
res->status.success = true;
309+
310+
publish_pose_log(odometry_->pose.pose, "initial");
311+
publish_pose_log(req->goal_pose, "goal");
295312
}
296313

297314
void MissionPlanner::change_route()

‎planning/mission_planner/src/mission_planner/mission_planner.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ class MissionPlanner : public rclcpp::Node
122122
const Header & header, const std::vector<Pose> & waypoints, const Pose & goal_pose,
123123
const UUID & uuid, const bool allow_goal_modification);
124124

125+
void publish_pose_log(const Pose & pose, const std::string & pose_type);
126+
125127
rclcpp::TimerBase::SharedPtr data_check_timer_;
126128
void check_initialization();
127129

0 commit comments

Comments
 (0)
Please sign in to comment.