Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Getting Started with MegaTree
Description: Gets you up and running with MegaTreeTutorial Level: BEGINNER
Installation
These instructions are for Ubuntu only. Before you get started, make sure you have ROS installed by following these instructions.
You can install MegaTree from Debian packages by running:
sudo apt-get install ros-fuerte-megatree
Importing a pointcloud
First, create an empty tree on your local disk. In the command below, specify the path where the MegaTree will be created.
rosrun megatree_cpp create /path/to/tree_folder 6 10000
Next, we'll be importing a pointcloud into the MegaTree you just created. For this tutorial, you should download an example pointcloud from this link (500MB). (Chappes Cathedral Dataset courtesy of Prof. Peter Allen, Columbia University Robotics Lab. Scanning by Alejandro Troccoli and Matei Ciocarlie)
Assuming you downloaded the example pointcloud in '/path/to/chappes.pts', new we're ready to import it into your MegaTree. The command below reads the pointcloud from a pts file, but other formats such as LAS, pcd, etc are also supported.
rosrun megatree_import import_pts -t /path/to/tree_folder -c 5M /path/to/chappes.pts
During this process, watch the memory usage on your computer. If you start running out of memory, re-run the command above with a smaller cache size, by replacing '5M' (5 million points in cache) with a lower number, e.g. '3M'.
Importing is quite a slow process right now, but you'll get all the speed advantages after the import is completed.
Serving a pointcloud
You can make the MegaTree you just created available to different applications and visualizers, by 'serving' it. The instructions below guide you though setting up an apache server for your MegaTree:
First, install apache
sudo apt-get install apache2 libapache2-mod-fastcgi
Then copy the apache config file into the apache config folder
sudo cp /opt/ros/fuerte/stacks/megatree/megatree_web/megatree-site /etc/apache2/sites-available
Enable the megatree site, and disable the default site
cd /etc/apache2/sites-available sudo a2ensite megatree-site sudo a2dissite default
Restart apache
sudo service apache2 restart
Run the server
rosrun megatree_server run /path/to/tree_folder
Web viewer
MegaTree can stream the pointcloud you just imported to any Chrome web browser. You'll need to have WebGL enabled in your browser. Check out this page to see if WebGL is working on your Chrome browser.
Now that you have a WebGL enabled browser, you can start viewing pointclouds, simply by pointing your Chrome browser at http://localhost. You might have to refresh your browser cache using 'ctrl+shift+r'. Since this is the the web, you can of course go to a Chrome browser on any other computer, and point it to your server to view the same pointcloud.