Hi I'd recorded four lidar(Sick LMS511@100hz,0.67deg) with sicktoolbox_wapper2 and rosbag record(lidar1/scan, lidar2/scan, and so on).
Once I tested my code in the lab using rosbag play XXX.bag, I noticed my callback function actually manipulating quadruple data at once!
Callback takes not 10ms for each lidar data but it takes 40ms at first data and about 0ms at others. even the program subscribe 1 of 4 lidar data(lidar1/scan).
Here is my test code to compare recoded timestamp & callback time
----------
#include
#include
class laser_rate_test_node{
private:
ros::NodeHandle nh;
ros::Subscriber laser_sub;
public:
laser_rate_test_node(ros::NodeHandle _nh):nh(_nh){
laser_sub = nh.subscribe("lidar1/scan",10, &laser_rate_test_node::laserCallback, this, ros::TransportHints().unreliable());
}
void laserCallback(const sensor_msgs::LaserScanConstPtr& scan){
ROS_INFO("%lf",scan.get()->header.stamp.toSec());
}
};
int main (int argc, char **argv)
{
ros::init(argc, argv, "laser_rate_test_node");
ros::NodeHandle nh;
laser_rate_test_node laser_rate_test_node(nh);
ros::spin();
}
and its results with network IO graph using wireshark are below:
using rosbag play XXX.bag. Highlighted text shows called time(left with bracket) and sensor timestamp(right)
![rosbag_normal](http://imgur.com/ld2X3Ka.png)
using rosbag with -i option
![image description](http://imgur.com/gSMM1ci.png)
no bag used(using actual sensor), ignore wireshark result... it's same as upper one.
![image description](http://imgur.com/n4POK3U.png)
In view of the results, I think this problem is a bug of rosbag play, not my code related with ROSTCP and ROSCPP.
How can I handle this problem? Is there anyone who suffered similar problem?
↧