@@ -56,24 +56,26 @@ autoware_perception_msgs::msg::Shape extendShape(
56
56
return output;
57
57
}
58
58
59
- boost::optional<ReferenceYawInfo> getReferenceYawInfo (const uint8_t label, const float yaw)
59
+ boost::optional<autoware::shape_estimation::ReferenceYawInfo> getReferenceYawInfo (
60
+ const uint8_t label, const float yaw)
60
61
{
61
62
const bool is_vehicle =
62
63
Label::CAR == label || Label::TRUCK == label || Label::BUS == label || Label::TRAILER == label;
63
64
if (is_vehicle) {
64
- return ReferenceYawInfo{yaw, autoware::universe_utils::deg2rad (30 )};
65
+ return autoware::shape_estimation:: ReferenceYawInfo{yaw, autoware::universe_utils::deg2rad (30 )};
65
66
} else {
66
67
return boost::none;
67
68
}
68
69
}
69
70
70
- boost::optional<ReferenceShapeSizeInfo> getReferenceShapeSizeInfo (
71
+ boost::optional<autoware::shape_estimation:: ReferenceShapeSizeInfo> getReferenceShapeSizeInfo (
71
72
const uint8_t label, const autoware_perception_msgs::msg::Shape & shape)
72
73
{
73
74
const bool is_vehicle =
74
75
Label::CAR == label || Label::TRUCK == label || Label::BUS == label || Label::TRAILER == label;
75
76
if (is_vehicle) {
76
- return ReferenceShapeSizeInfo{shape, ReferenceShapeSizeInfo::Mode::Min};
77
+ return autoware::shape_estimation::ReferenceShapeSizeInfo{
78
+ shape, autoware::shape_estimation::ReferenceShapeSizeInfo::Mode::Min};
77
79
} else {
78
80
return boost::none;
79
81
}
@@ -83,70 +85,6 @@ boost::optional<ReferenceShapeSizeInfo> getReferenceShapeSizeInfo(
83
85
namespace autoware ::detection_by_tracker
84
86
{
85
87
86
- void TrackerHandler::onTrackedObjects (
87
- const autoware_perception_msgs::msg::TrackedObjects::ConstSharedPtr msg)
88
- {
89
- constexpr size_t max_buffer_size = 10 ;
90
-
91
- // Add tracked objects to buffer
92
- objects_buffer_.push_front (*msg);
93
-
94
- // Remove old data
95
- while (max_buffer_size < objects_buffer_.size ()) {
96
- objects_buffer_.pop_back ();
97
- }
98
- }
99
-
100
- bool TrackerHandler::estimateTrackedObjects (
101
- const rclcpp::Time & time, autoware_perception_msgs::msg::TrackedObjects & output)
102
- {
103
- if (objects_buffer_.empty ()) {
104
- return false ;
105
- }
106
-
107
- // Get the objects closest to the target time.
108
- const auto target_objects_iter = std::min_element (
109
- objects_buffer_.cbegin (), objects_buffer_.cend (),
110
- [&time ](
111
- autoware_perception_msgs::msg::TrackedObjects first,
112
- autoware_perception_msgs::msg::TrackedObjects second) {
113
- return std::fabs ((time - first.header .stamp ).seconds ()) <
114
- std::fabs ((time - second.header .stamp ).seconds ());
115
- });
116
-
117
- // Estimate the pose of the object at the target time
118
- const auto dt = time - target_objects_iter->header .stamp ;
119
- output.header .frame_id = target_objects_iter->header .frame_id ;
120
- output.header .stamp = time ;
121
- for (const auto & object : target_objects_iter->objects ) {
122
- const auto & pose_with_covariance = object.kinematics .pose_with_covariance ;
123
- const auto & x = pose_with_covariance.pose .position .x ;
124
- const auto & y = pose_with_covariance.pose .position .y ;
125
- const auto & z = pose_with_covariance.pose .position .z ;
126
- const float yaw = tf2::getYaw (pose_with_covariance.pose .orientation );
127
- const auto & twist = object.kinematics .twist_with_covariance .twist ;
128
- const float & vx = twist.linear .x ;
129
- const float & wz = twist.angular .z ;
130
-
131
- // build output
132
- autoware_perception_msgs::msg::TrackedObject estimated_object;
133
- estimated_object.object_id = object.object_id ;
134
- estimated_object.existence_probability = object.existence_probability ;
135
- estimated_object.classification = object.classification ;
136
- estimated_object.shape = object.shape ;
137
- estimated_object.kinematics .pose_with_covariance .pose .position .x =
138
- x + vx * std::cos (yaw) * dt.seconds ();
139
- estimated_object.kinematics .pose_with_covariance .pose .position .y =
140
- y + vx * std::sin (yaw) * dt.seconds ();
141
- estimated_object.kinematics .pose_with_covariance .pose .position .z = z;
142
- const float yaw_hat = autoware::universe_utils::normalizeRadian (yaw + wz * dt.seconds ());
143
- estimated_object.kinematics .pose_with_covariance .pose .orientation =
144
- autoware::universe_utils::createQuaternionFromYaw (yaw_hat);
145
- output.objects .push_back (estimated_object);
146
- }
147
- return true ;
148
- }
149
-
150
88
DetectionByTracker::DetectionByTracker (const rclcpp::NodeOptions & node_options)
151
89
: rclcpp::Node(" detection_by_tracker" , node_options),
152
90
tf_buffer_ (this ->get_clock ()),
@@ -176,7 +114,7 @@ DetectionByTracker::DetectionByTracker(const rclcpp::NodeOptions & node_options)
176
114
// set maximum search setting for merger/divider
177
115
setMaxSearchRange ();
178
116
179
- shape_estimator_ = std::make_shared<ShapeEstimator>(true , true );
117
+ shape_estimator_ = std::make_shared<autoware::shape_estimation:: ShapeEstimator>(true , true );
180
118
cluster_ = std::make_shared<euclidean_cluster::VoxelGridBasedEuclideanCluster>(
181
119
false , 10 , 10000 , 0.7 , 0.3 , 0 );
182
120
debugger_ = std::make_shared<Debugger >(this );
@@ -468,7 +406,6 @@ void DetectionByTracker::mergeOverSegmentedObjects(
468
406
out_objects.feature_objects .push_back (feature_object);
469
407
}
470
408
}
471
-
472
409
} // namespace autoware::detection_by_tracker
473
410
474
411
#include < rclcpp_components/register_node_macro.hpp>
0 commit comments