Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lane_change): fix lane change force approval by rtc (#2672) #246

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class LaneChangeModule : public SceneModuleInterface
void updateSteeringFactorPtr(
const CandidateOutput & output, const LaneChangePath & selected_path) const;
bool isSafe() const;
bool isValidPath() const;
bool isValidPath(const PathWithLaneId & path) const;
bool isNearEndOfLane() const;
bool isCurrentSpeedLow() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct LaneChangeStatus
std::vector<uint64_t> lane_follow_lane_ids;
std::vector<uint64_t> lane_change_lane_ids;
bool is_safe;
bool is_valid_path = true;
double start_distance;
};
} // namespace behavior_path_planner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ BehaviorModuleOutput LaneChangeModule::run()
is_activated_ = isActivated();
auto output = plan();

if (!isSafe()) {
if (!isValidPath()) {
current_state_ = BT::NodeStatus::SUCCESS; // for breaking loop
return output;
}
Expand Down Expand Up @@ -118,7 +118,7 @@ bool LaneChangeModule::isExecutionReady() const
BT::NodeStatus LaneChangeModule::updateState()
{
RCLCPP_DEBUG(getLogger(), "LANE_CHANGE updateState");
if (!isSafe()) {
if (!isValidPath()) {
current_state_ = BT::NodeStatus::SUCCESS;
return current_state_;
}
Expand Down Expand Up @@ -148,8 +148,10 @@ BehaviorModuleOutput LaneChangeModule::plan()
auto path = status_.lane_change_path.path;

if (!isValidPath(path)) {
status_.is_safe = false;
status_.is_valid_path = false;
return BehaviorModuleOutput{};
} else {
status_.is_valid_path = true;
}
generateExtendedDrivableArea(path);

Expand Down Expand Up @@ -374,6 +376,8 @@ std::pair<bool, bool> LaneChangeModule::getSafePath(

bool LaneChangeModule::isSafe() const { return status_.is_safe; }

bool LaneChangeModule::isValidPath() const { return status_.is_valid_path; }

bool LaneChangeModule::isValidPath(const PathWithLaneId & path) const
{
const auto & route_handler = planner_data_->route_handler;
Expand Down