How to write a driver for Hokuyo Laser Scanner?
I want to write a driver for laser scanner and publish data on /scan topic. I write this code for initializing:
sensor_msgs::LaserScan laser_data;
laser_data.header.frame_id="laser";
laser_data.angle_max=((210.234375)/180)*M_PI;
laser_data.angle_min=((-29.53125)/180)*M_PI;
laser_data.angle_increment=(0.3515625/180)*M_PI;
laser_data.header.stamp=ros::Time::now();
laser_data.scan_time=0.10000000149;
laser_data.time_increment=9.76562732831e-05;
laser_data.range_min=0.019999999553;
laser_data.range_max=5.59999990463;
laser_data.ranges.resize(682);
and put my data on ranges array.
I can see laser data in Rviz but when i used it for hector_slam , It's not worked and I saw this error:
[ INFO] [1395750671.645863427]: lookupTransform base_link to laser timed out. Could not transform laser scan into base_frame.
[ERROR] [1395750671.815635459]: Trajectory Server: Transform from /map to scanmatcher_frame failed: "map" passed to lookupTransform argument target_frame does not exist
another warning that i saw in Rviz in Global Status box is :
No tf data. Actual error: Fixed Frame [laser] does not exist
This is my tf_tree when run hector_slam:
When i try with urg_node , hector_slam worked correctly. This is the tf tree with urg_node:
I used a Hokuyo 04LX laser scanner.
Does anyone has any suggestion about this problem?
Thank you
This sounds more like a TF problem than an implementation problem of your driver. Investigate your TF tree and so on.
Is the TF broadcaster "/base_to_laser_broadcaster" the same in both cases? Is it a tf static_transform_publisher or a node you wrote yourself? Can you try to increase the publish rate for /base_to_laser_broadcaster?
I also got problem like this. Is there anyone can solve this? Thank a Lot