[Orxonox-commit 4120] r8791 - code/branches/ai2/src/orxonox/controllers

jo at orxonox.net jo at orxonox.net
Tue Jul 26 23:41:45 CEST 2011


Author: jo
Date: 2011-07-26 23:41:45 +0200 (Tue, 26 Jul 2011)
New Revision: 8791

Modified:
   code/branches/ai2/src/orxonox/controllers/AIController.cc
   code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
Log:
Bug is triggered in AIController.cc @ line 243. Can't find the reason at the moment.

Modified: code/branches/ai2/src/orxonox/controllers/AIController.cc
===================================================================
--- code/branches/ai2/src/orxonox/controllers/AIController.cc	2011-07-26 21:21:43 UTC (rev 8790)
+++ code/branches/ai2/src/orxonox/controllers/AIController.cc	2011-07-26 21:41:45 UTC (rev 8791)
@@ -119,10 +119,11 @@
                 this->boostControl();
 
             // update Checkpoints
-            random = rnd(maxrand);
+            /*random = rnd(maxrand);
             if (this->defaultWaypoint_ && random > (maxrand-10))
                 this->manageWaypoints();
-            else //if(random > maxrand-10) //CHECK USABILITY!!
+            else //if(random > maxrand-10) //CHECK USABILITY!!*/
+            if (this->waypoints_.size() == 0 )
                 this->manageWaypoints();
 
         }
@@ -213,10 +214,11 @@
                     this->boostControl();
 
                 // update Checkpoints
-                random = rnd(maxrand);
+                /*random = rnd(maxrand);
                 if (this->defaultWaypoint_ && random > (maxrand-10))
                     this->manageWaypoints();
-                else //if(random > maxrand-10) //CHECK USABILITY!!
+                else //if(random > maxrand-10) //CHECK USABILITY!!*/
+                if (this->waypoints_.size() == 0 )
                     this->manageWaypoints();
             }
         }
@@ -236,10 +238,12 @@
         {
             if (this->waypoints_.size() > 0 ) //Waypoint functionality.
             {
-                if (this->waypoints_[this->waypoints_.size()-1]->getWorldPosition().squaredDistance(controllable->getPosition()) <= this->squaredaccuracy_)
+                WorldEntity* wPoint = this->waypoints_[this->waypoints_.size()-1];
+                if(wPoint)
+                    this->moveToPosition(wPoint->getWorldPosition()); //BUG ?? sometime wPoint->getWorldPosition() causes crash
+                if (wPoint->getWorldPosition().squaredDistance(controllable->getPosition()) <= this->squaredaccuracy_)
                     this->waypoints_.pop_back(); // if goal is reached, remove it from the list
-                if(this->waypoints_.size() > 0 )
-                    this->moveToPosition(this->waypoints_[this->waypoints_.size()-1]->getWorldPosition());
+
             }
             else if(this->defaultWaypoint_ && ((this->defaultWaypoint_->getPosition()-controllable->getPosition()).length()  > 200.0f))
             {

Modified: code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/ai2/src/orxonox/controllers/ArtificialController.cc	2011-07-26 21:21:43 UTC (rev 8790)
+++ code/branches/ai2/src/orxonox/controllers/ArtificialController.cc	2011-07-26 21:41:45 UTC (rev 8791)
@@ -95,7 +95,7 @@
         this->mode_ = DEFAULT;////Vector-implementation: mode_.push_back(DEFAULT);
         this->timeout_ = 0;
         this->currentWaypoint_ = 0;
-        this->setAccuracy(9);
+        this->setAccuracy(5);
         this->defaultWaypoint_ = NULL;
     }
 




More information about the Orxonox-commit mailing list