00001 /** 00002 * removed struct and made class out of it to make it streamable 00003 * @author <a href="mailto:Thorsten.Kerkhof@gmx.de">Thorsten Kerkhof</a> 00004 */ 00005 00006 #include "MultipleBallPerceptElement.h" 00007 00008 MultipleBallPerceptElement::MultipleBallPerceptElement() 00009 : radiusInImage(0), 00010 reliability(0), 00011 distanceError(0) 00012 { 00013 } 00014 00015 void MultipleBallPerceptElement::calculateDistanceValue(Vector2<double> offset) 00016 { 00017 /* "distance to ball"-value: 00018 * b is equal to 1 if the calculated distance value is 50 (the minimum of the function) 00019 * the lowest value is 0.045 for a distance of approximately 4000 mm 00020 */ 00021 double value; 00022 00023 double d2 = offset.x * offset.x + offset.y * offset.y; 00024 double d = sqrt(d2); 00025 00026 //Function is result of BallLocatorEvolutionBehavior: 00027 if (d < 250) 00028 value = -d / 12 + 74; 00029 else if (d < 1500) 00030 value = 50; 00031 else 00032 value = 0.000160403 * d2 - 0.440147 * d + 349.31375; 00033 00034 //return the normalized value (50 is minimum of the function) 00035 //the bigger the distance value is the lower the trust in the percept should be 00036 distanceError = 50 / value; 00037 }
1.3.6