Skip to content

Commit

Permalink
fix(behavior_velocity): fix intersection last point (#1283)
Browse files Browse the repository at this point in the history
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
  • Loading branch information
taikitanaka3 authored Jul 8, 2022
1 parent f5c17a9 commit 51a596e
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ bool IntersectionModule::modifyPathVelocity(
*stop_reason =
planning_utils::initializeStopReason(tier4_planning_msgs::msg::StopReason::INTERSECTION);

const auto input_path = *path;
debug_data_.path_raw = input_path;
debug_data_.path_raw = *path;

State current_state = state_machine_.getState();
RCLCPP_DEBUG(logger_, "lane_id = %ld, state = %s", lane_id_, toString(current_state).c_str());
Expand Down Expand Up @@ -142,7 +141,7 @@ bool IntersectionModule::modifyPathVelocity(

/* calc closest index */
int closest_idx = -1;
if (!planning_utils::calcClosestIndex(input_path, current_pose.pose, closest_idx)) {
if (!planning_utils::calcClosestIndex(*path, current_pose.pose, closest_idx)) {
RCLCPP_WARN_SKIPFIRST_THROTTLE(logger_, *clock_, 1000 /* ms */, "calcClosestIndex fail");
RCLCPP_DEBUG(logger_, "===== plan end =====");
return false;
Expand All @@ -159,8 +158,8 @@ bool IntersectionModule::modifyPathVelocity(
RCLCPP_DEBUG(logger_, "===== plan end =====");
setSafe(true);
setDistance(tier4_autoware_utils::calcSignedArcLength(
input_path.points, planner_data_->current_pose.pose.position,
input_path.points.at(stop_line_idx).point.pose.position));
path->points, planner_data_->current_pose.pose.position,
path->points.at(stop_line_idx).point.pose.position));
return true; // no plan needed.
}

Expand All @@ -185,8 +184,8 @@ bool IntersectionModule::modifyPathVelocity(

setSafe(!is_entry_prohibited);
setDistance(tier4_autoware_utils::calcSignedArcLength(
input_path.points, planner_data_->current_pose.pose.position,
input_path.points.at(stop_line_idx).point.pose.position));
path->points, planner_data_->current_pose.pose.position,
path->points.at(stop_line_idx).point.pose.position));

if (!isActivated()) {
const double v = 0.0;
Expand Down

0 comments on commit 51a596e

Please sign in to comment.