Skip to content

Commit

Permalink
fix(shape_estimation): preserve irregular large size vehicle detected…
Browse files Browse the repository at this point in the history
… by camera_lidar_fusion as unknown (autowarefoundation#6598)

* fix(shape_estimation): keep excluded objects as unknown

Signed-off-by: badai-nguyen <[email protected]>

* chore: add optional param

Signed-off-by: badai-nguyen <[email protected]>

* chore: rename param

Signed-off-by: badai-nguyen <[email protected]>

---------

Signed-off-by: badai-nguyen <[email protected]>
Co-authored-by: Yoshi Ri <[email protected]>
Signed-off-by: kaigohirao <[email protected]>
  • Loading branch information
2 people authored and kaigohirao committed Mar 22, 2024
1 parent 4545e1c commit 2641a38
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
use_vehicle_reference_yaw: false
use_vehicle_reference_shape_size: false
use_boost_bbox_optimizer: false
fix_filtered_objects_label_to_unknown: true
14 changes: 10 additions & 4 deletions perception/shape_estimation/lib/shape_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,31 @@ bool ShapeEstimator::estimateShapeAndPose(
autoware_auto_perception_msgs::msg::Shape shape;
geometry_msgs::msg::Pose pose;
// estimate shape
bool reverse_to_unknown = false;
if (!estimateOriginalShapeAndPose(label, cluster, ref_yaw_info, shape, pose)) {
return false;
reverse_to_unknown = true;
}

// rule based filter
if (use_filter_) {
if (!applyFilter(label, shape, pose)) {
return false;
reverse_to_unknown = true;
}
}

// rule based corrector
if (use_corrector_) {
bool use_reference_yaw = ref_yaw_info ? true : false;
if (!applyCorrector(label, use_reference_yaw, ref_shape_size_info, shape, pose)) {
return false;
reverse_to_unknown = true;
}
}

if (reverse_to_unknown) {
estimateOriginalShapeAndPose(Label::UNKNOWN, cluster, ref_yaw_info, shape, pose);
shape_output = shape;
pose_output = pose;
return false;
}
shape_output = shape;
pose_output = pose;
return true;
Expand Down
11 changes: 8 additions & 3 deletions perception/shape_estimation/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ ShapeEstimationNode::ShapeEstimationNode(const rclcpp::NodeOptions & node_option
use_vehicle_reference_yaw_ = declare_parameter<bool>("use_vehicle_reference_yaw");
use_vehicle_reference_shape_size_ = declare_parameter<bool>("use_vehicle_reference_shape_size");
bool use_boost_bbox_optimizer = declare_parameter<bool>("use_boost_bbox_optimizer");
fix_filtered_objects_label_to_unknown_ =
declare_parameter<bool>("fix_filtered_objects_label_to_unknown");
RCLCPP_INFO(this->get_logger(), "using boost shape estimation : %d", use_boost_bbox_optimizer);
estimator_ =
std::make_unique<ShapeEstimator>(use_corrector, use_filter, use_boost_bbox_optimizer);
Expand Down Expand Up @@ -103,12 +105,15 @@ void ShapeEstimationNode::callback(const DetectedObjectsWithFeature::ConstShared
const bool estimated_success = estimator_->estimateShapeAndPose(
label, *cluster, ref_yaw_info, ref_shape_size_info, shape, pose);

// If the shape estimation fails, ignore it.
if (!estimated_success) {
// If the shape estimation fails, change to Unknown object.
if (!fix_filtered_objects_label_to_unknown_ && !estimated_success) {
continue;
}

output_msg.feature_objects.push_back(feature_object);
if (!estimated_success) {
output_msg.feature_objects.back().object.classification.front().label = Label::UNKNOWN;
}

output_msg.feature_objects.back().object.shape = shape;
output_msg.feature_objects.back().object.kinematics.pose_with_covariance.pose = pose;
}
Expand Down
1 change: 1 addition & 0 deletions perception/shape_estimation/src/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ShapeEstimationNode : public rclcpp::Node
std::unique_ptr<ShapeEstimator> estimator_;
bool use_vehicle_reference_yaw_;
bool use_vehicle_reference_shape_size_;
bool fix_filtered_objects_label_to_unknown_;

public:
explicit ShapeEstimationNode(const rclcpp::NodeOptions & node_options);
Expand Down

0 comments on commit 2641a38

Please sign in to comment.