Skip to content

Commit a40814d

Browse files
committed
fix: set minimum size, to avoid iou error/overflow
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent b80c446 commit a40814d

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

perception/multi_object_tracker/src/tracker/model/bicycle_tracker.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ BicycleTracker::BicycleTracker(
6161
ekf_params_.r_cov_y = std::pow(r_stddev_y, 2.0);
6262
ekf_params_.r_cov_yaw = std::pow(r_stddev_yaw, 2.0);
6363

64+
// OBJECT SHAPE MODEL
65+
if (object.shape.type == autoware_auto_perception_msgs::msg::Shape::BOUNDING_BOX) {
66+
bounding_box_ = {
67+
object.shape.dimensions.x, object.shape.dimensions.y, object.shape.dimensions.z};
68+
} else {
69+
bounding_box_ = {1.0, 0.5, 1.7};
70+
}
71+
// set minimum size
72+
bounding_box_.length = std::max(bounding_box_.length, 0.5);
73+
bounding_box_.width = std::max(bounding_box_.width, 0.3);
74+
bounding_box_.height = std::max(bounding_box_.height, 0.8);
75+
6476
// Set motion model parameters
6577
{
6678
constexpr double q_stddev_acc_long =
@@ -211,13 +223,22 @@ bool BicycleTracker::measureWithPose(
211223
bool BicycleTracker::measureWithShape(
212224
const autoware_auto_perception_msgs::msg::DetectedObject & object)
213225
{
226+
if (!object.shape.type == autoware_auto_perception_msgs::msg::Shape::BOUNDING_BOX) {
227+
// do not update shape if the input is not a bounding box
228+
return true;
229+
}
230+
214231
constexpr double gain = 0.1;
215232
constexpr double gain_inv = 1.0 - gain;
216233

217234
// update object size
218235
bounding_box_.length = gain_inv * bounding_box_.length + gain * object.shape.dimensions.x;
219236
bounding_box_.width = gain_inv * bounding_box_.width + gain * object.shape.dimensions.y;
220237
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;
238+
// set minimum size
239+
bounding_box_.length = std::max(bounding_box_.length, 0.5);
240+
bounding_box_.width = std::max(bounding_box_.width, 0.3);
241+
bounding_box_.height = std::max(bounding_box_.height, 0.8);
221242

222243
// update motion model
223244
motion_model_.updateExtendedState(bounding_box_.length);

perception/multi_object_tracker/src/tracker/model/big_vehicle_tracker.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ BigVehicleTracker::BigVehicleTracker(
8282
bbox_object.shape.dimensions.z};
8383
last_input_bounding_box_ = bounding_box_;
8484
}
85+
// set minimum size
86+
bounding_box_.length = std::max(bounding_box_.length, 2.5);
87+
bounding_box_.width = std::max(bounding_box_.width, 1.0);
88+
bounding_box_.height = std::max(bounding_box_.height, 1.0);
8589

8690
// Set motion model parameters
8791
{
@@ -305,6 +309,10 @@ bool BigVehicleTracker::measureWithShape(
305309
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;
306310
last_input_bounding_box_ = {
307311
object.shape.dimensions.x, object.shape.dimensions.y, object.shape.dimensions.z};
312+
// set minimum size
313+
bounding_box_.length = std::max(bounding_box_.length, 2.5);
314+
bounding_box_.width = std::max(bounding_box_.width, 1.0);
315+
bounding_box_.height = std::max(bounding_box_.height, 1.0);
308316

309317
// update motion model
310318
motion_model_.updateExtendedState(bounding_box_.length);

perception/multi_object_tracker/src/tracker/model/normal_vehicle_tracker.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ NormalVehicleTracker::NormalVehicleTracker(
8282
bbox_object.shape.dimensions.z};
8383
last_input_bounding_box_ = bounding_box_;
8484
}
85+
// set minimum size
86+
bounding_box_.length = std::max(bounding_box_.length, 1.5);
87+
bounding_box_.width = std::max(bounding_box_.width, 0.5);
88+
bounding_box_.height = std::max(bounding_box_.height, 1.0);
8589

8690
// Set motion model parameters
8791
{
@@ -305,6 +309,10 @@ bool NormalVehicleTracker::measureWithShape(
305309
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;
306310
last_input_bounding_box_ = {
307311
object.shape.dimensions.x, object.shape.dimensions.y, object.shape.dimensions.z};
312+
// set minimum size
313+
bounding_box_.length = std::max(bounding_box_.length, 1.5);
314+
bounding_box_.width = std::max(bounding_box_.width, 0.5);
315+
bounding_box_.height = std::max(bounding_box_.height, 1.0);
308316

309317
// update motion model
310318
motion_model_.updateExtendedState(bounding_box_.length);

perception/multi_object_tracker/src/tracker/model/pedestrian_tracker.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ PedestrianTracker::PedestrianTracker(
7070
} else if (object.shape.type == autoware_auto_perception_msgs::msg::Shape::CYLINDER) {
7171
cylinder_ = {object.shape.dimensions.x, object.shape.dimensions.z};
7272
}
73+
// set minimum size
74+
bounding_box_.length = std::max(bounding_box_.length, 0.3);
75+
bounding_box_.width = std::max(bounding_box_.width, 0.3);
76+
bounding_box_.height = std::max(bounding_box_.height, 0.8);
77+
cylinder_.width = std::max(cylinder_.width, 0.3);
78+
cylinder_.height = std::max(cylinder_.height, 0.8);
7379

7480
// Set motion model parameters
7581
{

0 commit comments

Comments
 (0)