hokuyo subscriber callback delay??
Hi! I am trying to subscribe to a laser scan of the hokuyo_node. (UTM-30LX)
I have checked that the rostopic(/scan) satisfied 40Hz.
$rostopic hz /scan
However, msg(/scan) callback is not satisfied 40Hz. (0.025sec)
Can I subscribe a rostopic(/scan) with 40Hz?
[ INFO] [1556028820.890011693]: 231]Laser 1.112000 0.117000 0.486000
[ INFO] [1556028820.890147465]: 232]Laser 1.113000 0.119000 0.485000
[ INFO] [1556028820.933906513]: 233]Laser 1.118000 0.120000 0.488000
[ INFO] [1556028820.934033465]: 234]Laser 1.114000 0.128000 0.486000
[ INFO] [1556028820.977954391]: 235]Laser 1.112000 0.109000 0.488000
[ INFO] [1556028820.978087813]: 236]Laser 1.112000 0.117000 0.493000
[ INFO] [1556028821.021961768]: 237]Laser 1.113000 0.110000 0.492000
[ INFO] [1556028821.027527888]: 238]Laser 1.116000 0.116000 0.487000
[ INFO] [1556028821.070109309]: 239]Laser 1.113000 0.128000 0.486000
I using a source code below.
#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>
void laserCallback(const sensor_msgs::LaserScan::ConstPtr & scan)
{
ROS_INFO("%d]Laser %f %f %f", scan->header.seq, scan->ranges[0], scan->ranges[360], scan->ranges[719]);
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "laser_scan");
ros::NodeHandle nh;
ros::Subscriber scan_sub = nh.subscribe("/scan", 1000, laserCallback);
ros::spin();
return 0;
}
Please do not post screenshots of terminals, there is no need. It's all text, so copy-paste the console text into your question. Then use the Preformatted Text button (the one with
101010
on it) to properly format it.