Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Modules/BehaviorControl/GT2005BehaviorControl/GT2005Symbols/GT2005ConfigurationSymbols.cpp

Go to the documentation of this file.

    00001 /**
    00002 * @file GT2005ConfigurationSymbols.cpp
    00003 *
    00004 * Implementation of class GT2005ConfigurationSymbols.
    00005 *
    00006 * @author Max Risler
    00007 */
    00008
    00009 #include "GT2005ConfigurationSymbols.h"
    00010 #include "Tools/FieldDimensions.h"
    00011 #include "Tools/Debugging/Trace.h"
    00012
    00013 GT2005ConfigurationSymbols::GT2005ConfigurationSymbols(
    00014                            BehaviorControlInterfaces& interfaces)
    00015 : BehaviorControlInterfaces(interfaces)
    00016 {
    00017   //kickoff_role = BehaviorTeamMessage::goalie;
    00018   switch (getPlayer().getPlayerNumber())
    00019   {
    00020     case Player::one:
    00021       kickoff_role = BehaviorTeamMessage::goalie;
    00022       break;
    00023     case Player::two:
    00024       kickoff_role = BehaviorTeamMessage::defensiveSupporter;
    00025       break;
    00026     case Player::three:
    00027       kickoff_role = BehaviorTeamMessage::offensiveSupporter;
    00028       break;
    00029     case Player::four:
    00030       kickoff_role = BehaviorTeamMessage::striker;
    00031       break;
    00032   }
    00033   currentKickoff = 0;
    00034     // start position for goalie (both kickoffs)
    00035     goalie.x = xPosOwnGroundline + 100.0;
    00036     goalie.y = 50;
    00037     // start position for defensive supporter (both kickoffs)
    00038     defensiveSupporter.x = xPosOwnGroundline / 2 - 100;
    00039     defensiveSupporter.y = -300.0;
    00040
    00041     // start position for offensive supporter (opponent kickoffs)
    00042     offensiveSupporterOpponentKickoff.x = xPosOwnGroundline / 2 - 100;
    00043     offensiveSupporterOpponentKickoff.y = -1000.0;
    00044     // start position for striker (opponent kickoffs)
    00045     strikerOpponentKickoff.x = xPosOwnGroundline / 2 - 100;
    00046     strikerOpponentKickoff.y = 600.0;
    00047
    00048     // long kickoff to the right
    00049     offensiveSupporterOwnKickoff[0].x = -200.0;
    00050     offensiveSupporterOwnKickoff[0].y = -800.0;//-1100.0;
    00051     offensiveSupporterOwnKickoffAngle[0] = 0.0;
    00052     strikerOwnKickoff[0].x = -130.0;//-185.0;
    00053     strikerOwnKickoff[0].y = 130.0;//0;
    00054     strikerOwnKickoffAngle[0] = -45.0;//0;
    00055
    00056     // long kickoff to the left
    00057     offensiveSupporterOwnKickoff[1].x = -200.0;
    00058     offensiveSupporterOwnKickoff[1].y = 800.0;//1100.0;
    00059     offensiveSupporterOwnKickoffAngle[1] = 0.0;
    00060     strikerOwnKickoff[1].x = -130.0;
    00061     strikerOwnKickoff[1].y = -130.0;
    00062     strikerOwnKickoffAngle[1] = 45.0;
    00063
    00064 }
    00065
    00066 void GT2005ConfigurationSymbols::registerSymbols(Xabsl2Engine& engine)
    00067 {
    00068   // "kickoff role"
    00069   engine.registerEnumeratedInputSymbol("kickoff.role", (int *)&kickoff_role);
    00070   engine.registerEnumeratedInputSymbolEnumElement("kickoff.role", "kickoff.role.kickoff-goalie", BehaviorTeamMessage::goalie);
    00071   engine.registerEnumeratedInputSymbolEnumElement("kickoff.role", "kickoff.role.kickoff-striker", BehaviorTeamMessage::striker);
    00072   engine.registerEnumeratedInputSymbolEnumElement("kickoff.role", "kickoff.role.kickoff-defensive-supporter", BehaviorTeamMessage::defensiveSupporter);
    00073   engine.registerEnumeratedInputSymbolEnumElement("kickoff.role", "kickoff.role.kickoff-offensive-supporter", BehaviorTeamMessage::offensiveSupporter);
    00074   engine.registerDecimalInputSymbol("kickoff.rolenumber",this,
    00075     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getKickOffRoleNumber);
    00076
    00077   engine.registerDecimalInputSymbol("current-kickoff-variant",this,
    00078     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getCurrentKickoff);
    00079
    00080   engine.registerDecimalInputSymbol("own-kickoff.angle",this,
    00081     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getOwnKickoffAngle);
    00082   engine.registerDecimalInputSymbol("own-kickoff.x",this,
    00083     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getOwnKickoffX);
    00084   engine.registerDecimalInputSymbol("own-kickoff.y",this,
    00085     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getOwnKickoffY);
    00086
    00087   engine.registerDecimalInputSymbol("opponent-kickoff.angle",this,
    00088     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getOpponentKickoffAngle);
    00089   engine.registerDecimalInputSymbol("opponent-kickoff.x",this,
    00090     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getOpponentKickoffX);
    00091   engine.registerDecimalInputSymbol("opponent-kickoff.y",this,
    00092     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getOpponentKickoffY);
    00093
    00094   // "kickoff.x"
    00095   engine.registerDecimalInputFunction("kickoff.x",this,
    00096     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getKickoffX);
    00097   engine.registerDecimalInputFunctionParameter("kickoff.x","kickoff.x.role",role);
    00098   engine.registerDecimalInputFunctionParameter("kickoff.x","kickoff.x.ownkickoff",ownKickOff);
    00099   // "kickoff.y"
    00100   engine.registerDecimalInputFunction("kickoff.y",this,
    00101     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getKickoffY);
    00102   engine.registerDecimalInputFunctionParameter("kickoff.y","kickoff.y.role",role);
    00103   engine.registerDecimalInputFunctionParameter("kickoff.y","kickoff.y.ownkickoff",ownKickOff);
    00104   // "kickoff.angle"
    00105   engine.registerDecimalInputFunction("kickoff.angle",this,
    00106     (double (Xabsl2FunctionProvider::*)())&GT2005ConfigurationSymbols::getKickoffAngle);
    00107   engine.registerDecimalInputFunctionParameter("kickoff.angle","kickoff.angle.role",role);
    00108   engine.registerDecimalInputFunctionParameter("kickoff.angle","kickoff.angle.ownkickoff",ownKickOff);
    00109 }
    00110
    00111 void GT2005ConfigurationSymbols::update()
    00112 {
    00113   currentKickoff = gameControlData.getOpponentTeam().score % numOfKickoff;
    00114
    00115   // calculate kickoff position of striker based on obstacle-model
    00116   double radius = 250.0;
    00117
    00118   double leftAbs = fromDegrees(10.0);
    00119   double rightAbs = fromDegrees(55.0);
    00120   double freeWidth = fromDegrees(15.0);
    00121
    00122   double step = fromDegrees(5.0);
    00123   double bestAngle = 0.0;
    00124   double bestDist = 0.0;
    00125
    00126   double start = leftAbs,
    00127          end = rightAbs;
    00128   enum { left, right } direction = left;
    00129
    00130   if (currentKickoff % 2 == 0)
    00131   {
    00132     start *= -1;
    00133     end *= -1;
    00134     step *= -1;
    00135     direction = right;
    00136   }
    00137
    00138   for(
    00139     double ang = start;
    00140     (direction == left && ang <= end) || (direction == right && ang >= end);
    00141     ang += step
    00142   )
    00143   {
    00144     double currDist = obstaclesModel.getDistanceInCorridor(ang, freeWidth);
    00145     double angAbs = ang - robotPose.getAngle();
    00146     currDist = obstaclesModel.getDistanceInDirection(angAbs, freeWidth);
    00147     if(currDist > bestDist)
    00148     {
    00149       bestDist = currDist;
    00150       bestAngle = ang;
    00151     }
    00152   }
    00153
    00154   double posX = - cos ( bestAngle ) * radius;
    00155   double posY = - sin ( bestAngle ) * radius;
    00156
    00157   obstacleKickoff.translation.x = posX;
    00158   obstacleKickoff.translation.y = posY;
    00159   obstacleKickoff.fromAngle(toDegrees(bestAngle));
    00160   computeKickoffRole();
    00161
    00162   DEBUG_RESPONSE("KickOff:Role:output",OUTPUT(idText,text,"kickoffrole: "<<kickoff_role));
    00163   DEBUG_RESPONSE("KickOff:Role:goalie",kickoff_role = BehaviorTeamMessage::goalie;return;);
    00164   DEBUG_RESPONSE("KickOff:Role:defence",kickoff_role = BehaviorTeamMessage::defensiveSupporter;return;);
    00165   DEBUG_RESPONSE("KickOff:Role:offence",kickoff_role = BehaviorTeamMessage::offensiveSupporter;return;);
    00166   DEBUG_RESPONSE("KickOff:Role:striker",kickoff_role = BehaviorTeamMessage::striker;return;);
    00167 }
    00168
    00169 double GT2005ConfigurationSymbols::getCurrentKickoff()
    00170 {
    00171   return currentKickoff;
    00172 }
    00173
    00174 double GT2005ConfigurationSymbols::getOwnKickoffAngle()
    00175 {
    00176   switch (getPlayer().getPlayerNumber())
    00177   {
    00178     case Player::one: // robot number 1
    00179     case Player::two: // robot number 2
    00180     default:
    00181       return 0;
    00182     case Player::three: // robot number 3
    00183       return offensiveSupporterOwnKickoffAngle[currentKickoff];
    00184     case Player::four: // robot number 4
    00185       return getOwnKickoffAngleByObstacles();
    00186       //return strikerOwnKickoffAngle[currentKickoff];
    00187   }
    00188 }
    00189
    00190 double GT2005ConfigurationSymbols::getOwnKickoffX()
    00191 {
    00192   switch (getPlayer().getPlayerNumber())
    00193   {
    00194     case Player::one: // robot number 1
    00195     default:
    00196       return goalie.x;
    00197     case Player::two: // robot number 2
    00198       return defensiveSupporter.x;
    00199     case Player::three: // robot number 3
    00200       return offensiveSupporterOwnKickoff[currentKickoff].x;
    00201     case Player::four: // robot number 4
    00202       return getOwnKickoffXByObstacles();
    00203       //return strikerOwnKickoff[currentKickoff].x;
    00204   }
    00205 }
    00206
    00207 double GT2005ConfigurationSymbols::getOwnKickoffY()
    00208 {
    00209   switch (getPlayer().getPlayerNumber())
    00210   {
    00211     case Player::one: // robot number 1
    00212     default:
    00213       return goalie.y;
    00214     case Player::two: // robot number 2
    00215       return defensiveSupporter.y;
    00216     case Player::three: // robot number 3
    00217       return offensiveSupporterOwnKickoff[currentKickoff].y;
    00218     case Player::four: // robot number 4
    00219       return getOwnKickoffYByObstacles();
    00220       //return strikerOwnKickoff[currentKickoff].y;
    00221   }
    00222 }
    00223
    00224 double GT2005ConfigurationSymbols::getOwnKickoffXByObstacles()
    00225 {
    00226   return obstacleKickoff.translation.x;
    00227 }
    00228
    00229 double GT2005ConfigurationSymbols::getOwnKickoffYByObstacles()
    00230 {
    00231   return obstacleKickoff.translation.y;
    00232 }
    00233
    00234 double GT2005ConfigurationSymbols::getOwnKickoffAngleByObstacles()
    00235 {
    00236   return obstacleKickoff.getAngle();
    00237 }
    00238
    00239 double GT2005ConfigurationSymbols::getOpponentKickoffAngle()
    00240 {
    00241   switch (getPlayer().getPlayerNumber())
    00242   {
    00243     case Player::one: // robot number 1
    00244     case Player::two: // robot number 2
    00245     case Player::three: // robot number 3
    00246     case Player::four: // robot number 4
    00247     default:
    00248       return 0;
    00249   }
    00250 }
    00251
    00252 double GT2005ConfigurationSymbols::getOpponentKickoffX()
    00253 {
    00254   switch (getPlayer().getPlayerNumber())
    00255   {
    00256     case Player::one: // robot number 1
    00257     default:
    00258       return goalie.x;
    00259     case Player::two: // robot number 2
    00260       return defensiveSupporter.x;
    00261     case Player::three: // robot number 3
    00262       return offensiveSupporterOpponentKickoff.x;
    00263     case Player::four: // robot number 4
    00264       return strikerOpponentKickoff.x;
    00265   }
    00266 }
    00267
    00268 double GT2005ConfigurationSymbols::getOpponentKickoffY()
    00269 {
    00270   switch (getPlayer().getPlayerNumber())
    00271   {
    00272     case Player::one: // robot number 1
    00273     default:
    00274       return goalie.y;
    00275     case Player::two: // robot number 2
    00276       return defensiveSupporter.y;
    00277     case Player::three: // robot number 3
    00278       return offensiveSupporterOpponentKickoff.y;
    00279     case Player::four: // robot number 4
    00280       return strikerOpponentKickoff.y;
    00281   }
    00282 }
    00283
    00284 double GT2005ConfigurationSymbols::getKickoffX()
    00285 {
    00286   if(ownKickOff)
    00287   {
    00288     switch ((int)role )
    00289     {
    00290       case BehaviorTeamMessage::goalie: // robot number 1
    00291       default:
    00292         return goalie.x;
    00293       case BehaviorTeamMessage::defensiveSupporter: // robot number 2
    00294         return defensiveSupporter.x;
    00295       case BehaviorTeamMessage::offensiveSupporter: // robot number 3
    00296         return offensiveSupporterOwnKickoff[currentKickoff].x;
    00297       case BehaviorTeamMessage::striker: // robot number 4
    00298         return getOwnKickoffXByObstacles();
    00299         //return strikerOwnKickoff[currentKickoff].x;
    00300     }
    00301   }else{
    00302     switch ((int)role )
    00303     {
    00304       case BehaviorTeamMessage::goalie: // robot number 1
    00305       default:
    00306         return goalie.x;
    00307       case BehaviorTeamMessage::defensiveSupporter: // robot number 2
    00308         return defensiveSupporter.x;
    00309       case BehaviorTeamMessage::offensiveSupporter: // robot number 3
    00310         return offensiveSupporterOpponentKickoff.x;
    00311       case BehaviorTeamMessage::striker: // robot number 4
    00312         return strikerOpponentKickoff.x;
    00313     }
    00314   }
    00315   return 0;
    00316 }
    00317
    00318 double GT2005ConfigurationSymbols::getKickoffY()
    00319 {
    00320   if(ownKickOff)
    00321   {
    00322     switch ((int)role)
    00323     {
    00324       case BehaviorTeamMessage::goalie: // robot number 1
    00325       default:
    00326         return goalie.y;
    00327       case BehaviorTeamMessage::defensiveSupporter: // robot number 2
    00328         return defensiveSupporter.y;
    00329       case BehaviorTeamMessage::offensiveSupporter: // robot number 3
    00330         return offensiveSupporterOwnKickoff[currentKickoff].y;
    00331       case BehaviorTeamMessage::striker: // robot number 4
    00332         return getOwnKickoffYByObstacles();
    00333         //return strikerOwnKickoff[currentKickoff].y;
    00334     }
    00335   }else{
    00336     switch ((int)role)
    00337     {
    00338       case BehaviorTeamMessage::goalie: // robot number 1
    00339       default:
    00340         return goalie.y;
    00341       case BehaviorTeamMessage::defensiveSupporter: // robot number 2
    00342         return defensiveSupporter.y;
    00343       case BehaviorTeamMessage::offensiveSupporter: // robot number 3
    00344         return offensiveSupporterOpponentKickoff.y;
    00345       case BehaviorTeamMessage::striker: // robot number 4
    00346         return strikerOpponentKickoff.y;
    00347     }
    00348   }
    00349   return 0;
    00350 }
    00351
    00352
    00353 double GT2005ConfigurationSymbols::getKickoffAngle()
    00354 {
    00355   if(ownKickOff)
    00356   {
    00357     switch ((int)role)
    00358     {
    00359       case BehaviorTeamMessage::goalie: // robot number 1
    00360       case BehaviorTeamMessage::defensiveSupporter: // robot number 2
    00361       default:
    00362         return 0;
    00363       case BehaviorTeamMessage::offensiveSupporter: // robot number 3
    00364         return offensiveSupporterOwnKickoffAngle[currentKickoff];
    00365       case BehaviorTeamMessage::striker: // robot number 4
    00366         return getOwnKickoffAngleByObstacles();
    00367         //return strikerOwnKickoffAngle[currentKickoff];
    00368     }
    00369   }else{
    00370     return 0;
    00371   }
    00372   return 0;
    00373 }
    00374
    00375
    00376 double GT2005ConfigurationSymbols::getTimeToReachKickoffPose( BehaviorTeamMessage::DynamicRole role, Vector2<double> pos)
    00377 {
    00378   //simple (only distance to target point)
    00379   this->role = role;
    00380   if (gameControlData.getKickoffTeam()==GameControlData::ownTeam)
    00381     this->ownKickOff = 1;
    00382   else
    00383     this->ownKickOff = 0;
    00384
    00385   Vector2<double>dpos(getKickoffX(),getKickoffY());
    00386     return (dpos-pos).abs();
    00387 }
    00388
    00389 void GT2005ConfigurationSymbols::computeKickoffRole()
    00390 {
    00391   // switch only at ready state
    00392   if (gameControlData.data.state != GameControlData::ready )
    00393   {
    00394     return;
    00395   }
    00396
    00397   Player::playerNumber playernumber;
    00398   playernumber = getPlayer().getPlayerNumber();
    00399
    00400   if (playernumber == Player::one)
    00401   {
    00402     kickoff_role = BehaviorTeamMessage::goalie;
    00403     return;
    00404   }
    00405
    00406   bool wlan
    00407   = (teamMessageCollection[0].isActual(5000)
    00408     && teamMessageCollection[1].isActual(5000)
    00409     && teamMessageCollection[2].isActual(5000));
    00410
    00411   DEBUG_RESPONSE("KickOff:WLan:output",OUTPUT(idText,text,"KickOffRole Wlan: "<<wlan));
    00412   DEBUG_RESPONSE("KickOff:WLan:no",wlan =false;);
    00413   DEBUG_RESPONSE("KickOff:WLan:yes",wlan =true;);
    00414
    00415   //no wlan .
    00416   if(!wlan)
    00417   {
    00418     switch (playernumber)
    00419     {
    00420       case Player::one:
    00421         kickoff_role = BehaviorTeamMessage::goalie;
    00422         break;
    00423       case Player::two:
    00424         kickoff_role = BehaviorTeamMessage::defensiveSupporter;
    00425         break;
    00426       case Player::three:
    00427         kickoff_role = BehaviorTeamMessage::offensiveSupporter;
    00428         break;
    00429       case Player::four:
    00430         kickoff_role = BehaviorTeamMessage::striker;
    00431         break;
    00432     }
    00433     return;
    00434   }
    00435   //calculate times
    00436   double time[Player::numOfPlayerNumbers -1/*goali*/][BehaviorTeamMessage::sizeofKickoff];// 2 player (3 teammate -1 goalie) 3 poses
    00437   Vector2<double> pos = robotPose.translation;
    00438   for(int j = 0; j < BehaviorTeamMessage::sizeofKickoff; ++j)
    00439   {
    00440     kickoffTimes[j].add( (int)(getTimeToReachKickoffPose( (BehaviorTeamMessage::DynamicRole)(j+1), pos)));
    00441     time[0][j] = (double)kickoffTimes[j].getSum() / (double)kickoffTimes[j].getNumberOfEntries();
    00442     outgoingBehaviorTeamMessage.estimatedTimeToReachKickoff[j] = time[0][j];
    00443     //DEBUG_RESPONSE("KickOff:time:output:timetoreach",OUTPUT(idText,text,"time "<<j<<" to reach: "<< time[0][j]) );
    00444   }
    00445   int h = 1;
    00446   for(int i = 0; i < 3; ++i)
    00447   {
    00448     int num = teamMessageCollection[i].playerNumberOfSender;
    00449     //DEBUG_RESPONSE("KickOff:WLan:output:playernumber",
    00450     //  OUTPUT(idText,text,"playerNumberOfSender "<<num));
    00451     if (num == 0) //calculation no goalie
    00452       continue;
    00453     if (num > 3) //playernumber undef
    00454       continue;
    00455     if (h>2)
    00456     {
    00457       OUTPUT(idText,text,"Error more than 3 player are not a goalie");
    00458       OUTPUT(idText,text,"own playernumber: "<< playernumber);
    00459       OUTPUT(idText,text,"actual message playernumber: "<< num);
    00460       continue;
    00461     }
    00462
    00463     for(int j = 0; j < 3; ++j)
    00464     {
    00465       time[h][j] = teamMessageCollection[i].behaviorTeamMessage.estimatedTimeToReachKickoff[j];
    00466       //DEBUG_RESPONSE("KickOff:time:output:timex",
    00467       //  OUTPUT(idText,text,"time ["<<h<<"]["<<j<<"]: "<<time[h][j]));
    00468     }
    00469     h++;
    00470   }
    00471   //calculate best permutation
    00472   double best = 99999999999999999.0 ;
    00473   int bestper = -1;
    00474   int per[3*2][3] = { {0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,0,1},{2,1,0} };
    00475   for(int i = 0; i < 3*2*1; ++i) //all perm.
    00476   {
    00477     double pervalue = time[0][per[i][0]];
    00478     if (pervalue < time[1][per[i][1]])
    00479       pervalue = time[1][per[i][1]];
    00480     if (pervalue < time[2][per[i][2]])
    00481       pervalue = time[2][per[i][2]];
    00482     pervalue = 3*pervalue
    00483       + time[0][per[i][0]]
    00484       + time[1][per[i][1]]
    00485       + time[2][per[i][2]];//longes time*3 + all times
    00486     pervalue = pervalue/6;
    00487     if( pervalue < best)
    00488     {
    00489       best = pervalue;
    00490       bestper = i;
    00491     }
    00492   }
    00493    //select role
    00494   kickoff_role = (BehaviorTeamMessage::DynamicRole)(per[bestper][0]+1);
    00495   //DEBUG_RESPONSE("KickOff:Role:output",OUTPUT(idText,text,"kickoffrole: "<<kickoff_role));
    00496   //DEBUG_RESPONSE("KickOff:time:output:bestper", OUTPUT(idText,text,"per: "<<bestper));
    00497   //DEBUG_RESPONSE("KickOff:time:output:time0", OUTPUT(idText,text,"time0: "<<time[0][per[bestper][0]]));
    00498   //DEBUG_RESPONSE("KickOff:time:output:time1", OUTPUT(idText,text,"time1: "<<time[1][per[bestper][1]]));
    00499   //DEBUG_RESPONSE("KickOff:time:output:time2",OUTPUT(idText,text,"time2: "<<time[2][per[bestper][2]]) );
    00500
    00501   //calculate times
    00502   /* old works only in simulator
    00503   double time[3][3];// 2 player (3 teammate -1 goalie) 3 poses
    00504   Vector2<double> pos = robotPose.translation;
    00505   int num = getPlayer().getPlayerNumber()-1; //playernumber -1
    00506   DEBUG_RESPONSE("KickOff:ownplayernumber",OUTPUT(idText,text,"playernumber: "<< num) );
    00507   for(int j = 0; j < 3; ++j)
    00508   {
    00509     time[num][j] = getTimeToReachKickoffPose( (BehaviorTeamMessage::DynamicRole)(j+1), pos);
    00510     DEBUG_RESPONSE("KickOff:time:output:timetoreach",OUTPUT(idText,text,"time "<<j<<" to reach: "<< time[num][j]) );
    00511   }
    00512   int counter = 0;
    00513   for(int i = 0; i < 3; ++i)
    00514   {
    00515     int num = teamMessageCollection[i].playerNumberOfSender;
    00516     DEBUG_RESPONSE("KickOff:WLan:output:playernumber",
    00517       OUTPUT(idText,text,"playerNumberOfSender "<<num));
    00518     if (num == 0) //calculation no goalie
    00519       continue;
    00520     if (num > 3) //calculation no goalie
    00521       continue;
    00522     num--;
    00523     DEBUG_RESPONSE("KickOff:WLan:output:playernumber",
    00524       OUTPUT(idText,text,"playerNumberOfSender2 "<<num));
    00525     DEBUG_RESPONSE("KickOff:WLan:output:playernumbercounter",
    00526       if(counter>2)
    00527       {
    00528       OUTPUT(idText,text,"error "<<counter)
    00529       OUTPUT(idText,text,"error "<<counter)
    00530       OUTPUT(idText,text,"error "<<counter)
    00531       OUTPUT(idText,text,"error "<<counter)
    00532       OUTPUT(idText,text,"error "<<counter)
    00533       OUTPUT(idText,text,"error "<<counter)
    00534       });
    00535     Vector2<double> pos = teamMessageCollection[i].robotPose.translation;
    00536
    00537     for(int j = 0; j < 3; ++j)
    00538     {
    00539       time[i][j] = getTimeToReachKickoffPose( (BehaviorTeamMessage::DynamicRole)(j+1), pos);
    00540       DEBUG_RESPONSE("KickOff:time:output:timex",
    00541         OUTPUT(idText,text,"time ["<<i<<"]["<<j<<"]: "<<time[i][j]));
    00542     }
    00543   }
    00544   //calculate best permutation
    00545   double best = 99999999999999999 ;
    00546   int bestper = -1;
    00547   int per[3*2][3] = { {0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,0,1},{2,1,0} };
    00548   for(int i = 0; i < 3*2*1; ++i) //all perm.
    00549   {
    00550     double pervalue = time[0][per[i][0]];
    00551     if (pervalue < time[1][per[i][1]])
    00552       pervalue = time[1][per[i][1]];
    00553     if (pervalue < time[2][per[i][2]])
    00554       pervalue = time[2][per[i][2]];
    00555     pervalue = 3*pervalue
    00556       + time[0][per[i][0]]
    00557       + time[1][per[i][1]]
    00558       + time[2][per[i][2]];//longes time*3 + all times
    00559     pervalue = pervalue/6;
    00560     if( pervalue < best)
    00561     {
    00562       best = pervalue;
    00563       bestper = i;
    00564     }
    00565   }
    00566   //select role
    00567   num = getPlayer().getPlayerNumber()-1; //playernumber -1
    00568   DEBUG_RESPONSE("KickOff:ownplayernumber",OUTPUT(idText,text,"playernumber: "<< num) );
    00569   kickoff_role = (BehaviorTeamMessage::DynamicRole)(per[bestper][num]+1);
    00570   DEBUG_RESPONSE("KickOff:Role:output",OUTPUT(idText,text,"kickoffrole: "<<kickoff_role));
    00571   DEBUG_RESPONSE("KickOff:time:output:bestper", OUTPUT(idText,text,"per: "<<bestper));
    00572   DEBUG_RESPONSE("KickOff:time:output:time0", OUTPUT(idText,text,"time0: "<<time[0][per[bestper][0]]));
    00573   DEBUG_RESPONSE("KickOff:time:output:time1", OUTPUT(idText,text,"time1: "<<time[1][per[bestper][1]]));
    00574   DEBUG_RESPONSE("KickOff:time:output:time2",OUTPUT(idText,text,"time2: "<<time[2][per[bestper][2]]) );
    00575 */
    00576
    00577 }
    00578
    00579 double GT2005ConfigurationSymbols::getKickOffRoleNumber()
    00580 {
    00581   return kickoff_role;
    00582 }
    00583