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

Converting Laserscan (from XV-11) to Point Cloud (eventually 3D using octomap)

asked 2016-06-15 13:34:50 -0600

ateator gravatar image

Hey guys,

I'm pretty new to ROS and I've got myself a Neato XV-11 Lidar. I have it running and I can see scans in rviz under topic /scan, so that works fine. I have also installed Hector SLAM (from a tutorial and given code) and can get a SLAM map built. My objective now is to take my LaserScan topic /scan and use laser_geometry to turn that topic into a point cloud and then eventually use that point cloud with octomap to produce a 3D map. I have read a lot about how laser_geometry works, but my problem is that I don't really understand how to implement it. On this tutorial:

http://wiki.ros.org/laser_pipeline/Tu...

Code is given, and I think that it is c++ (maybe python? again, new to this) but when I try to compile the code I have errors like ros/ros.h no such file or directory. I think that my problem comes with my understanding of how this all works, and how the libraries are used. Most of the time, I try to use "sudo apt-get install", but when there is no install pakage available, I use the termminal to direct myself ot my catkin workspace, git clone the code, and then catkin_make. Is this correct to allow me to use these packages/stacks I'm trying to copy? I have done tutorials including catkin workspaces, and tf, so I have a general understanding, but I would really love some feedback here. Please let me know what I should do / where I should go. Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2016-06-15 14:45:27 -0600

updated 2016-06-16 07:44:14 -0600

I'm currently working on a similar project. I use the laser_assembler package, which is a part of the laser_pipeline, to make point clouds out of laser scans. You should be able to install it using sudo apt-get install ros-indigo-laser-pipeline, assuming indigo is your distro. Octomap_server requires a PointCloud2 to make the map, so you'll have to adapt the periodic_snapshotter in the laser_assembler github page to use PointCloud2 instead of PointCloud.

[EDIT1] Whatever laser driver package you are doing publishes the laser scans as a sensor_msgs/LaserScan message on the /scan topic. Laser_assembler subscribes to /scan, reads the LaserScan messages, and converts the range data into sensor_msgs/PointCloud messages (an x, y, z value) in the fixed frame that you specify when you start the node. The point cloud is kept waits for a service call to call them. The periodic_snapshotter example in the github repo I linked you to calls the assemble_scans service, which collects all of the points assembled since the last service call and publishes them on the assembled_cloud topic. As octomap_server requires sensor_msgs/PointCloud2 messages, you will need to adapt periodic_snapshotter to call the assemble_scans2 service and publish PointCloud2 messages. I would also suggest increasing the rate as periodic_snapshotter currently calls the service every 5 seconds. Once you are publishing the point clouds, you run octomap_server. It subscribes to the cloud_in topic (though you can remap that) and builds the octomap.

Another thing you need to look at is some way to determine the height of the sensor, as there is no z value to a laser scan. As well, I would suggest using an IMU and the hector_imu_attitude_to_tf package, which allows the system to know the true orientation of your robot in order to get the most accurate map.

[EDIT2] You use a launch file to run multiple nodes simultaneously. Launch files run the ROS master, allows you to set parameters, lets you remap topics, and opens multiple nodes at once. Some nodes you may have to write yourself, such as the one adding height to the transform tree, but for the most part you just have to worry about setting parameters and maybe remapping topics.

edit flag offensive delete link more

Comments

Thank you. I have installed the laser_assembler package with the apt-get command you give. I have cloned the link you gave me into my catkin workspace and will look into it. I still don't understand how to link all of these packages together (laserscan to poincloud2 to octomap)

ateator gravatar image ateator  ( 2016-06-15 14:53:32 -0600 )edit

Thank you for your detailed answer. I am starting to understand how the topics, etc. work in this example, but I still don't understand what to do in order to use the code given in these packages. Is it expected that I am writing my own package from scratch and call these codes?

ateator gravatar image ateator  ( 2016-06-16 07:19:20 -0600 )edit

heh, I guess i was being mostly ignorant. Now I have a terminal with roscore, a terminal with the Neato drier, and I can rosrun laser_assembler test_assembler. I get an error, but that's kind of expected since I havent modified the code. I'll try to figure it out and let you know :)

ateator gravatar image ateator  ( 2016-06-16 07:43:07 -0600 )edit

It's working! I can see the published point clouds in rviz! Thank you for your help!! I will not be rising the planar laser up and down on a Z axis, but instead plan to rotate it on an axis to get an essentially non-moving spherical set of points for a point cloud. Any tips?

ateator gravatar image ateator  ( 2016-06-16 08:01:43 -0600 )edit

That I have not tried before, but you'll definitely need an IMU for that. Please click on the checkmark next to my answer to select it as correct :P

Icehawk101 gravatar image Icehawk101  ( 2016-06-16 08:05:57 -0600 )edit

Any suggestions for cost-effective IMU's with lots of technical support in reference to ROS?

ateator gravatar image ateator  ( 2016-06-16 08:11:24 -0600 )edit

I'm using an InvenSense MPU6050. It's around $12 CAD, but you'll need an Arduino or similar to connect it. I know there is a working ROS package for the Sparkfun SEN-10724, but again it is running through an Arduino.

Icehawk101 gravatar image Icehawk101  ( 2016-06-16 08:28:15 -0600 )edit

Heh, I've got the Intel Edison.. what a freakin pain to get working on Ubuntu 16.04. Again, your help has been invaluable. Thank you. I'll look into IMU's and hector_imu_attitude_tf

ateator gravatar image ateator  ( 2016-06-16 08:46:21 -0600 )edit
0

answered 2016-06-16 08:08:25 -0600

ateator gravatar image

updated 2016-06-16 08:09:06 -0600

The answer to my question... BIG Thanks! to icehawk101

Installed laser_assembler and downloaded the package on the page that icehawk101 linked. I put that package into my catkin_ws and did catkin_make. From there, I can run (in separate terminals)

  1. roscore

  2. (the xv_11_laser_driver

  3. rosrun laser_assembler laser_scan_assembler _fixed_frame:=laser (not neato_laser since I modified that for hector slam)

  4. rosrun laser_assembler periodic_snapshotter

  5. rosrun rviz rviz

Then add a pointcloud under topic assembled_cloud From here I will try to get a point_cloud2 published and use octomap

edit flag offensive delete link more

Comments

Hi Ateator, Could you keep me updated with your next step: that is how to get point_cloud2 published and use octomap. I am working on the exact same problem and my next step is also same. Please contact me at shantnukakkar1992@gmail.com and we can discuss and put our doubts on ROS answers.

Shantnu gravatar image Shantnu  ( 2016-06-17 03:37:13 -0600 )edit

If you click on my name and check my latest question, it includes the launch file I use that has octomap working. You will need to delete the node for the Razor IMU to get it working for you.

ateator gravatar image ateator  ( 2016-06-29 15:49:47 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-06-15 13:34:50 -0600

Seen: 1,243 times

Last updated: Jun 16 '16