How to get laser points in a specific time of a bag
I have some code that get the messages and break after there is something inside, but laser ranges data change every time I execute my code. This happens probably cause I get the msg in different periodo of time. I want set a specific time to get it, I mean get the ranges always at the same time.
This how I'm doing now.
while(ros::ok()) {
for (i = 0; i < 540; i++) {
if (!clustersScan.laserMsg.ranges.empty()) {
RANGES[i] = clustersScan.laserMsg.ranges[i];
}
}
if(!clustersScan.laserMsg.ranges.empty()) break;
ros::spinOnce();
}