|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.|
Using FLIRTLib with the ROS navigation stackDescription: How to launch the FLIRTLib nodes and use them for startup localization with the ROS nav stack
First, install the stack. For example, on Ubuntu:
$ sudo apt-get install ros-fuerte-flirtlib-features
The code also requires various other things to be launched first:
Laser data must be incoming on the base_scan topic, and transforms must be available between base_footprint and base_laser_link. This happens automatically on a PR2 once the robot is launched.
(optional) If a mongodb database instance is already running on the system, you may use it to store the scans.
$ roslaunch flirtlib_ros flirtlib_ros.launch run_db:=true db_path:=/path/to/my/db
where the database path is a location on your system where you want the scans to be stored.
Initial localization and map-building
Since the robot is new in your environment, it has no way to localize. So set the localization by hand using rviz as you would normally do. Then, command the robot using the nav stack and verify that at least one successful navigation happens. The flirtlib node will now start recording scans. Drive the robot around your environment. Visualize the saved_scans PoseArray topic in rviz, and you will see the scans being added.
In future, when you bring up the nav stack and robot, launch flirtlib as above. Depending on the density of scans in your environment, it may localize you correctly upon launch. If not, you may need to do:
$ roslaunch flirtlib_ros localize.launch
This may cause the robot to move around as it searches for features that it has seen before.
This happens automatically; once the robot is localized, if no scans less than a day old are available, the current scan will be added to the map and old scans timed out.
Sharing across robots
Just run your db on a central host and pass the db_host argument to the launch file on each robot. Sharing will now happen automatically.