Loop through unbounded tracks array in radar_msgs/RadarTrackArray
Hi,
I am having this programming problem:
void msgCallback(const radar_msgs::RadarTrackArray::ConstPtr& msg)
{
for (int i=0; i < msg->tracks.size(); i++)
{
a.push_back(msg->tracks[i].track_id);
}
}
int main(int argc, char** argv)
{
...
ros::Subscriber radar_sub = nh.subscribe("/radarTrack",1000,msgCallback);
ros::spin();
return 0;
}
the topic "/radarTrack" publishes messages every 20ms and the tracks array is an unbounded array, that is, it gives different length of array at each frame. For example, msg->tracks.size() can be 420, 28, 128 and so on.. When the length of tracks array is large, the calculation time of for-loop could be larger than 20ms. In this case, Does the messages that are published by "/radarTrack" wait until the for-loop calculation is complete although its calculation time is larger than 20ms?
Any help will be much appreciated.