19
19
namespace multi_object_tracker
20
20
{
21
21
22
- InputStream::InputStream (rclcpp::Node & node, size_t & index) : node_(node), index_(index)
22
+ InputStream::InputStream (rclcpp::Node & node, uint & index) : node_(node), index_(index)
23
23
{
24
24
}
25
25
@@ -104,7 +104,7 @@ void InputStream::onMessage(
104
104
105
105
void InputStream::getObjectsOlderThan (
106
106
const rclcpp::Time & object_latest_time, const rclcpp::Time & object_oldest_time,
107
- std::vector<std::pair< size_t , DetectedObjects>> & objects_list)
107
+ ObjectsList & objects_list)
108
108
{
109
109
assert (object_latest_time.nanoseconds () > object_oldest_time.nanoseconds ());
110
110
@@ -119,7 +119,7 @@ void InputStream::getObjectsOlderThan(
119
119
120
120
// Add the object if the object is older than the specified latest time
121
121
if (object_latest_time >= object_time) {
122
- std::pair<size_t , DetectedObjects> object_pair (index_, object);
122
+ std::pair<uint , DetectedObjects> object_pair (index_, object);
123
123
objects_list.push_back (object_pair);
124
124
// remove the object from the queue
125
125
objects_que_.pop_front ();
@@ -147,7 +147,8 @@ void InputManager::init(const std::vector<InputChannel> & input_channels)
147
147
sub_objects_array_.resize (input_size_);
148
148
149
149
for (size_t i = 0 ; i < input_size_; i++) {
150
- InputStream input_stream (node_, i);
150
+ uint index (i);
151
+ InputStream input_stream (node_, index );
151
152
input_stream.init (input_channels[i]);
152
153
input_stream.setTriggerFunction (
153
154
std::bind (&InputManager::onTrigger, this , std::placeholders::_1));
@@ -166,10 +167,10 @@ void InputManager::init(const std::vector<InputChannel> & input_channels)
166
167
is_initialized_ = true ;
167
168
}
168
169
169
- void InputManager::onTrigger (const size_t & index) const
170
+ void InputManager::onTrigger (const uint & index) const
170
171
{
171
172
// input stream index of 0 is the target(main) input stream
172
- const size_t target_idx = 0 ;
173
+ const uint target_idx = 0 ;
173
174
174
175
// when the main stream triggers, call the trigger function
175
176
if (index == target_idx && func_trigger_) {
@@ -203,11 +204,11 @@ void InputManager::getObjectTimeInterval(
203
204
}
204
205
205
206
// Get proper latency
206
- constexpr double target_latency = 0.15 ; // [s], measurement to tracking latency
207
+ constexpr double target_latency = 0.18 ; // [s], measurement to tracking latency
207
208
// process latency of a main detection + margin
208
-
209
209
constexpr double acceptable_latency =
210
- 0.35 ; // [s], acceptable band from the target latency, larger than the target latency
210
+ 0.32 ; // [s], acceptable band from the target latency, larger than the target latency
211
+
211
212
object_latest_time = now - rclcpp::Duration::from_seconds (target_latency);
212
213
object_oldest_time = now - rclcpp::Duration::from_seconds (acceptable_latency);
213
214
@@ -217,8 +218,7 @@ void InputManager::getObjectTimeInterval(
217
218
object_oldest_time > latest_object_time_ ? object_oldest_time : latest_object_time_;
218
219
}
219
220
220
- bool InputManager::getObjects (
221
- const rclcpp::Time & now, std::vector<std::pair<size_t , DetectedObjects>> & objects_list)
221
+ bool InputManager::getObjects (const rclcpp::Time & now, ObjectsList & objects_list)
222
222
{
223
223
if (!is_initialized_) {
224
224
RCLCPP_INFO (node_.get_logger (), " InputManager::getObjects Input manager is not initialized" );
@@ -241,7 +241,7 @@ bool InputManager::getObjects(
241
241
// Sort objects by timestamp
242
242
std::sort (
243
243
objects_list.begin (), objects_list.end (),
244
- [](const std::pair<size_t , DetectedObjects> & a, const std::pair<size_t , DetectedObjects> & b) {
244
+ [](const std::pair<uint , DetectedObjects> & a, const std::pair<uint , DetectedObjects> & b) {
245
245
return (rclcpp::Time (a.second .header .stamp ) - rclcpp::Time (b.second .header .stamp )).seconds () <
246
246
0 ;
247
247
});
0 commit comments