Using the Localization Module
This tutorial will walk you through utilizing the localization module of POLARIS. With a pre-collected Look-Up Table (LUT), you will be able to obtain localization data from the open-source AprilTags augmented reality tags. A LUT corresponding to the area you wish to localize in is a prerequisite to this tutorial. If you do not yet have the LUT, please see the tutorial on Manual Creation of a Look-Up Table (LUT)
Make sure you are running in Ubuntu 12.04
You must have the ach packages: https://github.com/golems/ach
You must also have numpy: http://www.numpy.org/
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 mkLocalization cd apriltags make
Receiving Localization Data through the Terminal
Make sure you have the camera you would like to view augmented reality tags with connected, then cd into POLARIS/mkLocalization/apriltags, finally execute the following commands to run the localization module and see its data printed to the terminal:
ach mk recognition ./build/bin/apriltags_demo
Open a new terminal and cd into the apriltags directory again, then execute:
cd example python LUTReader.py
Open a new terminal and cd into the apriltags directory once more, then execute:
cd example python localizer.py
The localization data obtained from reading the AprilTags through the camera will be printed out to the terminal screen running the localizer.py program.
Receiving Localization Data through a Channel
Make sure you have the camera you would like to view augmented reality tags with connected, then cd into POLARIS/mkLocalization/apriltags, finally execute the following command to run the localization module and have its data transferred through the localizer channel.
Data can be received through the localizer channel. The attributes of the data structure received from the localizer channel are as follows:
class CHAN_TYPE(Structure): _pack_ = 1 _fields_ = [("valid", c_uint32), ("x", c_double), ("y", c_double), ("z", c_uint32), ("THETA", c_double)]
Where the valid bit tells us if the data is valid. The data is invalid (valid bit of 0) only while the module has not yet seen its first AprilTag. After this, the valid bit will be 1. The x attribute is the x value of the location coordinate as a double. The y attribute is the y value of the location coordinate as a double. The z attribute is the floor value of the location coordinate as a 32 bit unsigned integer. Finally, the THETA attribute is the orientation value of POLARIS as a double.