@@ -44,7 +44,7 @@ using Label = autoware_perception_msgs::msg::ObjectClassification;
44
44
45
45
NormalVehicleTracker::NormalVehicleTracker (
46
46
const rclcpp::Time & time, const autoware_perception_msgs::msg::DetectedObject & object,
47
- const geometry_msgs::msg::Transform & self_transform, const size_t channel_size,
47
+ const geometry_msgs::msg::Transform & /* self_transform*/ , const size_t channel_size,
48
48
const uint & channel_index)
49
49
: Tracker(time, object.classification, channel_size),
50
50
logger_(rclcpp::get_logger(" NormalVehicleTracker" )),
@@ -76,7 +76,6 @@ NormalVehicleTracker::NormalVehicleTracker(
76
76
if (object.shape .type == autoware_perception_msgs::msg::Shape::BOUNDING_BOX) {
77
77
bounding_box_ = {
78
78
object.shape .dimensions .x , object.shape .dimensions .y , object.shape .dimensions .z };
79
- last_input_bounding_box_ = bounding_box_;
80
79
} else {
81
80
autoware_perception_msgs::msg::DetectedObject bbox_object;
82
81
if (!utils::convertConvexHullToBoundingBox (object, bbox_object)) {
@@ -90,7 +89,6 @@ NormalVehicleTracker::NormalVehicleTracker(
90
89
bbox_object.shape .dimensions .x , bbox_object.shape .dimensions .y ,
91
90
bbox_object.shape .dimensions .z };
92
91
}
93
- last_input_bounding_box_ = bounding_box_;
94
92
}
95
93
// set maximum and minimum size
96
94
constexpr double max_size = 20.0 ;
@@ -179,9 +177,6 @@ NormalVehicleTracker::NormalVehicleTracker(
179
177
// initialize motion model
180
178
motion_model_.initialize (time , x, y, yaw, pose_cov, vel, vel_cov, slip, slip_cov, length);
181
179
}
182
-
183
- /* calc nearest corner index*/
184
- setNearestCornerOrSurfaceIndex (self_transform); // this index is used in next measure step
185
180
}
186
181
187
182
bool NormalVehicleTracker::predict (const rclcpp::Time & time)
@@ -216,11 +211,11 @@ autoware_perception_msgs::msg::DetectedObject NormalVehicleTracker::getUpdatingO
216
211
}
217
212
218
213
// get offset measurement
219
- int nearest_corner_index = utils::getNearestCornerOrSurface (
214
+ const int nearest_corner_index = utils::getNearestCornerOrSurface (
220
215
tracked_x, tracked_y, tracked_yaw, bounding_box_.width , bounding_box_.length , self_transform);
221
216
utils::calcAnchorPointOffset (
222
- last_input_bounding_box_ .width , last_input_bounding_box_ .length , nearest_corner_index,
223
- bbox_object, tracked_yaw, updating_object, tracking_offset_);
217
+ bounding_box_ .width , bounding_box_ .length , nearest_corner_index, bbox_object, tracked_yaw ,
218
+ updating_object, tracking_offset_);
224
219
225
220
// UNCERTAINTY MODEL
226
221
if (!object.kinematics .has_position_covariance ) {
@@ -334,15 +329,13 @@ bool NormalVehicleTracker::measureWithShape(
334
329
return false ;
335
330
}
336
331
337
- constexpr double gain = 0.1 ;
332
+ constexpr double gain = 0.5 ;
338
333
constexpr double gain_inv = 1.0 - gain;
339
334
340
335
// update object size
341
336
bounding_box_.length = gain_inv * bounding_box_.length + gain * object.shape .dimensions .x ;
342
337
bounding_box_.width = gain_inv * bounding_box_.width + gain * object.shape .dimensions .y ;
343
338
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape .dimensions .z ;
344
- last_input_bounding_box_ = {
345
- object.shape .dimensions .x , object.shape .dimensions .y , object.shape .dimensions .z };
346
339
347
340
// set maximum and minimum size
348
341
constexpr double max_size = 20.0 ;
@@ -354,11 +347,19 @@ bool NormalVehicleTracker::measureWithShape(
354
347
// update motion model
355
348
motion_model_.updateExtendedState (bounding_box_.length );
356
349
357
- // // update offset into object position
358
- // motion_model_.adjustPosition(gain * tracking_offset_.x(), gain * tracking_offset_.y());
359
- // // update offset
360
- // tracking_offset_.x() = gain_inv * tracking_offset_.x();
361
- // tracking_offset_.y() = gain_inv * tracking_offset_.y();
350
+ // update offset into object position
351
+ {
352
+ // rotate back the offset vector from object coordinate to global coordinate
353
+ const double yaw = motion_model_.getStateElement (IDX::YAW);
354
+ const double offset_x_global =
355
+ tracking_offset_.x () * std::cos (yaw) - tracking_offset_.y () * std::sin (yaw);
356
+ const double offset_y_global =
357
+ tracking_offset_.x () * std::sin (yaw) + tracking_offset_.y () * std::cos (yaw);
358
+ motion_model_.adjustPosition (-gain * offset_x_global, -gain * offset_y_global);
359
+ // update offset (object coordinate)
360
+ tracking_offset_.x () = gain_inv * tracking_offset_.x ();
361
+ tracking_offset_.y () = gain_inv * tracking_offset_.y ();
362
+ }
362
363
363
364
return true ;
364
365
}
@@ -392,9 +393,6 @@ bool NormalVehicleTracker::measure(
392
393
measureWithPose (updating_object);
393
394
measureWithShape (updating_object);
394
395
395
- /* calc nearest corner index*/
396
- setNearestCornerOrSurfaceIndex (self_transform); // this index is used in next measure step
397
-
398
396
return true ;
399
397
}
400
398
@@ -416,15 +414,6 @@ bool NormalVehicleTracker::getTrackedObject(
416
414
return false ;
417
415
}
418
416
419
- // recover bounding box from tracking point
420
- const double dl = bounding_box_.length - last_input_bounding_box_.length ;
421
- const double dw = bounding_box_.width - last_input_bounding_box_.width ;
422
- const Eigen::Vector2d recovered_pose = utils::recoverFromTrackingPoint (
423
- pose_with_cov.pose .position .x , pose_with_cov.pose .position .y ,
424
- motion_model_.getStateElement (IDX::YAW), dw, dl, last_nearest_corner_index_, tracking_offset_);
425
- pose_with_cov.pose .position .x = recovered_pose.x ();
426
- pose_with_cov.pose .position .y = recovered_pose.y ();
427
-
428
417
// position
429
418
pose_with_cov.pose .position .z = z_;
430
419
0 commit comments