-
Notifications
You must be signed in to change notification settings - Fork 650
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(behavior_velocity): fix stop line arc length consider path index #405
Merged
taikitanaka3
merged 6 commits into
autowarefoundation:main
from
taikitanaka3:256-add-arc-length-consider-path-index
Mar 4, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7aa9a2
feat(behavior_velocity): add index to index calculation to stop line
taikitanaka3 837eb94
chore(behavior_velocity): add debug cout
taikitanaka3 328c957
chore(behavior_velocity): devide pair
taikitanaka3 9dca6b4
feat(behavior_velocity): update functions
taikitanaka3 aae88ba
chore(behaivor_velocity): remove debug
taikitanaka3 b2ec900
fix(behavior_velocity): calculate signed arc length consider stop mar…
taikitanaka3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,13 @@ namespace behavior_velocity_planner | |
{ | ||
namespace | ||
{ | ||
std::vector<lanelet::TrafficSignConstPtr> getTrafficSignRegElemsOnPath( | ||
using TrafficSignsWithLaneId = std::vector<std::pair<lanelet::TrafficSignConstPtr, int64_t>>; | ||
using StopLineWithLaneId = std::pair<lanelet::ConstLineString3d, int64_t>; | ||
TrafficSignsWithLaneId getTrafficSignRegElemsOnPath( | ||
const autoware_auto_planning_msgs::msg::PathWithLaneId & path, | ||
const lanelet::LaneletMapPtr lanelet_map) | ||
{ | ||
std::vector<lanelet::TrafficSignConstPtr> traffic_sign_reg_elems; | ||
|
||
TrafficSignsWithLaneId traffic_signs_reg_elems_with_id; | ||
std::set<int64_t> unique_lane_ids; | ||
for (const auto & p : path.points) { | ||
unique_lane_ids.insert(p.lane_ids.at(0)); // should we iterate ids? keep as it was. | ||
|
@@ -39,31 +40,34 @@ std::vector<lanelet::TrafficSignConstPtr> getTrafficSignRegElemsOnPath( | |
|
||
const auto tss = ll.regulatoryElementsAs<const lanelet::TrafficSign>(); | ||
for (const auto & ts : tss) { | ||
traffic_sign_reg_elems.push_back(ts); | ||
traffic_signs_reg_elems_with_id.push_back(std::make_pair(ts, lane_id)); | ||
} | ||
} | ||
|
||
return traffic_sign_reg_elems; | ||
return traffic_signs_reg_elems_with_id; | ||
} | ||
|
||
std::vector<lanelet::ConstLineString3d> getStopLinesOnPath( | ||
std::vector<StopLineWithLaneId> getStopLinesWithLaneIdOnPath( | ||
const autoware_auto_planning_msgs::msg::PathWithLaneId & path, | ||
const lanelet::LaneletMapPtr lanelet_map) | ||
{ | ||
std::vector<lanelet::ConstLineString3d> stop_lines; | ||
std::vector<StopLineWithLaneId> stop_lines_with_lane_id; | ||
|
||
for (const auto & traffic_sign_reg_elem : getTrafficSignRegElemsOnPath(path, lanelet_map)) { | ||
for (const auto & traffic_sign_reg_elem_with_id : | ||
getTrafficSignRegElemsOnPath(path, lanelet_map)) { | ||
const auto & traffic_sign_reg_elem = traffic_sign_reg_elem_with_id.first; | ||
const int64_t lane_id = traffic_sign_reg_elem_with_id.second; | ||
// Is stop sign? | ||
if (traffic_sign_reg_elem->type() != "stop_sign") { | ||
continue; | ||
} | ||
|
||
for (const auto & stop_line : traffic_sign_reg_elem->refLines()) { | ||
stop_lines.push_back(stop_line); | ||
stop_lines_with_lane_id.push_back(std::make_pair(stop_line, lane_id)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add id to stop line |
||
} | ||
} | ||
|
||
return stop_lines; | ||
return stop_lines_with_lane_id; | ||
} | ||
|
||
std::set<int64_t> getStopLineIdSetOnPath( | ||
|
@@ -72,8 +76,8 @@ std::set<int64_t> getStopLineIdSetOnPath( | |
{ | ||
std::set<int64_t> stop_line_id_set; | ||
|
||
for (const auto & stop_line : getStopLinesOnPath(path, lanelet_map)) { | ||
stop_line_id_set.insert(stop_line.id()); | ||
for (const auto & stop_line_with_lane_id : getStopLinesWithLaneIdOnPath(path, lanelet_map)) { | ||
stop_line_id_set.insert(stop_line_with_lane_id.first.id()); | ||
} | ||
|
||
return stop_line_id_set; | ||
|
@@ -94,12 +98,14 @@ StopLineModuleManager::StopLineModuleManager(rclcpp::Node & node) | |
void StopLineModuleManager::launchNewModules( | ||
const autoware_auto_planning_msgs::msg::PathWithLaneId & path) | ||
{ | ||
for (const auto & stop_line : | ||
getStopLinesOnPath(path, planner_data_->route_handler_->getLaneletMapPtr())) { | ||
const auto module_id = stop_line.id(); | ||
for (const auto & stop_line_with_lane_id : | ||
getStopLinesWithLaneIdOnPath(path, planner_data_->route_handler_->getLaneletMapPtr())) { | ||
const auto module_id = stop_line_with_lane_id.first.id(); | ||
const auto lane_id = stop_line_with_lane_id.second; | ||
if (!isModuleRegistered(module_id)) { | ||
registerModule(std::make_shared<StopLineModule>( | ||
module_id, stop_line, planner_param_, logger_.get_child("stop_line_module"), clock_)); | ||
module_id, lane_id, stop_line_with_lane_id.first, planner_param_, | ||
logger_.get_child("stop_line_module"), clock_)); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding laneid to reg elems