Skip to content

Commit

Permalink
feat(freespace_planner): add processing time pub
Browse files Browse the repository at this point in the history
Signed-off-by: Kasunori-Nakajima <[email protected]>
  • Loading branch information
Kazunori-Nakajima committed Nov 15, 2024
1 parent 8652963 commit c3ce5e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <nav_msgs/msg/occupancy_grid.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <std_msgs/msg/bool.hpp>
#include <tier4_debug_msgs/msg/float64_stamped.hpp>
#include <tier4_planning_msgs/msg/scenario.hpp>

#ifdef ROS_DISTRO_GALACTIC
Expand Down Expand Up @@ -111,6 +112,7 @@ class FreespacePlannerNode : public rclcpp::Node
rclcpp::Publisher<PoseArray>::SharedPtr debug_pose_array_pub_;
rclcpp::Publisher<PoseArray>::SharedPtr debug_partial_pose_array_pub_;
rclcpp::Publisher<std_msgs::msg::Bool>::SharedPtr parking_state_pub_;
rclcpp::Publisher<tier4_debug_msgs::msg::Float64Stamped>::SharedPtr processing_time_pub_;

rclcpp::Subscription<LaneletRoute>::SharedPtr route_sub_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <autoware/motion_utils/trajectory/trajectory.hpp>
#include <autoware/universe_utils/geometry/geometry.hpp>
#include <autoware/universe_utils/geometry/pose_deviation.hpp>
#include <autoware/universe_utils/system/stop_watch.hpp>

#include <algorithm>
#include <deque>
Expand Down Expand Up @@ -94,6 +95,8 @@ FreespacePlannerNode::FreespacePlannerNode(const rclcpp::NodeOptions & node_opti
debug_pose_array_pub_ = create_publisher<PoseArray>("~/debug/pose_array", qos);
debug_partial_pose_array_pub_ = create_publisher<PoseArray>("~/debug/partial_pose_array", qos);
parking_state_pub_ = create_publisher<std_msgs::msg::Bool>("is_completed", qos);
processing_time_pub_ =
create_publisher<tier4_debug_msgs::msg::Float64Stamped>("~/debug/processing_time_ms", 1);
}

// TF
Expand Down Expand Up @@ -277,6 +280,8 @@ bool FreespacePlannerNode::isDataReady()

void FreespacePlannerNode::onTimer()
{
autoware::universe_utils::StopWatch<std::chrono::milliseconds> stop_watch;

scenario_ = scenario_sub_.takeData();
if (!utils::is_active(scenario_)) {
reset();
Expand Down Expand Up @@ -355,6 +360,12 @@ void FreespacePlannerNode::onTimer()
debug_partial_pose_array_pub_->publish(utils::trajectory_to_pose_array(partial_trajectory_));

is_new_parking_cycle_ = false;

// Publish ProcessingTime
tier4_debug_msgs::msg::Float64Stamped processing_time_msg;
processing_time_msg.stamp = get_clock()->now();
processing_time_msg.data = stop_watch.toc();
processing_time_pub_->publish(processing_time_msg);
}

void FreespacePlannerNode::planTrajectory()
Expand Down

0 comments on commit c3ce5e1

Please sign in to comment.