Skip to content

Commit ba9a80c

Browse files
committed
Planning: set lateral buffer for collision checker
1 parent 4817541 commit ba9a80c

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

modules/common/math/box2d.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ void Box2d::LongitudinalExtend(const double extension_length) {
335335
InitCorners();
336336
}
337337

338+
void Box2d::LateralExtend(const double extension_length) {
339+
width_ += extension_length;
340+
half_width_ += extension_length / 2.0;
341+
InitCorners();
342+
}
343+
338344
std::string Box2d::DebugString() const {
339345
return util::StrCat("box2d ( center = ", center_.DebugString(),
340346
" heading = ", heading_, " length = ", length_,

modules/common/math/box2d.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ class Box2d {
238238
*/
239239
void LongitudinalExtend(const double extension_length);
240240

241+
void LateralExtend(const double extension_length);
242+
241243
/**
242244
* @brief Gets a human-readable description of the box
243245
* @return A debug-string

modules/planning/common/planning_gflags.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ DEFINE_double(min_velocity_sample_gap, 1.0,
303303
"Minimal sampling gap for velocity");
304304
DEFINE_double(lon_collision_buffer, 1.0,
305305
"The longitudinal buffer to keep distance to other vehicles");
306+
DEFINE_double(lat_collision_buffer, 0.2,
307+
"The lateral buffer to keep distance to other vehicles");
306308
DEFINE_uint32(num_sample_follow_per_timestamp, 3,
307309
"The number of sample points for each timestamp to follow");
308310

modules/planning/common/planning_gflags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ DECLARE_bool(enable_backup_trajectory);
161161
DECLARE_double(backup_trajectory_cost);
162162
DECLARE_double(min_velocity_sample_gap);
163163
DECLARE_double(lon_collision_buffer);
164+
DECLARE_double(lat_collision_buffer);
164165
DECLARE_uint32(num_sample_follow_per_timestamp);
165166

166167
// Lattice Evaluate Parameters

modules/planning/constraint_checker/collision_checker.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ void CollisionChecker::BuildPredictedEnvironment(
108108
TrajectoryPoint point = obstacle->GetPointAtTime(relative_time);
109109
Box2d box = obstacle->GetBoundingBox(point);
110110
box.LongitudinalExtend(2.0 * FLAGS_lon_collision_buffer);
111+
box.LateralExtend(2.0 * FLAGS_lat_collision_buffer);
111112
predicted_env.push_back(std::move(box));
112113
}
113114
predicted_bounding_rectangles_.push_back(std::move(predicted_env));

0 commit comments

Comments
 (0)