Skip to content

Commit 4de049b

Browse files
feat(static_obstacle_avoidance): update envelope polygon creation method (autowarefoundation#8551)
* update envelope polygon by considering pose covariance Signed-off-by: Go Sakayori <gsakayori@gmail.com> * change parameter Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * modify schema json Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * Update planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/src/utils.cpp Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com> --------- Signed-off-by: Go Sakayori <gsakayori@gmail.com> Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com>
1 parent 83aa6bf commit 4de049b

File tree

8 files changed

+107
-8
lines changed

8 files changed

+107
-8
lines changed

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/config/static_obstacle_avoidance.param.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
hard_margin_for_parked_vehicle: 0.7 # [m]
2929
max_expand_ratio: 0.0 # [-] FOR DEVELOPER
3030
envelope_buffer_margin: 0.5 # [m] FOR DEVELOPER
31+
th_error_eclipse_long_radius : 0.6 # [m]
3132
truck:
3233
th_moving_speed: 1.0
3334
th_moving_time: 2.0
@@ -38,6 +39,7 @@
3839
hard_margin_for_parked_vehicle: 0.7
3940
max_expand_ratio: 0.0
4041
envelope_buffer_margin: 0.5
42+
th_error_eclipse_long_radius : 0.6
4143
bus:
4244
th_moving_speed: 1.0
4345
th_moving_time: 2.0
@@ -48,6 +50,7 @@
4850
hard_margin_for_parked_vehicle: 0.7
4951
max_expand_ratio: 0.0
5052
envelope_buffer_margin: 0.5
53+
th_error_eclipse_long_radius : 0.6
5154
trailer:
5255
th_moving_speed: 1.0
5356
th_moving_time: 2.0
@@ -58,6 +61,7 @@
5861
hard_margin_for_parked_vehicle: 0.7
5962
max_expand_ratio: 0.0
6063
envelope_buffer_margin: 0.5
64+
th_error_eclipse_long_radius : 0.6
6165
unknown:
6266
th_moving_speed: 0.28
6367
th_moving_time: 1.0
@@ -68,6 +72,7 @@
6872
hard_margin_for_parked_vehicle: -0.2
6973
max_expand_ratio: 0.0
7074
envelope_buffer_margin: 0.1
75+
th_error_eclipse_long_radius : 0.6
7176
bicycle:
7277
th_moving_speed: 0.28
7378
th_moving_time: 1.0
@@ -78,6 +83,7 @@
7883
hard_margin_for_parked_vehicle: 0.5
7984
max_expand_ratio: 0.0
8085
envelope_buffer_margin: 0.5
86+
th_error_eclipse_long_radius : 0.6
8187
motorcycle:
8288
th_moving_speed: 1.0
8389
th_moving_time: 1.0
@@ -88,6 +94,7 @@
8894
hard_margin_for_parked_vehicle: 0.3
8995
max_expand_ratio: 0.0
9096
envelope_buffer_margin: 0.5
97+
th_error_eclipse_long_radius : 0.6
9198
pedestrian:
9299
th_moving_speed: 0.28
93100
th_moving_time: 1.0
@@ -98,6 +105,7 @@
98105
hard_margin_for_parked_vehicle: 0.5
99106
max_expand_ratio: 0.0
100107
envelope_buffer_margin: 0.5
108+
th_error_eclipse_long_radius : 0.6
101109
lower_distance_for_polygon_expansion: 30.0 # [m] FOR DEVELOPER
102110
upper_distance_for_polygon_expansion: 100.0 # [m] FOR DEVELOPER
103111

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/include/autoware/behavior_path_static_obstacle_avoidance_module/data_structs.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ struct ObjectParameter
9090
double lateral_hard_margin_for_parked_vehicle{1.0};
9191

9292
double longitudinal_margin{0.0};
93+
94+
double th_error_eclipse_long_radius{0.0};
9395
};
9496

9597
struct AvoidanceParameters
@@ -420,6 +422,9 @@ struct ObjectData // avoidance target
420422
// to stop line distance
421423
double to_stop_line{std::numeric_limits<double>::infinity()};
422424

425+
// long radius of the covariance error ellipse
426+
double error_eclipse_max{std::numeric_limits<double>::infinity()};
427+
423428
// if lateral margin is NOT enough, the ego must avoid the object.
424429
bool avoid_required{false};
425430

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/include/autoware/behavior_path_static_obstacle_avoidance_module/parameter_helper.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ AvoidanceParameters getParameter(rclcpp::Node * node)
6969
param.lateral_hard_margin_for_parked_vehicle =
7070
getOrDeclareParameter<double>(*node, ns + "lateral_margin.hard_margin_for_parked_vehicle");
7171
param.longitudinal_margin = getOrDeclareParameter<double>(*node, ns + "longitudinal_margin");
72+
param.th_error_eclipse_long_radius =
73+
getOrDeclareParameter<double>(*node, ns + "th_error_eclipse_long_radius");
7274
return param;
7375
};
7476

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/include/autoware/behavior_path_static_obstacle_avoidance_module/type_alias.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ using tier4_planning_msgs::msg::PathWithLaneId;
4141
// ROS 2 general msgs
4242
using geometry_msgs::msg::Point;
4343
using geometry_msgs::msg::Pose;
44+
using geometry_msgs::msg::PoseWithCovariance;
4445
using geometry_msgs::msg::TransformStamped;
4546
using geometry_msgs::msg::Vector3;
4647
using std_msgs::msg::ColorRGBA;

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/include/autoware/behavior_path_static_obstacle_avoidance_module/utils.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ double calcDistanceToAvoidStartLine(
174174
const std::shared_ptr<const PlannerData> & planner_data,
175175
const std::shared_ptr<AvoidanceParameters> & parameters);
176176

