Ejemplo n.º 1
0
task autonomous()
{

	repat();
	stopper();
	repat();
	stopper();
	repat();
	stopper();
	repat();
	wait1Msec(4000);
	shoot(0);
	intaked(0);

}
Ejemplo n.º 2
0
void runCloseTest(bool abortive) {
  Server server;

  int sock = createConnectedSocket(server.port());

  std::thread stopper([&server, abortive] {
    std::this_thread::sleep_for(std::chrono::milliseconds(200));
    server.stop(abortive);
    server.join();
  });

  char c;
  int r = read(sock, &c, 1);
  if (abortive) {
    int e = errno;
    EXPECT_EQ(-1, r);
    EXPECT_EQ(ECONNRESET, e);
  } else {
    EXPECT_EQ(0, r);
  }

  close(sock);

  stopper.join();

  EXPECT_EQ(0, server.closeClients(false));  // closed by server when it exited
}
Ejemplo n.º 3
0
	task autonomous()
	{

		driver(127);
		wait1Msec(8000);
		driver(0);
		intaked(-127);
		wait1Msec(4000);
		stopper();
	}
Ejemplo n.º 4
0
int main(int argc, char** argv)
{
  if(argc < 2)
  {
    std::cout << "Podaj nazwe pliku z danymi proby jako argument" << std::endl;
    return 1;
  }
   
  Options opt(argv[1]);  
  double mVariance = opt.mutationVariance();
  double mutationFactor = opt.mutationFactor();
  double crossFactor = opt.crossFactor();
  double goalValue = opt.goalValue();
  int popSize = opt.populationSize();
  int dims = opt.dims();
  bool runStopThread = opt.stopThread();
  MultiDimGauss gauss = opt.getFF();

  if(dims == 2)
  {
    std::cout << "Generating gauss.dat - grid data file for gnuplot with"
              << " fitness function values..." << std::endl;
    gauss.saveAsGridData("presentation/data/gauss.dat", 3, 0.05);
    std::cout << "Grid data file generated." << std::endl << std::endl;
  }
  else
  {
    std::cout << "Grid data generating skiped becouse dims != 2 (dims = " 
              << dims << ")." << std::endl;
  }

  FunctionValue goal(goalValue, gauss); 
  evol::SubjectPtr prototype((evol::Subject*) new MultiDimPoint(dims, gauss, mVariance));
  MyPopulation pop((FitnessFunction&) goal, prototype, popSize, mutationFactor, crossFactor);
  pop.registerObserver( NObserverPtr( new PodgladPostepu() ) );

  if(runStopThread)
  {
    Stopper stopper(pop);
    boost::thread stThread(stopper);
    std::cout << "Type 'stop' in console to stop evaluation after current generation" << std::endl;
  }

  pop.start();
  return 0;
}