ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to write a driver for Hokuyo Laser Scanner?

asked 2014-03-25 02:39:10 -0500

mr.karimi gravatar image

updated 2014-03-26 22:11:24 -0500

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:

image description

When i try with urg_node , hector_slam worked correctly. This is the tf tree with urg_node:

image description

I used a Hokuyo 04LX laser scanner.

Does anyone has any suggestion about this problem?

Thank you

edit retag flag offensive close merge delete

Comments

1

This sounds more like a TF problem than an implementation problem of your driver. Investigate your TF tree and so on.

BennyRe gravatar image BennyRe  ( 2014-03-25 02:48:53 -0500 )edit

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?

timm gravatar image timm  ( 2014-03-27 03:53:29 -0500 )edit

I also got problem like this. Is there anyone can solve this? Thank a Lot

MiNiBot gravatar image MiNiBot  ( 2015-11-14 02:38:29 -0500 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2014-03-25 02:55:46 -0500

I´d suspect that the frame_id you use is different from the one used when using the hokuyo_driver, as the transform error says that there is no connection from the laser to the base_frame. If you´re sure you didn´t change any other parts of your robot system, doing a "rostopic echo" on your scans and comparing the output for both the hokuyo_driver and your own driver should show you the difference (if any). If at all possible, I´d suggest using the existing driver however.

edit flag offensive delete link more

Comments

I checked "rostopic echo" but there is no difference between my program and urg_node. yes ,you're right.i should use existing drivers but in my situation i think i don't have another choice.

mr.karimi gravatar image mr.karimi  ( 2014-03-26 22:02:28 -0500 )edit

I want to connect the laser scanner to an embedded board that doesn't have ros and send laser data through udp. I have another program in ROS that receive udp data and publish as LaserScan topic.

mr.karimi gravatar image mr.karimi  ( 2014-03-26 22:03:01 -0500 )edit

Question Tools

Stats

Asked: 2014-03-25 02:39:10 -0500

Seen: 1,099 times

Last updated: Mar 26 '14