Skip to content

Commit 0f7f20e

Browse files
committed
fix(multi_object_tracker): bicycle motion model - set minimum wheel-to-center length (autowarefoundation#6337)
* fix: bicycle motion model - set minimum wheel-to-center length for stability Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp> * chore: align comments Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp> --------- Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent d270383 commit 0f7f20e

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ BicycleTracker::BicycleTracker(
143143
ekf_.init(X, P);
144144

145145
// Set lf, lr
146-
lf_ = bounding_box_.length * 0.3; // 30% front from the center
147-
lr_ = bounding_box_.length * 0.3; // 30% rear from the center
146+
lf_ = std::max(bounding_box_.length * 0.3, 0.3); // 30% front from the center, minimum of 0.3m
147+
lr_ = std::max(bounding_box_.length * 0.3, 0.3); // 30% rear from the center, minimum of 0.3m
148148
}
149149

150150
bool BicycleTracker::predict(const rclcpp::Time & time)
@@ -425,8 +425,8 @@ bool BicycleTracker::measureWithShape(
425425
bbox_object.shape.dimensions.x, bbox_object.shape.dimensions.y, bbox_object.shape.dimensions.z};
426426

427427
// update lf, lr
428-
lf_ = bounding_box_.length * 0.3; // 30% front from the center
429-
lr_ = bounding_box_.length * 0.3; // 30% rear from the center
428+
lf_ = std::max(bounding_box_.length * 0.3, 0.3); // 30% front from the center, minimum of 0.3m
429+
lr_ = std::max(bounding_box_.length * 0.3, 0.3); // 30% rear from the center, minimum of 0.3m
430430

431431
return true;
432432
}

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ BigVehicleTracker::BigVehicleTracker(
158158
setNearestCornerOrSurfaceIndex(self_transform); // this index is used in next measure step
159159

160160
// Set lf, lr
161-
lf_ = bounding_box_.length * 0.3; // 30% front from the center
162-
lr_ = bounding_box_.length * 0.25; // 25% rear from the center
161+
lf_ = std::max(bounding_box_.length * 0.3, 1.5); // 30% front from the center, minimum of 1.5m
162+
lr_ = std::max(bounding_box_.length * 0.25, 1.5); // 25% rear from the center, minimum of 1.5m
163163
}
164164

165165
bool BigVehicleTracker::predict(const rclcpp::Time & time)
@@ -457,9 +457,8 @@ bool BigVehicleTracker::measureWithShape(
457457
bbox_object.shape.dimensions.x, bbox_object.shape.dimensions.y, bbox_object.shape.dimensions.z};
458458

459459
// update lf, lr
460-
lf_ = bounding_box_.length * 0.3; // 30% front from the center
461-
lr_ = bounding_box_.length * 0.25; // 25% rear from the center
462-
460+
lf_ = std::max(bounding_box_.length * 0.3, 1.5); // 30% front from the center, minimum of 1.5m
461+
lr_ = std::max(bounding_box_.length * 0.25, 1.5); // 25% rear from the center, minimum of 1.5m
463462
return true;
464463
}
465464

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ NormalVehicleTracker::NormalVehicleTracker(
158158
setNearestCornerOrSurfaceIndex(self_transform); // this index is used in next measure step
159159

160160
// Set lf, lr
161-
lf_ = bounding_box_.length * 0.3; // 30% front from the center
162-
lr_ = bounding_box_.length * 0.25; // 25% rear from the center
161+
lf_ = std::max(bounding_box_.length * 0.3, 1.0); // 30% front from the center, minimum of 1.0m
162+
lr_ = std::max(bounding_box_.length * 0.25, 1.0); // 25% rear from the center, minimum of 1.0m
163163
}
164164

165165
bool NormalVehicleTracker::predict(const rclcpp::Time & time)
@@ -457,8 +457,8 @@ bool NormalVehicleTracker::measureWithShape(
457457
bbox_object.shape.dimensions.x, bbox_object.shape.dimensions.y, bbox_object.shape.dimensions.z};
458458

459459
// update lf, lr
460-
lf_ = bounding_box_.length * 0.3; // 30% front from the center
461-
lr_ = bounding_box_.length * 0.25; // 25% rear from the center
460+
lf_ = std::max(bounding_box_.length * 0.3, 1.0); // 30% front from the center, minimum of 1.0m
461+
lr_ = std::max(bounding_box_.length * 0.25, 1.0); // 25% rear from the center, minimum of 1.0m
462462

463463
return true;
464464
}

0 commit comments

Comments
 (0)