Skip to content

Commit

Permalink
feat(lane_departure_checker): add processing time publisher (Float64)
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime CLEMENT <[email protected]>
  • Loading branch information
maxime-clem committed Jun 25, 2024
1 parent fb898eb commit 64eb90f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ class LaneDepartureCheckerNode : public rclcpp::Node

// Publisher
autoware::universe_utils::DebugPublisher debug_publisher_{this, "~/debug"};
autoware::universe_utils::ProcessingTimePublisher processing_time_publisher_{this};
autoware::universe_utils::ProcessingTimePublisher processing_diag_publisher_{
this, "~/debug/processing_time_ms_diag"};
rclcpp::Publisher<tier4_debug_msgs::msg::Float64Stamped>::SharedPtr processing_time_publisher_;

// Timer
rclcpp::TimerBase::SharedPtr timer_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ LaneDepartureCheckerNode::LaneDepartureCheckerNode(const rclcpp::NodeOptions & o
lane_departure_checker_->setParam(param_, vehicle_info);

// Publisher
processing_time_publisher_ =
this->create_publisher<tier4_debug_msgs::msg::Float64Stamped>("~/debug/processing_time_ms", 1);
// Nothing

// Diagnostic Updater
Expand Down Expand Up @@ -347,7 +349,11 @@ void LaneDepartureCheckerNode::onTimer()
}

processing_time_map["Total"] = stop_watch.toc("Total");
processing_time_publisher_.publish(processing_time_map);
processing_diag_publisher_.publish(processing_time_map);
tier4_debug_msgs::msg::Float64Stamped processing_time_msg;
processing_time_msg.stamp = get_clock()->now();
processing_time_msg.data = processing_time_map["Total"];
processing_time_publisher_->publish(processing_time_msg);

Check warning on line 356 in control/autoware_lane_departure_checker/src/lane_departure_checker_node/lane_departure_checker_node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

LaneDepartureCheckerNode::onTimer already has high cyclomatic complexity, and now it increases in Lines of Code from 80 to 84. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
}

rcl_interfaces::msg::SetParametersResult LaneDepartureCheckerNode::onParameter(
Expand Down

0 comments on commit 64eb90f

Please sign in to comment.