Difference between revisions of "Using the Localization Module"

From Lofaro Lab Wiki
Jump to: navigation, search
(Receiving Localization Data through a Channel)
(Receiving Localization Data through the Terminal)
Line 16: Line 16:
 
      
 
      
 
== Receiving Localization Data through the Terminal ==
 
== Receiving Localization Data through the Terminal ==
Make sure you have the camera you would like to view augmented reality tags with connected and then execute the following commands to run the localization module and see its data printed to the terminal. Then cd into POLARIS/mkLocalization/apriltags and execute:
+
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
 
     ach mk recognition

Revision as of 16:38, 20 May 2015

This tutorial will walk you through utilizing the localization module of POLARIS. With a pre-collected LookUp 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 LookUp Table (LUT)

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.

   ./starterScript

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.