Changeset 8791 for code/branches
- Timestamp:
- Jul 26, 2011, 11:41:45 PM (13 years ago)
- Location:
- code/branches/ai2/src/orxonox/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/src/orxonox/controllers/AIController.cc
r8786 r8791 120 120 121 121 // update Checkpoints 122 random = rnd(maxrand);122 /*random = rnd(maxrand); 123 123 if (this->defaultWaypoint_ && random > (maxrand-10)) 124 124 this->manageWaypoints(); 125 else //if(random > maxrand-10) //CHECK USABILITY!! 125 else //if(random > maxrand-10) //CHECK USABILITY!!*/ 126 if (this->waypoints_.size() == 0 ) 126 127 this->manageWaypoints(); 127 128 … … 214 215 215 216 // update Checkpoints 216 random = rnd(maxrand);217 /*random = rnd(maxrand); 217 218 if (this->defaultWaypoint_ && random > (maxrand-10)) 218 219 this->manageWaypoints(); 219 else //if(random > maxrand-10) //CHECK USABILITY!! 220 else //if(random > maxrand-10) //CHECK USABILITY!!*/ 221 if (this->waypoints_.size() == 0 ) 220 222 this->manageWaypoints(); 221 223 } … … 237 239 if (this->waypoints_.size() > 0 ) //Waypoint functionality. 238 240 { 239 if (this->waypoints_[this->waypoints_.size()-1]->getWorldPosition().squaredDistance(controllable->getPosition()) <= this->squaredaccuracy_) 241 WorldEntity* wPoint = this->waypoints_[this->waypoints_.size()-1]; 242 if(wPoint) 243 this->moveToPosition(wPoint->getWorldPosition()); //BUG ?? sometime wPoint->getWorldPosition() causes crash 244 if (wPoint->getWorldPosition().squaredDistance(controllable->getPosition()) <= this->squaredaccuracy_) 240 245 this->waypoints_.pop_back(); // if goal is reached, remove it from the list 241 if(this->waypoints_.size() > 0 ) 242 this->moveToPosition(this->waypoints_[this->waypoints_.size()-1]->getWorldPosition()); 246 243 247 } 244 248 else if(this->defaultWaypoint_ && ((this->defaultWaypoint_->getPosition()-controllable->getPosition()).length() > 200.0f)) -
code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
r8786 r8791 96 96 this->timeout_ = 0; 97 97 this->currentWaypoint_ = 0; 98 this->setAccuracy( 9);98 this->setAccuracy(5); 99 99 this->defaultWaypoint_ = NULL; 100 100 }
Note: See TracChangeset
for help on using the changeset viewer.