Skip to content

Commit

Permalink
feat(behavior_velocity_planner): output missing inputs (autowarefound…
Browse files Browse the repository at this point in the history
…ation#1477)

* feat(behavior_velocity_planner): output missing inputs

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* fix

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
takayuki5168 authored and yukke42 committed Oct 14, 2022
1 parent 5b2619a commit aac23c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BehaviorVelocityPlannerNode : public rclcpp::Node

// function
geometry_msgs::msg::PoseStamped getCurrentPose();
bool isDataReady(const PlannerData planner_data) const;
bool isDataReady(const PlannerData planner_data, rclcpp::Clock clock) const;
autoware_auto_planning_msgs::msg::Path generatePath(
const autoware_auto_planning_msgs::msg::PathWithLaneId::ConstSharedPtr input_path_msg,
const PlannerData & planner_data);
Expand Down
16 changes: 14 additions & 2 deletions planning/behavior_velocity_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,35 +203,46 @@ BehaviorVelocityPlannerNode::BehaviorVelocityPlannerNode(const rclcpp::NodeOptio
}

// NOTE: argument planner_data must not be referenced for multithreading
bool BehaviorVelocityPlannerNode::isDataReady(const PlannerData planner_data) const
bool BehaviorVelocityPlannerNode::isDataReady(
const PlannerData planner_data, rclcpp::Clock clock) const
{
const auto & d = planner_data;

// from tf
if (d.current_pose.header.frame_id == "") {
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Frame id of current pose is missing");
return false;
}

// from callbacks
if (!d.current_velocity) {
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for current velocity");
return false;
}
if (!d.current_accel) {
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for current acceleration");
return false;
}
if (!d.predicted_objects) {
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for predicted_objects");
return false;
}
if (!d.no_ground_pointcloud) {
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for pointcloud");
return false;
}
if (!d.route_handler_) {
RCLCPP_INFO_THROTTLE(
get_logger(), clock, 3000, "Waiting for the initialization of route_handler");
return false;
}
if (!d.route_handler_->isMapMsgReady()) {
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for the initialization of map");
return false;
}
if (!d.velocity_smoother_) {
RCLCPP_INFO_THROTTLE(
get_logger(), clock, 3000, "Waiting for the initialization of velocity smoother");
return false;
}
return true;
Expand Down Expand Up @@ -381,6 +392,7 @@ void BehaviorVelocityPlannerNode::onTrigger(
const autoware_auto_planning_msgs::msg::PathWithLaneId::ConstSharedPtr input_path_msg)
{
mutex_.lock(); // for planner_data_

// Check ready
try {
planner_data_.current_pose =
Expand All @@ -391,7 +403,7 @@ void BehaviorVelocityPlannerNode::onTrigger(
return;
}

if (!isDataReady(planner_data_)) {
if (!isDataReady(planner_data_, *get_clock())) {
mutex_.unlock();
return;
}
Expand Down

0 comments on commit aac23c9

Please sign in to comment.