Skip to content

Commit

Permalink
fix(autoware_tracking_object_merger): fix unusedFunction (autowarefou…
Browse files Browse the repository at this point in the history
…ndation#8578)

fix:unusedFunction

Signed-off-by: kobayu858 <[email protected]>
  • Loading branch information
kobayu858 authored and a-maumau committed Sep 2, 2024
1 parent 00929e4 commit 0fc35fc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ autoware_perception_msgs::msg::TrackedObjectKinematics objectKinematicsVXMerger(
TrackedObject objectClassificationMerger(
const TrackedObject & main_obj, const TrackedObject & sub_obj, const MergePolicy policy);

// probability merger
float probabilityMerger(const float main_prob, const float sub_prob, const MergePolicy policy);

// shape merger
autoware_perception_msgs::msg::Shape shapeMerger(
const TrackedObject & main_obj, const TrackedObject & sub_obj, const MergePolicy policy);

// update tracked object
void updateExceptVelocity(TrackedObject & main_obj, const TrackedObject & sub_obj);

Expand Down
85 changes: 0 additions & 85 deletions perception/autoware_tracking_object_merger/src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,31 +290,6 @@ bool objectsHaveSameMotionDirections(const TrackedObject & main_obj, const Track
}
}

/**
* @brief compare two tracked objects yaw is reverted or not
*
* @param main_obj
* @param sub_obj
* @return true
* @return false
*/
bool objectsYawIsReverted(const TrackedObject & main_obj, const TrackedObject & sub_obj)
{
// get yaw
const auto main_yaw = tf2::getYaw(main_obj.kinematics.pose_with_covariance.pose.orientation);
const auto sub_yaw = tf2::getYaw(sub_obj.kinematics.pose_with_covariance.pose.orientation);
// calc yaw diff
const auto yaw_diff = std::fabs(main_yaw - sub_yaw);
const auto normalized_yaw_diff = autoware::universe_utils::normalizeRadian(yaw_diff); // -pi ~ pi
// evaluate if yaw is reverted
constexpr double yaw_threshold = M_PI / 2.0; // 90 deg
if (std::abs(normalized_yaw_diff) >= yaw_threshold) {
return true;
} else {
return false;
}
}

// object kinematics merger
// currently only support velocity fusion
autoware_perception_msgs::msg::TrackedObjectKinematics objectKinematicsVXMerger(
Expand Down Expand Up @@ -409,66 +384,6 @@ TrackedObject objectClassificationMerger(
}
}

// probability merger
float probabilityMerger(const float main_prob, const float sub_prob, const MergePolicy policy)
{
if (policy == MergePolicy::SKIP) {
return main_prob;
} else if (policy == MergePolicy::OVERWRITE) {
return sub_prob;
} else if (policy == MergePolicy::FUSION) {
return static_cast<float>(mean(main_prob, sub_prob));
} else {
std::cerr << "unknown merge policy in probabilityMerger function." << std::endl;
return main_prob;
}
}

// shape merger
autoware_perception_msgs::msg::Shape shapeMerger(
const autoware_perception_msgs::msg::Shape & main_obj_shape,
const autoware_perception_msgs::msg::Shape & sub_obj_shape, const MergePolicy policy)
{
autoware_perception_msgs::msg::Shape output_shape;
// copy main object at first
output_shape = main_obj_shape;

if (main_obj_shape.type != sub_obj_shape.type) {
// if shape type is different, return main object
return output_shape;
}

if (policy == MergePolicy::SKIP) {
return output_shape;
} else if (policy == MergePolicy::OVERWRITE) {
return sub_obj_shape;
} else if (policy == MergePolicy::FUSION) {
// write down fusion method for each shape type
if (main_obj_shape.type == autoware_perception_msgs::msg::Shape::BOUNDING_BOX) {
// if shape type is bounding box, merge bounding box
output_shape.dimensions.x = mean(main_obj_shape.dimensions.x, sub_obj_shape.dimensions.x);
output_shape.dimensions.y = mean(main_obj_shape.dimensions.y, sub_obj_shape.dimensions.y);
output_shape.dimensions.z = mean(main_obj_shape.dimensions.z, sub_obj_shape.dimensions.z);
return output_shape;
} else if (main_obj_shape.type == autoware_perception_msgs::msg::Shape::CYLINDER) {
// if shape type is cylinder, merge cylinder
// (TODO) implement
return output_shape;
} else if (main_obj_shape.type == autoware_perception_msgs::msg::Shape::POLYGON) {
// if shape type is polygon, merge polygon
// (TODO)
return output_shape;
} else {
// when type is unknown, print warning and do nothing
std::cerr << "unknown shape type in shapeMerger function." << std::endl;
return output_shape;
}
} else {
std::cerr << "unknown merge policy in shapeMerger function." << std::endl;
return output_shape;
}
}

void updateExceptVelocity(TrackedObject & main_obj, const TrackedObject & sub_obj)
{
// do not update if motion direction is different
Expand Down

0 comments on commit 0fc35fc

Please sign in to comment.