summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/test_ovision.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/test_ovision.cc')
-rw-r--r--2005/i/robert/src/ovision/see/test_ovision.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/2005/i/robert/src/ovision/see/test_ovision.cc b/2005/i/robert/src/ovision/see/test_ovision.cc
new file mode 100644
index 0000000..82a236c
--- /dev/null
+++ b/2005/i/robert/src/ovision/see/test_ovision.cc
@@ -0,0 +1,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 (1);
+ }
+ return 0;
+}
+