Skip to content

Commit

Permalink
chore: fix missing refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
technolojin committed Jun 13, 2024
1 parent f8399e8 commit 359bf74
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,12 @@ bool BicycleTracker::measureWithShape(const autoware_perception_msgs::msg::Detec
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;

// set maximum and minimum size
constexpr double max_size = 5.0;
constexpr double min_size = 0.3;
bounding_box_.length = std::min(std::max(bounding_box_.length, min_size), max_size);
bounding_box_.width = std::min(std::max(bounding_box_.width, min_size), max_size);
bounding_box_.height = std::min(std::max(bounding_box_.height, min_size), max_size);
bounding_box_.length = std::clamp(
bounding_box_.length, object_model_.size_limit.length_min, object_model_.size_limit.length_max);
bounding_box_.width = std::clamp(
bounding_box_.width, object_model_.size_limit.width_min, object_model_.size_limit.width_max);
bounding_box_.height = std::clamp(
bounding_box_.height, object_model_.size_limit.height_min, object_model_.size_limit.height_max);

// update motion model
motion_model_.updateExtendedState(bounding_box_.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,9 @@ bool BigVehicleTracker::measureWithShape(
return false;
}

// update object size
constexpr double gain = 0.5;
constexpr double gain_inv = 1.0 - gain;

// update object size
bounding_box_.length = gain_inv * bounding_box_.length + gain * object.shape.dimensions.x;
bounding_box_.width = gain_inv * bounding_box_.width + gain * object.shape.dimensions.y;
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,9 @@ bool NormalVehicleTracker::measureWithShape(
return false;
}

// update object size
constexpr double gain = 0.5;
constexpr double gain_inv = 1.0 - gain;

// update object size
bounding_box_.length = gain_inv * bounding_box_.length + gain * object.shape.dimensions.x;
bounding_box_.width = gain_inv * bounding_box_.width + gain * object.shape.dimensions.y;
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,25 @@ bool PedestrianTracker::measureWithShape(
if (!is_size_valid) {
return false;
}

// update bounding box size
bounding_box_.length = gain_inv * bounding_box_.length + gain * object.shape.dimensions.x;
bounding_box_.width = gain_inv * bounding_box_.width + gain * object.shape.dimensions.y;
bounding_box_.height = gain_inv * bounding_box_.height + gain * object.shape.dimensions.z;

} else if (object.shape.type == autoware_perception_msgs::msg::Shape::CYLINDER) {
// check cylinder size abnormality
constexpr double size_max = 30.0; // [m]
constexpr double size_min = 0.1; // [m]
if (object.shape.dimensions.x > size_max || object.shape.dimensions.z > size_max) {
return false;
} else if (object.shape.dimensions.x < size_min || object.shape.dimensions.z < size_min) {
bool is_size_valid =
(object.shape.dimensions.x <= size_max && object.shape.dimensions.z <= size_max &&
object.shape.dimensions.x >= size_min && object.shape.dimensions.z >= size_min);
if (!is_size_valid) {
return false;
}
// update cylinder size
cylinder_.width = gain_inv * cylinder_.width + gain * object.shape.dimensions.x;
cylinder_.height = gain_inv * cylinder_.height + gain * object.shape.dimensions.z;

} else {
// do not update polygon shape
return false;
Expand Down

0 comments on commit 359bf74

Please sign in to comment.