@@ -42,11 +42,13 @@ ShapeEstimationNode::ShapeEstimationNode(const rclcpp::NodeOptions & node_option
42
42
" input" , rclcpp::QoS{1 }, std::bind (&ShapeEstimationNode::callback, this , _1));
43
43
44
44
pub_ = create_publisher<DetectedObjectsWithFeature>(" objects" , rclcpp::QoS{1 });
45
- bool use_corrector = declare_parameter (" use_corrector" , true );
46
- bool use_filter = declare_parameter (" use_filter" , true );
47
- use_vehicle_reference_yaw_ = declare_parameter (" use_vehicle_reference_yaw" , true );
48
- use_vehicle_reference_shape_size_ = declare_parameter (" use_vehicle_reference_shape_size" , true );
49
- bool use_boost_bbox_optimizer = declare_parameter (" use_boost_bbox_optimizer" , false );
45
+ bool use_corrector = declare_parameter<bool >(" use_corrector" );
46
+ bool use_filter = declare_parameter<bool >(" use_filter" );
47
+ use_vehicle_reference_yaw_ = declare_parameter<bool >(" use_vehicle_reference_yaw" );
48
+ use_vehicle_reference_shape_size_ = declare_parameter<bool >(" use_vehicle_reference_shape_size" );
49
+ bool use_boost_bbox_optimizer = declare_parameter<bool >(" use_boost_bbox_optimizer" );
50
+ fix_filtered_objects_label_to_unknown_ =
51
+ declare_parameter<bool >(" fix_filtered_objects_label_to_unknown" );
50
52
RCLCPP_INFO (this ->get_logger (), " using boost shape estimation : %d" , use_boost_bbox_optimizer);
51
53
estimator_ =
52
54
std::make_unique<ShapeEstimator>(use_corrector, use_filter, use_boost_bbox_optimizer);
@@ -96,12 +98,15 @@ void ShapeEstimationNode::callback(const DetectedObjectsWithFeature::ConstShared
96
98
const bool estimated_success = estimator_->estimateShapeAndPose (
97
99
label, *cluster, ref_yaw_info, ref_shape_size_info, shape, pose);
98
100
99
- // If the shape estimation fails, ignore it .
100
- if (!estimated_success) {
101
+ // If the shape estimation fails, change to Unknown object .
102
+ if (!fix_filtered_objects_label_to_unknown_ && ! estimated_success) {
101
103
continue ;
102
104
}
103
-
104
105
output_msg.feature_objects .push_back (feature_object);
106
+ if (!estimated_success) {
107
+ output_msg.feature_objects .back ().object .classification .front ().label = Label::UNKNOWN;
108
+ }
109
+
105
110
output_msg.feature_objects .back ().object .shape = shape;
106
111
output_msg.feature_objects .back ().object .kinematics .pose_with_covariance .pose = pose;
107
112
}
0 commit comments