0
$\begingroup$

Rosanswers logo

I am building a robot which will move using ros navigation stack with move_base. I am using Lidar Lite 2 Laser Rangefinder to detect obstacles and for mapping as well. I have two questions regarding the use of this lidar.

  1. Shall I use LaserScan (in obstacle_layer) or Range message data (in RangeSensorLayer) to put obstacles into the costmap. I am confused because generally Lidar is considered as a Laser sensor so it should be providing data in LaserScan format. But this specific lidar is providing range data.

  2. I am using a motor to rotate this lidar to cover 180 degrees of scan area. How can I let my obstacle layer know the current position of lidar so that the obstacle point is inserted at the correct place in the costmap. In my robot's urdf, I can add this sensor at one frame and it will be fixed to that place according to the urdf. Is there any method to resolve this issue ?


Originally posted by b2meer on ROS Answers with karma: 66 on 2016-03-22

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You should use LaserScan messages, imo, and take care of the spinning logic in your laser scan publisher. Each LaserScan messsage's ranges field will be populated with, e.g., 180 degrees worth of LiDAR-Lite measurements.

Here are some guidelines and examples:

Keep in mind that you'll need some way of keeping track of your motor's / LiDAR's orientation. Some sort of encoder. (Unless you're using a stepper motor.)


Originally posted by spmaniato with karma: 1788 on 2016-03-22

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by b2meer on 2016-03-24:
I'm using a stepper motor to rotate my lidar lite, for design reasons. The stepper motor has been fixed at a rotation rate of 2Hz. The method you've described would therefore mean that there would be a lag of 0.5 seconds due to the refresh-rate. This isn't much lag, but can it be reduced further?

Comment by spmaniato on 2016-03-24:
That's what the LaserScan message's time_increment field is for :-) Check out this detailed explanation: http://answers.ros.org/question/198843/need-explanation-on-sensor_msgslaserscanmsg/?answer=198848#post-id-198848

Comment by b2meer on 2016-03-28:
alright. Thank you very much for your help

$\endgroup$
0
$\begingroup$

Rosanswers logo

Related to the part of the rotating lidar, I created an example that shows how to detect the closest obstacle to the whole system at any position of the rotation. The trick is to reference the obstacle to the base_link and use the tf to transform from the laser reference frame to the base_linkreference frame.

I have done this in Python, using tf2_ros and tf2_geometry_msgs.

1st. Initialize the tf buffer and listener somewhere in your init function

buffer = tf2_ros.Buffer(rospy.Duration(1200.0)) 
tf_listener = tf2_ros.TransformListener(self.tf_buffer)

2nd. Do the actual transformation

transform = buffer.lookup_transform(target_frame, #destination frame
                                   pose_stamped_to_transform.header.frame_id, #source frame
                                   rospy.Time(0), #get the tf at first available time
                                   rospy.Duration(1.0)) #wait for 1 second

pose_transformed = tf2_geometry_msgs.do_transform_pose(pose_stamped, transform)

You can watch the video here that shows a full example and how it looks in Rviz.

Cheers


Originally posted by R. Tellez with karma: 874 on 2017-12-09

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by ahendrix on 2017-12-09:
This example is nice, but it doesn't really seem to be related to the question. The OP has a single-beam (point) lidar, but this example shows a line scanner.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.