177+
double calcErrorEclipseLongRadius(const PoseWithCovariance & pose);
178+
177179
} // namespace autoware::behavior_path_planner::utils::static_obstacle_avoidance
178180

179181
#endif // AUTOWARE__BEHAVIOR_PATH_STATIC_OBSTACLE_AVOIDANCE_MODULE__UTILS_HPP_

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/schema/static_obstacle_avoidance.schema.json

+56-8
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
"type": "number",
9797
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
9898
"default": 0.0
99+
},
100+
"th_error_eclipse_long_radius": {
101+
"type": "number",
102+
"description": "This value will be applied to judge whether the eclipse error is to large",
103+
"default": 0.6
99104
}
100105
},
101106
"required": [
@@ -104,7 +109,8 @@
104109
"longitudinal_margin",
105110
"lateral_margin",
106111
"envelope_buffer_margin",
107-
"max_expand_ratio"
112+
"max_expand_ratio",
113+
"th_error_eclipse_long_radius"
108114
],
109115
"additionalProperties": false
110116
},
@@ -158,6 +164,11 @@
158164
"type": "number",
159165
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
160166
"default": 0.0
167+
},
168+
"th_error_eclipse_long_radius": {
169+
"type": "number",
170+
"description": "This value will be applied to judge whether the eclipse error is to large",
171+
"default": 0.6
161172
}
162173
},
163174
"required": [
@@ -166,7 +177,8 @@
166177
"longitudinal_margin",
167178
"lateral_margin",
168179
"envelope_buffer_margin",
169-
"max_expand_ratio"
180+
"max_expand_ratio",
181+
"th_error_eclipse_long_radius"
170182
],
171183
"additionalProperties": false
172184
},
@@ -220,6 +232,11 @@
220232
"type": "number",
221233
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
222234
"default": 0.0
235+
},
236+
"th_error_eclipse_long_radius": {
237+
"type": "number",
238+
"description": "This value will be applied to judge whether the eclipse error is to large",
239+
"default": 0.6
223240
}
224241
},
225242
"required": [
@@ -228,7 +245,8 @@
228245
"longitudinal_margin",
229246
"lateral_margin",
230247
"envelope_buffer_margin",
231-
"max_expand_ratio"
248+
"max_expand_ratio",
249+
"th_error_eclipse_long_radius"
232250
],
233251
"additionalProperties": false
234252
},
@@ -282,6 +300,11 @@
282300
"type": "number",
283301
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
284302
"default": 0.0
303+
},
304+
"th_error_eclipse_long_radius": {
305+
"type": "number",
306+
"description": "This value will be applied to judge whether the eclipse error is to large",
307+
"default": 0.6
285308
}
286309
},
287310
"required": [
@@ -290,7 +313,8 @@
290313
"longitudinal_margin",
291314
"lateral_margin",
292315
"envelope_buffer_margin",
293-
"max_expand_ratio"
316+
"max_expand_ratio",
317+
"th_error_eclipse_long_radius"
294318
],
295319
"additionalProperties": false
296320
},
@@ -344,6 +368,11 @@
344368
"type": "number",
345369
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
346370
"default": 0.0
371+
},
372+
"th_error_eclipse_long_radius": {
373+
"type": "number",
374+
"description": "This value will be applied to judge whether the eclipse error is to large",
375+
"default": 0.6
347376
}
348377
},
349378
"required": [
@@ -352,7 +381,8 @@
352381
"longitudinal_margin",
353382
"lateral_margin",
354383
"envelope_buffer_margin",
355-
"max_expand_ratio"
384+
"max_expand_ratio",
385+
"th_error_eclipse_long_radius"
356386
],
357387
"additionalProperties": false
358388
},
@@ -406,6 +436,11 @@
406436
"type": "number",
407437
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
408438
"default": 0.0
439+
},
440+
"th_error_eclipse_long_radius": {
441+
"type": "number",
442+
"description": "This value will be applied to judge whether the eclipse error is to large",
443+
"default": 0.6
409444
}
410445
},
411446
"required": [
@@ -414,7 +449,8 @@
414449
"longitudinal_margin",
415450
"lateral_margin",
416451
"envelope_buffer_margin",
417-
"max_expand_ratio"
452+
"max_expand_ratio",
453+
"th_error_eclipse_long_radius"
418454
],
419455
"additionalProperties": false
420456
},
@@ -468,6 +504,11 @@
468504
"type": "number",
469505
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
470506
"default": 0.0
507+
},
508+
"th_error_eclipse_long_radius": {
509+
"type": "number",
510+
"description": "This value will be applied to judge whether the eclipse error is to large",
511+
"default": 0.6
471512
}
472513
},
473514
"required": [
@@ -476,7 +517,8 @@
476517
"longitudinal_margin",
477518
"lateral_margin",
478519
"envelope_buffer_margin",
479-
"max_expand_ratio"
520+
"max_expand_ratio",
521+
"th_error_eclipse_long_radius"
480522
],
481523
"additionalProperties": false
482524
},
@@ -530,6 +572,11 @@
530572
"type": "number",
531573
"description": "This value will be applied envelope_buffer_margin according to the distance between the ego and object.",
532574
"default": 0.0
575+
},
576+
"th_error_eclipse_long_radius": {
577+
"type": "number",
578+
"description": "This value will be applied to judge whether the eclipse error is to large",
579+
"default": 0.6
533580
}
534581
},
535582
"required": [
@@ -538,7 +585,8 @@
538585
"longitudinal_margin",
539586
"lateral_margin",
540587
"envelope_buffer_margin",
541-
"max_expand_ratio"
588+
"max_expand_ratio",
589+
"th_error_eclipse_long_radius"
542590
],
543591
"additionalProperties": false
544592
},

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/src/manager.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ void StaticObstacleAvoidanceModuleManager::updateModuleParams(
6060
parameters, ns + "lateral_margin.hard_margin_for_parked_vehicle",
6161
config.lateral_hard_margin_for_parked_vehicle);
6262
updateParam<double>(parameters, ns + "longitudinal_margin", config.longitudinal_margin);
63+
updateParam<double>(
64+
parameters, ns + "th_error_eclipse_long_radius", config.th_error_eclipse_long_radius);
6365
};
6466

