SLAM-assisted creation of a Look-Up Table (LUT)
This tutorial will walk you through the intended SLAM-assisted creation of a Look-Up Table (LUT) for the area you plan to localize in through the use of POLARIS. The system for creating a LUT has not yet been completed, therefore this tutorial will give directions on how to run the partial phase 1 of the two phases to the system. If you are interested in how the LUT is used by the localization module, please see the following page on Localizing with AprilTags.
Obtaining the Localization Module
The localization module of POLARIS can be obtained by cloning the POLARIS repository on the Lofaro Labs github. If you do not yet have the POLARIS repo, please execute the following commands in your Ubuntu 12.04 environment:
First obtain the following dependencies for AprilTags:
sudo apt-get install subversion cmake libopencv-dev libeigen3-dev libv4l-dev
Now obtain the POLARIS repo and make AprilTags:
git clone https://github.com/LofaroLabs/POLARIS.git cd POLARIS cd mkLUTCreator cd apriltags make
Collecting the data for LUT creation
In order to create the LUT, we have two phases. Only Phase 1 of the two phases have been implemented thus far. Phase 1 is the DataWriter phase. In the DataWriter phase, after we have placed the AprilTags on the ceiling appropriately, we run SLAM, AprilTags, and the DataWriter program. These system components are used to simultaneously collect the 6D pose data of a viewed tag, as well as the global position and orientation of the robot running SLAM when the tag has been viewed. In phase 2, the LUTWriter phase, this data is processed to obtain the LUT containing the global positions of the tags through transformations. Phase 2 has not yet been implemented. For more information on the concepts behind phase 1 and phase 2, please see SLAM-assisted creation of a Look-Up Table Overview. The following steps allow a user to run the DataWriter phase:
ach mk slam ach mk recognition
cd into POLARIS/mkLUTCreator/apriltags
In a new terminal, follow the steps from the following tutorial to run SLAM: Using SLAM software
In a new terminal, cd into POLARIS/mkLUTCreator/apriltags/example
Now drive the robot under the tags with the camera facing the ceiling. When you have driven the robot under every tag that you are using to localize, click on the OpenCV image frame from the apriltags_demo program and press the escape key, this will allow the DataWriter to properly write all runtime data to csv files for later processing in phase 2 and properly close the files. The files that will contain data collected are: collectedArray.txt, localTagPose.txt, and globalCameraPosition.txt
The collectedArray.txt file is a file of 587 lines with each line corresponding to a particular tag. The first line, line 0, corresponds to the tag with ID 0. The second line, line 1, corresponds to the tag with ID 1, and so on. If you have driven the robot under a tag and successfully collected its data, the line corresponding to that tag will have a '1' written, if not, then there will be a '0' on that line. This file is used to verify that data has been successfully collected for every tag you plan to use in localizing with POLARIS.
The localTagPose.txt file contains the x,y,z,ROLL,PITCH,YAW data corresponding to viewed tags. The x,y,z,ROLL,PITCH and YAW are taken with respect to the camera using the AprilTags module. This data is post-processed after collection in order to obtain the LUT through transformations. The file is a file of 587 lines with each line corresponding to a particular tag. The first line, line 0, corresponds to the tag with ID 0. The second line, line 1, corresponds to the tag with ID 1, and so on.
The globalCameraPosition.txt file contains the x,y,YAW data corresponding to the robot's global frame position at the time that the tag is viewed. This data gives us the x,y,YAW values of the camera recognizing the tags as long as the camera is oriented properly on the robot such that the positive y-axis of the camera faces the same direction as the front of the robot. To verify that the robot and the camera are properly aligned, run the apriltag_demo and place the camera such that it is looking up at a tag on the ceiling and resting on the center of the robot. Orient the camera such that the viewed tag yields an orientation of zero and align the front of the robot with this direction as well. The data from globalCameraPosition.txt is post-processed after collection in order to obtain the LUT through transformations. The file is a file of 587 lines with each line corresponding to a particular tag. The first line, line 0, corresponds to the tag with ID 0. The second line, line 1, corresponds to the tag with ID 1, and so on.