Skip to content

Commit ffbf01b

Browse files
h-ohtapre-commit-ci[bot]
authored andcommitted
fix(behavior_path): only apply spline interpolation for its output, not for turn_signal processing (#909)
* fix(behavior_path): only apply spline interpolate for output, not for turn_signal processing * fix implementation * ci(pre-commit): autofix --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 1331a23 commit ffbf01b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

planning/behavior_path_planner/include/behavior_path_planner/behavior_path_planner_node.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
#include <memory>
5252
#include <string>
53+
#include <utility>
5354
#include <vector>
5455

5556
namespace behavior_path_planner
@@ -136,7 +137,8 @@ class BehaviorPathPlannerNode : public rclcpp::Node
136137
/**
137138
* @brief extract path from behavior tree output
138139
*/
139-
PathWithLaneId::SharedPtr getPath(const BehaviorModuleOutput & bt_out);
140+
std::pair<PathWithLaneId::SharedPtr, PathWithLaneId::SharedPtr> getPath(
141+
const BehaviorModuleOutput & bt_out);
140142

141143
/**
142144
* @brief extract path candidate from behavior tree output

planning/behavior_path_planner/src/behavior_path_planner_node.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,10 @@ void BehaviorPathPlannerNode::run()
478478
const auto output = bt_manager_->run(planner_data_);
479479

480480
// path handling
481-
const auto path = getPath(output);
481+
const auto paths = getPath(output);
482+
const auto path = paths.first;
483+
const auto original_path = paths.second;
484+
482485
const auto path_candidate = getPathCandidate(output);
483486
planner_data_->prev_output_path = path;
484487

@@ -504,7 +507,7 @@ void BehaviorPathPlannerNode::run()
504507
hazard_signal.command = output.turn_signal_info.hazard_signal.command;
505508
} else {
506509
turn_signal = turn_signal_decider_.getTurnSignal(
507-
*path, planner_data_->self_pose->pose, *(planner_data_->route_handler),
510+
*original_path, planner_data_->self_pose->pose, *(planner_data_->route_handler),
508511
output.turn_signal_info.turn_signal, output.turn_signal_info.signal_distance);
509512
hazard_signal.command = HazardLightsCommand::DISABLE;
510513
}
@@ -527,7 +530,9 @@ void BehaviorPathPlannerNode::run()
527530
RCLCPP_DEBUG(get_logger(), "----- behavior path planner end -----\n\n");
528531
}
529532

530-
PathWithLaneId::SharedPtr BehaviorPathPlannerNode::getPath(const BehaviorModuleOutput & bt_output)
533+
// output: spline interpolated path, original path
534+
std::pair<PathWithLaneId::SharedPtr, PathWithLaneId::SharedPtr> BehaviorPathPlannerNode::getPath(
535+
const BehaviorModuleOutput & bt_output)
531536
{
532537
// TODO(Horibe) do some error handling when path is not available.
533538

@@ -539,7 +544,7 @@ PathWithLaneId::SharedPtr BehaviorPathPlannerNode::getPath(const BehaviorModuleO
539544

540545
const auto resampled_path =
541546
util::resamplePathWithSpline(*path, planner_data_->parameters.path_interval);
542-
return std::make_shared<PathWithLaneId>(resampled_path);
547+
return std::make_pair(std::make_shared<PathWithLaneId>(resampled_path), path);
543548
}
544549

545550
PathWithLaneId::SharedPtr BehaviorPathPlannerNode::getPathCandidate(

0 commit comments

Comments
 (0)