-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor(behavior_velocity): refactor codes #8
Conversation
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
@@ -1,7 +1,7 @@ | |||
/**: | |||
ros__parameters: | |||
occlusion_spot: | |||
detection_method: "predicted_object" # [-] candidate is "occupancy_grid" or "predicted_object" | |||
detection_method: "occupancy_grid" # [-] candidate is "occupancy_grid" or "predicted_object" |
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.
default to occ grid
@@ -275,7 +276,7 @@ PossibleCollisionInfo calculateCollisionPathPointFromOcclusionSpot( | |||
const ArcCoordinates & arc_coord_occlusion_with_offset, | |||
const lanelet::ConstLanelet & path_lanelet, const PlannerParam & param) | |||
{ | |||
auto setPose = [](const lanelet::ConstLanelet & pl, const ArcCoordinates & arc) { | |||
auto calcPose = [](const lanelet::ConstLanelet & pl, const ArcCoordinates & arc) { |
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.
calcPose
@@ -395,28 +390,22 @@ bool createPossibleCollisionsInDetectionArea( | |||
const auto pc = generateOneNotableCollisionFromOcclusionSpot( | |||
grid, occlusion_spot_positions, offset_from_start_to_ego, base_point, path_lanelet, param, | |||
debug_data); | |||
if (!pc) continue; | |||
if (pc == boost::none) continue; |
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.
boost::none
{ | ||
for (const auto & p : partitions) { | ||
if (bg::intersects(direction, p)) return false; | ||
if (bg::intersects(direction, p)) return true; |
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.
blocked case
} | ||
return true; | ||
return false; |
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.
no blocking
@@ -453,22 +442,22 @@ boost::optional<PossibleCollisionInfo> generateOneNotableCollisionFromOcclusionS | |||
const auto & ip = pc.intersection_pose.position; | |||
bool collision_free_at_intersection = grid_utils::isCollisionFree( | |||
grid, occlusion_spot_position, grid_map::Position(ip.x, ip.y), param.pedestrian_radius); | |||
bool obstacle_not_blocked_by_partition = true; | |||
bool is_obstacle_blocked_by_partition = false; |
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.
default is not blocked
} | ||
if (!obstacle_not_blocked_by_partition) continue; | ||
if (is_obstacle_blocked_by_partition) continue; |
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.
if blocked continue
#define DEBUG_PRINT(enable, n, x) \ | ||
if (enable) { \ | ||
const double time = x; \ | ||
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, n << time); \ |
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.
tick at every time
print at given interval
} else if (param_.detection_method == utils::DETECTION_METHOD::PREDICTED_OBJECT) { | ||
debug_data_.detection_type = "object"; | ||
} | ||
if (param_.use_partition_lanelet) { | ||
const lanelet::LaneletMapConstPtr & ll = planner_data->route_handler_->getLaneletMapPtr(); | ||
planning_utils::getAllPartitionLanelets(ll, debug_data_.partition_lanelets); | ||
planning_utils::getAllPartitionLanelets(ll, partition_lanelets_); |
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.
store at class variables
} | ||
} | ||
|
||
bool OcclusionSpotModule::modifyPathVelocity( | ||
autoware_auto_planning_msgs::msg::PathWithLaneId * path, | ||
[[maybe_unused]] tier4_planning_msgs::msg::StopReason * stop_reason) | ||
{ | ||
if (param_.is_show_processing_time) stop_watch_.tic("total_processing_time"); |
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.
[rviz2-30] [INFO] [1648453219.536895053] [CarInitialPoseTool]: Setting twist: 0.000 0.000 0.000 [frame=map]
[component_container_mt-13] [INFO] [1648453219.689546629] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: occlusion [ms]: 0.797
[component_container_mt-13] [INFO] [1648453219.689573733] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: num collision:1
[component_container_mt-13] [INFO] [1648453219.689611884] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: total [ms]: 1.111
[component_container_mt-13] [INFO] [1648453219.888806628] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: apply velocity [ms]: 0.002
[component_container_mt-13] [INFO] [1648453219.888841272] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: generate poly[ms]: 0.038
[component_container_mt-13] [INFO] [1648453219.888849376] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: extract[ms]: 0.009
[component_container_mt-13] [INFO] [1648453219.889075952] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: grid [ms]: 0.225
[ad_service_state_monitor-3] [INFO] [1648453219.954095513] [system.ad_service_state_monitor]: state changed: 3 -> 4
[component_container_mt-13] [INFO] [1648453222.690365723] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: occlusion [ms]: 1.564
[component_container_mt-13] [INFO] [1648453222.690387574] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: num collision:1
[component_container_mt-13] [INFO] [1648453222.690397659] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: total [ms]: 1.85
[component_container_mt-13] [INFO] [1648453222.988800341] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: apply velocity [ms]: 0.003
[component_container_mt-13] [INFO] [1648453222.988835603] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: generate poly[ms]: 0.038
[component_container_mt-13] [INFO] [1648453222.988844615] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: extract[ms]: 0.01
[component_container_mt-13] [INFO] [1648453222.989077456] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: grid [ms]: 0.231
[component_container_mt-13] [INFO] [1648453225.690586225] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: occlusion [ms]: 1.672
[component_container_mt-13] [INFO] [1648453225.690608788] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: num collision:1
[component_container_mt-13] [INFO] [1648453225.690618656] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: total [ms]: 1.977
[component_container_mt-13] [INFO] [1648453225.990610094] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: apply velocity [ms]: 0.002
[component_container_mt-13] [INFO] [1648453225.990650222] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: generate poly[ms]: 0.044
[component_container_mt-13] [INFO] [1648453225.990659870] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: extract[ms]: 0.01
[component_container_mt-13] [INFO] [1648453225.990939249] [planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner.occlusion_spot_module]: grid [ms]: 0.278
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.
rich printing to compare performance
if (param_.detection_method == utils::DETECTION_METHOD::OCCUPANCY_GRID) { | ||
const auto & occ_grid_ptr = planner_data_->occupancy_grid; | ||
if (!occ_grid_ptr) return true; // mo data | ||
if (!occ_grid_ptr) return true; // no data |
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.
no data
@@ -45,20 +48,22 @@ OcclusionSpotModule::OcclusionSpotModule( | |||
if (param_.detection_method == utils::DETECTION_METHOD::OCCUPANCY_GRID) { | |||
debug_data_.detection_type = "occupancy"; | |||
//! occupancy grid limitation( 100 * 100 ) | |||
param_.detection_area_length = std::min(50.0, param_.detection_area_length); | |||
const double max_length = 35.0; // current available length |
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.
set max usable length
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.
clang-tidy
found issue(s) with the introduced code (1/1)
possible_collisions.begin(), possible_collisions.end(), | ||
[](PossibleCollisionInfo pc1, PossibleCollisionInfo pc2) { | ||
return pc1.arc_lane_dist_at_collision.length < pc2.arc_lane_dist_at_collision.length; | ||
}); | ||
if (possible_collisions.empty()) return false; |
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.
redundant boolean literal in conditional return statement
if (possible_collisions.empty()) return false; | |
return !possible_collisions.empty() |
possible_collisions.begin(), possible_collisions.end(), | ||
[](PossibleCollisionInfo pc1, PossibleCollisionInfo pc2) { | ||
return pc1.arc_lane_dist_at_collision.length < pc2.arc_lane_dist_at_collision.length; | ||
}); | ||
if (possible_collisions.empty()) return false; |
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.
redundant boolean literal in conditional return statement
if (possible_collisions.empty()) return false; | |
return !possible_collisions.empty() |
} | ||
if (!obstacle_not_blocked_by_partition) continue; | ||
if (is_obstacle_blocked_by_partition) continue; | ||
distance_lower_bound = dist; | ||
candidate = pc; | ||
has_collision = true; | ||
} | ||
if (has_collision) { | ||
return candidate; | ||
} else { |
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.
do not use else
after return
} else { | |
} { |
} | ||
if (!obstacle_not_blocked_by_partition) continue; | ||
if (is_obstacle_blocked_by_partition) continue; | ||
distance_lower_bound = dist; | ||
candidate = pc; | ||
has_collision = true; | ||
} | ||
if (has_collision) { | ||
return candidate; | ||
} else { |
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.
do not use else
after return
} else { | |
} else return boost::none; |
#define DEBUG_PRINT(enable, n, x) \ | ||
if (enable) { \ | ||
const double time = x; \ | ||
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, n << time); \ |
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.
macro argument should be enclosed in parentheses
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, n << time); \ | |
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, (n << time); \ |
#define DEBUG_PRINT(enable, n, x) \ | ||
if (enable) { \ | ||
const double time = x; \ | ||
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, n << time); \ |
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.
macro argument should be enclosed in parentheses
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, n << time); \ | |
RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, n) << time); \ |
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
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.
clang-tidy
found issue(s) with the introduced code (1/1)
if (enable) RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, x); | ||
#define DEBUG_PRINT(enable, n, x) \ | ||
if (enable) { \ | ||
const std::string time_msg = n + std::to_string(x); \ |
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.
macro argument should be enclosed in parentheses
const std::string time_msg = n + std::to_string(x); \ | |
const std::string time_msg = (n + std::to_string(x); \ |
if (enable) RCLCPP_INFO_STREAM_THROTTLE(logger_, *clock_, 3000, x); | ||
#define DEBUG_PRINT(enable, n, x) \ | ||
if (enable) { \ | ||
const std::string time_msg = n + std::to_string(x); \ |
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.
macro argument should be enclosed in parentheses
const std::string time_msg = n + std::to_string(x); \ | |
const std::string time_msg = n) + std::to_string(x); \ |
…us (autowarefoundation#3511) * Merge feat/intersection-occlusion-latest (#8) Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * fixed virtual wall marker Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * use is_occluded flag Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * 3 rtc intersection appears Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * clearCooperateStatus before sendRTC not to duplicate default/occlusion_first_stop_uuid Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> --------- Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
fix autowarefoundation#3511) (autowarefoundation#3512) * Merge feat/intersection-occlusion-latest (#8) Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * fixed virtual wall marker Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * use is_occluded flag Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * 3 rtc intersection appears Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * clearCooperateStatus before sendRTC not to duplicate default/occlusion_first_stop_uuid Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * clearCooperateStatus at the beginning of send RTC Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> --------- Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
Signed-off-by: tanaka3 ttatcoder@outlook.jp
Note: Confirm the contribution guidelines before submitting a pull request.
Click the
Preview
tab and select a PR template:Do NOT send a PR with this description.