@@ -43,6 +43,11 @@ namespace autoware::multi_object_tracker
43
43
BicycleTracker::BicycleTracker (const rclcpp::Time & time, const types::DynamicObject & object)
44
44
: Tracker(time, object), logger_(rclcpp::get_logger(" BicycleTracker" ))
45
45
{
46
+ // velocity deviation threshold
47
+ // if the predicted velocity is close to the observed velocity,
48
+ // the observed velocity is used as the measurement.
49
+ velocity_deviation_threshold_ = autoware_utils::kmph2mps (10 ); // [m/s]
50
+
46
51
if (object.shape .type != autoware_perception_msgs::msg::Shape::BOUNDING_BOX) {
47
52
// set default initial size
48
53
auto & object_extension = object_.shape .dimensions ;
@@ -131,21 +136,44 @@ bool BicycleTracker::predict(const rclcpp::Time & time)
131
136
bool BicycleTracker::measureWithPose (const types::DynamicObject & object)
132
137
{
133
138
// get measurement yaw angle to update
134
- const double tracked_yaw = motion_model_.getStateElement (IDX::YAW);
135
- double measurement_yaw = 0.0 ;
136
- bool is_yaw_available = shapes::getMeasurementYaw (object, tracked_yaw, measurement_yaw);
139
+ bool is_yaw_available =
140
+ object.kinematics .orientation_availability != types::OrientationAvailability::UNAVAILABLE;
141
+
142
+ // velocity capability is checked only when the object has velocity measurement
143
+ // and the predicted velocity is close to the observed velocity
144
+ bool is_velocity_available = false ;
145
+ if (object.kinematics .has_twist ) {
146
+ const double tracked_vel = motion_model_.getStateElement (IDX::VEL);
147
+ const double & observed_vel = object.twist .linear .x ;
148
+ if (std::fabs (tracked_vel - observed_vel) < velocity_deviation_threshold_) {
149
+ // Velocity deviation is small
150
+ is_velocity_available = true ;
151
+ }
152
+ }
137
153
138
154
// update
139
155
bool is_updated = false ;
140
156
{
141
157
const double x = object.pose .position .x ;
142
158
const double y = object.pose .position .y ;
143
- const double yaw = measurement_yaw;
144
-
145
- if (is_yaw_available) {
159
+ const double yaw = tf2::getYaw (object.pose .orientation );
160
+ const double vel = object.twist .linear .x ;
161
+
162
+ if (is_yaw_available && is_velocity_available) {
163
+ // update with yaw angle and velocity
164
+ is_updated = motion_model_.updateStatePoseHeadVel (
165
+ x, y, yaw, object.pose_covariance , vel, object.twist_covariance );
166
+ } else if (is_yaw_available && !is_velocity_available) {
167
+ // update with yaw angle, but without velocity
146
168
is_updated = motion_model_.updateStatePoseHead (x, y, yaw, object.pose_covariance );
169
+ } else if (!is_yaw_available && is_velocity_available) {
170
+ // update without yaw angle, but with velocity
171
+ is_updated = motion_model_.updateStatePoseVel (
172
+ x, y, object.pose_covariance , vel, object.twist_covariance );
147
173
} else {
148
- is_updated = motion_model_.updateStatePose (x, y, object.pose_covariance );
174
+ // update without yaw angle and velocity
175
+ is_updated = motion_model_.updateStatePose (
176
+ x, y, object.pose_covariance ); // update without yaw angle and velocity
149
177
}
150
178
motion_model_.limitStates ();
151
179
}
@@ -164,13 +192,14 @@ bool BicycleTracker::measureWithShape(const types::DynamicObject & object)
164
192
return false ;
165
193
}
166
194
167
- // check bound box size abnormality
168
- constexpr double size_max = 30.0 ; // [m]
169
- constexpr double size_min = 0.1 ; // [m]
195
+ // check object size abnormality
196
+ constexpr double size_max_multiplier = 1.5 ;
197
+ constexpr double size_min_multiplier = 0.25 ;
170
198
if (
171
- object.shape .dimensions .x > size_max || object.shape .dimensions .x < size_min ||
172
- object.shape .dimensions .y > size_max || object.shape .dimensions .y < size_min ||
173
- object.shape .dimensions .z > size_max || object.shape .dimensions .z < size_min) {
199
+ object.shape .dimensions .x > object_model_.size_limit .length_max * size_max_multiplier ||
200
+ object.shape .dimensions .x < object_model_.size_limit .length_min * size_min_multiplier ||
201
+ object.shape .dimensions .y > object_model_.size_limit .width_max * size_max_multiplier ||
202
+ object.shape .dimensions .y < object_model_.size_limit .width_min * size_min_multiplier) {
174
203
return false ;
175
204
}
176
205
0 commit comments