Skip to content

Commit 0d4b1ca

Browse files
authored
fix(obstacle stop/slow_down): early return without point cloud (#10289)
* fix(obstacle stop/slow_down): early return without point cloud Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * update maintainer Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> --------- Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
1 parent 837db39 commit 0d4b1ca

File tree

7 files changed

+16
-25
lines changed

7 files changed

+16
-25
lines changed

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_slow_down_module/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<maintainer email="takayuki.murooka@tier4.jp">Takayuki Murooka</maintainer>
99
<maintainer email="yuki.takagi@tier4.jp">Yuki Takagi</maintainer>
1010
<maintainer email="maxime.clement@tier4.jp">Maxime Clement</maintainer>
11+
<maintainer email="arjun.ram@tier4.jp">Arjun Ram</maintainer>
1112

1213
<license>Apache License 2.0</license>
1314

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_slow_down_module/src/obstacle_slow_down_module.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ std::vector<SlowDownObstacle> ObstacleSlowDownModule::filter_slow_down_obstacle_
454454
{
455455
autoware_utils::ScopedTimeTrack st(__func__, *time_keeper_);
456456

457+
if (!obstacle_filtering_param_.use_pointcloud) {
458+
return std::vector<SlowDownObstacle>{};
459+
}
460+
457461
// calculate collision points with trajectory with lateral stop margin
458462
// NOTE: For additional margin, hysteresis is not divided by two.
459463
const auto & p = obstacle_filtering_param_;
@@ -480,11 +484,7 @@ std::vector<SlowDownObstacle> ObstacleSlowDownModule::filter_slow_down_obstacle_
480484
const auto slow_down_obstacle = create_slow_down_obstacle_for_point_cloud(
481485
rclcpp::Time(point_cloud.pointcloud.header.stamp), front_collision_point,
482486
back_collision_point, slow_down_point_data.lat_dist_to_traj);
483-
484-
if (slow_down_obstacle) {
485-
slow_down_obstacles.push_back(*slow_down_obstacle);
486-
continue;
487-
}
487+
slow_down_obstacles.push_back(slow_down_obstacle);
488488
}
489489

490490
RCLCPP_DEBUG(
@@ -630,13 +630,10 @@ ObstacleSlowDownModule::create_slow_down_obstacle_for_predicted_object(
630630
back_collision_point};
631631
}
632632

633-
std::optional<SlowDownObstacle> ObstacleSlowDownModule::create_slow_down_obstacle_for_point_cloud(
633+
SlowDownObstacle ObstacleSlowDownModule::create_slow_down_obstacle_for_point_cloud(
634634
const rclcpp::Time & stamp, const geometry_msgs::msg::Point & front_collision_point,
635635
const geometry_msgs::msg::Point & back_collision_point, const double lat_dist_to_traj)
636636
{
637-
if (!obstacle_filtering_param_.use_pointcloud) {
638-
return std::nullopt;
639-
}
640637
const unique_identifier_msgs::msg::UUID obj_uuid;
641638
const auto & obj_uuid_str = autoware_utils::to_hex_string(obj_uuid);
642639

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_slow_down_module/src/obstacle_slow_down_module.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class ObstacleSlowDownModule : public PluginModuleInterface
111111
const std::vector<Polygon2d> & decimated_traj_polys_with_lat_margin,
112112
const std::shared_ptr<PlannerData::Object> object, const rclcpp::Time & predicted_objects_stamp,
113113
const double dist_from_obj_poly_to_traj_poly);
114-
std::optional<SlowDownObstacle> create_slow_down_obstacle_for_point_cloud(
114+
SlowDownObstacle create_slow_down_obstacle_for_point_cloud(
115115
const rclcpp::Time & stamp, const geometry_msgs::msg::Point & front_collision_point,
116116
const geometry_msgs::msg::Point & back_collision_point, const double lat_dist_to_traj);
117117
std::vector<SlowdownInterval> plan_slow_down(

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_stop_module/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<maintainer email="takayuki.murooka@tier4.jp">Takayuki Murooka</maintainer>
99
<maintainer email="yuki.takagi@tier4.jp">Yuki Takagi</maintainer>
1010
<maintainer email="maxime.clement@tier4.jp">Maxime Clement</maintainer>
11+
<maintainer email="arjun.ram@tier4.jp">Arjun Ram</maintainer>
1112
<maintainer email="berkay@leodrive.ai">Berkay Karaman</maintainer>
1213

1314
<license>Apache License 2.0</license>

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_stop_module/src/obstacle_stop_module.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ void ObstacleStopModule::init(rclcpp::Node & node, const std::string & module_na
149149
common_param_ = CommonParam(node);
150150
stop_planning_param_ = StopPlanningParam(node, common_param_);
151151
obstacle_filtering_param_ = ObstacleFilteringParam(node);
152-
use_pointcloud_ =
153-
get_or_declare_parameter<bool>(node, "obstacle_stop.obstacle_filtering.object_type.pointcloud");
154152

155153
// common publisher
156154
processing_time_publisher_ =
@@ -332,14 +330,10 @@ std::vector<geometry_msgs::msg::Point> ObstacleStopModule::convert_point_cloud_t
332330
return stop_collision_points;
333331
}
334332

335-
std::optional<StopObstacle> ObstacleStopModule::create_stop_obstacle_for_point_cloud(
333+
StopObstacle ObstacleStopModule::create_stop_obstacle_for_point_cloud(
336334
const std::vector<TrajectoryPoint> & traj_points, const rclcpp::Time & stamp,
337335
const geometry_msgs::msg::Point & stop_point, const double dist_to_bumper) const
338336
{
339-
if (!use_pointcloud_) {
340-
return std::nullopt;
341-
}
342-
343337
const auto dist_to_collide_on_traj =
344338
autoware::motion_utils::calcSignedArcLength(traj_points, 0, stop_point) - dist_to_bumper;
345339

@@ -448,6 +442,10 @@ std::vector<StopObstacle> ObstacleStopModule::filter_stop_obstacle_for_point_clo
448442
{
449443
autoware_utils::ScopedTimeTrack st(__func__, *time_keeper_);
450444

445+
if (!obstacle_filtering_param_.use_pointcloud) {
446+
return std::vector<StopObstacle>{};
447+
}
448+
451449
const auto & tp = trajectory_polygon_collision_check;
452450

453451
const std::vector<geometry_msgs::msg::Point> stop_points =
@@ -468,10 +466,7 @@ std::vector<StopObstacle> ObstacleStopModule::filter_stop_obstacle_for_point_clo
468466
// Filter obstacles for stop
469467
const auto stop_obstacle = create_stop_obstacle_for_point_cloud(
470468
decimated_traj_points, stop_obstacle_stamp, stop_point, dist_to_bumper);
471-
if (stop_obstacle) {
472-
stop_obstacles.push_back(*stop_obstacle);
473-
continue;
474-
}
469+
stop_obstacles.push_back(stop_obstacle);
475470
}
476471

477472
std::vector<StopObstacle> past_stop_obstacles;

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_stop_module/src/obstacle_stop_module.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class ObstacleStopModule : public PluginModuleInterface
6868
// ros parameters
6969
bool ignore_crossing_obstacle_{};
7070
bool suppress_sudden_stop_{};
71-
bool use_pointcloud_{false};
7271
CommonParam common_param_{};
7372
StopPlanningParam stop_planning_param_{};
7473
ObstacleFilteringParam obstacle_filtering_param_{};
@@ -187,7 +186,7 @@ class ObstacleStopModule : public PluginModuleInterface
187186
const VehicleInfo & vehicle_info, const double dist_to_bumper,
188187
const TrajectoryPolygonCollisionCheck & trajectory_polygon_collision_check) const;
189188

190-
std::optional<StopObstacle> create_stop_obstacle_for_point_cloud(
189+
StopObstacle create_stop_obstacle_for_point_cloud(
191190
const std::vector<TrajectoryPoint> & traj_points, const rclcpp::Time & stamp,
192191
const geometry_msgs::msg::Point & stop_point, const double dist_to_bumper) const;
193192

planning/motion_velocity_planner/autoware_motion_velocity_obstacle_stop_module/src/parameters.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ struct ObstacleFilteringParam
120120
utils::get_target_object_type(node, "obstacle_stop.obstacle_filtering.object_type.inside.");
121121
outside_stop_object_types =
122122
utils::get_target_object_type(node, "obstacle_stop.obstacle_filtering.object_type.outside.");
123-
use_pointcloud = get_or_declare_parameter<bool>(
124-
node, "obstacle_stop.obstacle_filtering.object_type.pointcloud");
125123

126124
obstacle_velocity_threshold_to_stop = get_or_declare_parameter<double>(
127125
node, "obstacle_stop.obstacle_filtering.obstacle_velocity_threshold_to_stop");

0 commit comments

Comments
 (0)