void LocalizationTeamBallProvider2014::update(LocalizationTeamBall& localizationTeamBall)
{
  // Initialize representation
  localizationTeamBall.isValid = false;
  hypotheses.clear();
  goalieSawTheBall = false;

  // Gather new information from all teammates
  updateObservations();

  // Cluster observations
  clusterObservations();

  // Compute representation
  computeTeamBallFromBestCluster(localizationTeamBall);
}
Exemplo n.º 2
0
/* Updates the observations and the mc filter if the robot is on the move or 
 * changed it's position since last update 
 */
void Localization::update() {
  if (!isDestinationSet() && !isGlobalCameraAvailable() ){
    //cout << "updating observations" << endl;
    updateObservations();
  }

  //if ( obs.size() > 0 ) 
  //  displayObservationSummary();
  
  Move lastMove = getLastMove();
  //if ( lastMove.getX() + lastMove.getY() + lastMove.getTheta() != 0 ) 
  //  cout << "lastMove(" << lastMove.getX() << "," << lastMove.getY() << "," << lastMove.getTheta() << ")" << endl ;
  if ( isGlobalCameraAvailable() ){
    if ( lastMove.getX() + lastMove.getY() + lastMove.getTheta() != 0 ){
      currentPos.moveRelative(lastMove);
    }
  }
  else if (obs.size() > 0 || lastMove.getX() + lastMove.getY() + lastMove.getTheta() != 0) {
    cout << "applying filter" << endl;
    mc->updateFilter(lastMove, obs);
  }
}