Subscriber callback function
I have made a subscriber to pioneer/laser/scan for the scan values of laser on P3AT.
When I run the subscriber, it just doesn't stop. It keeps on running. I want only a single value of the scan i.e. the ranges[] array.
And also the value of any index in ranges[] array fluctuates ranges[i] - .2 to ranges[i] + .2
How to get only a single array ranges[] when subscribing to the scan?
P.S. I am using these lines of code and obstaclesCallBack is my function for printing the scan values.
ros::NodeHandle laser_n;
ros::Subscriber sub = laser_n.subscribe<sensor_msgs::LaserScan>("pioneer/laser/scan", 1000, obstaclesCallback);