summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/test_ovision.cc
blob: 88cb6fe6fefde5c5d96af6fa0b316f085213a7d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <stdlib.h>
#include <unistd.h>

#include "ovision.hh"

int 
main(int argv, char **argc)
{
    if (argv != 2)
      {
	std::cerr << "Usage : ./test_ovision {red, green}" << std::endl;
	return 1;
      }
    std::string arg (argc[1]);
    Group::ZoneType aim;
    if (arg == "red")
	aim = Group::redSkittle;
    else if (arg == "green")
	aim = Group::greenSkittle;
    else 
      {
	aim = Group::undefined;
	std::cerr << "Echec critique !" << std::endl;
      }
    OVision ovision;
    ovision.init (aim);
    while (1)
      {
	// Prends une image
	ovision.takeShoot ();
	// Analyse une image
	ovision.update ();
	// Affiche d'info sur l'update
//	ovision.showInfo ();
	// Affiche les coordonn�es de la premi�re balle
	double x, y;
//	if (ovision.getBall (x, y))
//	    std::cout << x <<"----" << y << std::endl;
	sleep (5);
      }
    return 0;
}