6567
{

planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/src/utils.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "autoware/behavior_path_static_obstacle_avoidance_module/data_structs.hpp"
2222
#include "autoware/behavior_path_static_obstacle_avoidance_module/utils.hpp"
2323

24+
#include <Eigen/Dense>
2425
#include <lanelet2_extension/utility/message_conversion.hpp>
2526

2627
#include <boost/geometry/algorithms/buffer.hpp>
@@ -1500,11 +1501,27 @@ void fillObjectEnvelopePolygon(
15001501
if (same_id_obj == registered_objects.end()) {
15011502
object_data.envelope_poly =
15021503
createEnvelopePolygon(object_data, closest_pose, envelope_buffer_margin);
1504+
object_data.error_eclipse_max =
1505+
calcErrorEclipseLongRadius(object_data.object.kinematics.initial_pose_with_covariance);
15031506
return;
15041507
}
15051508

15061509
const auto one_shot_envelope_poly =
15071510
createEnvelopePolygon(object_data, closest_pose, envelope_buffer_margin);
1511+
const double error_eclipse_long_radius =
1512+
calcErrorEclipseLongRadius(object_data.object.kinematics.initial_pose_with_covariance);
1513+
1514+
if (error_eclipse_long_radius > object_parameter.th_error_eclipse_long_radius) {
1515+
if (error_eclipse_long_radius < object_data.error_eclipse_max) {
1516+
object_data.error_eclipse_max = error_eclipse_long_radius;
1517+
object_data.envelope_poly = one_shot_envelope_poly;
1518+
return;
1519+
}
1520+
object_data.envelope_poly = same_id_obj->envelope_poly;
1521+
return;
1522+
}
1523+
1524+
object_data.error_eclipse_max = error_eclipse_long_radius;
15081525

15091526
// If the one_shot_envelope_poly is within the registered envelope, use the registered one
15101527
if (boost::geometry::within(one_shot_envelope_poly, same_id_obj->envelope_poly)) {
@@ -2512,4 +2529,18 @@ double calcDistanceToReturnDeadLine(
25122529

25132530
return distance_to_return_dead_line;
25142531
}
2532+
2533+
double calcErrorEclipseLongRadius(const PoseWithCovariance & pose)
2534+
{
2535+
Eigen::Matrix2d xy_covariance;
2536+
const auto cov = pose.covariance;
2537+
xy_covariance(0, 0) = cov[0 * 6 + 0];
2538+
xy_covariance(0, 1) = cov[0 * 6 + 1];
2539+
xy_covariance(1, 0) = cov[1 * 6 + 0];
2540+
xy_covariance(1, 1) = cov[1 * 6 + 1];
2541+
2542+
Eigen::SelfAdjointEigenSolver<Eigen::Matrix2d> eigensolver(xy_covariance);
2543+
2544+
return std::sqrt(eigensolver.eigenvalues()(1));
2545+
}
25152546
} // namespace autoware::behavior_path_planner::utils::static_obstacle_avoidance

0 commit comments

Comments
 (0)