ros-perception / ar_track_alvar

AR tag tracking library for ROS

Home Page:www.ros.org/wiki/ar_track_alvar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect Marker Init

130s opened this issue · comments

From @richterh on May 5, 2015 11:36

When using the system to automatically learn marker maps the resulting output describes each marker with a triangular shape rather the the correct rectangle shape. This is due to incorrect initialisation of the first corner when it is initially added during the training procedure (src/MultiMarker.cpp from line 239):

// TODO: This should be exactly the same as in Marker class.
//       Should we get the values from there somehow?
double X_data[4] = {0, 0, 0, 1};    
if (j == 0) { 
    int zzzz=2;         
    //X_data[0] = -0.5*edge_length;
    //X_data[1] = -0.5*edge_length;
} else if (j == 1) {
    X_data[0] = +0.5*edge_length;
    X_data[1] = -0.5*edge_length;
} else if (j == 2) {
    X_data[0] = +0.5*edge_length;
    X_data[1] = +0.5*edge_length;
} else if (j == 3) {
    X_data[0] = -0.5*edge_length;
    X_data[1] = +0.5*edge_length;
}

By uncommenting the commented lines above the problem can be corrected (the line "int zzzz=2;" can also be safely removed).

The extend of specifying the markers as such is currently unknown to me, but I believe it can be reverted due to the following reasons:

  1. The triangle shape is not the correct description of a marker. The (http://wiki.ros.org/ar_track_alvar)[ROS documentation] (See Section 4) state that the four corners should form a rectangle around the centre, thus the centre is not considered a point in the marker bundles.
  2. There is a TODO comment that states the initialisation should be the same as the marker class. Assuming it refers to (https://github.com/sniekum/ar_track_alvar/blob/indigo-devel/src/Marker.cpp)[src/Marker.cpp] (See lines 356 - 379), the commented lines above should indeed be uncommented.
  3. Finally, it looks like a development change that was made for testing purposes but the developer forgot to revert it. It has not been changed since the initial commit of this repository. Another copy of the Alvar respository, made about a month after the initial commit of this repository, does have the corrected code (https://github.com/astanin/mirror-alvar/blob/master/src/MultiMarker.cpp)[Alvar 2.0 Mirror/MultiMarker.cpp] (See from line 228).

Copied from original issue: sniekum#54