summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ai/test_ai.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ai/test_ai.cc')
-rw-r--r--2005/i/robert/src/ai/test_ai.cc101
1 files changed, 79 insertions, 22 deletions
diff --git a/2005/i/robert/src/ai/test_ai.cc b/2005/i/robert/src/ai/test_ai.cc
index f205819..03a1642 100644
--- a/2005/i/robert/src/ai/test_ai.cc
+++ b/2005/i/robert/src/ai/test_ai.cc
@@ -75,24 +75,27 @@ main (int argc, char **argv)
if (++i > argc)
throw std::runtime_error ("syntax error");
switch (argv[i][0])
- {
- case '0':
+ {
+ case '0':
// Pour un robot qui n'est pas fiable en
// asservissement
ai_.runBalNonFiable();
break;
- case '1':
+ case '1':
ai_.runBalFiable ();
break;
- case '2':
+ case '2':
ai_.runTest ();
break;
- case '3':
+ case '3':
ai_.runProtectFond ();
break;
- default:
+ case '4':
+ ai_.runVisionLine ();
+ break;
+ default:
throw std::runtime_error ("Param inconnue");
- }
+ }
break;
case 'j':
if(++i > argc)
@@ -130,34 +133,88 @@ main (int argc, char **argv)
ai_.rotation(strtod(argv[i], 0));
break;
case 'A':
- if(++i + 1 > argc)
+ if(++i > argc)
throw std::runtime_error("syntax error");
-// switch(argv[i])
-// {
-// case '0':
-// ai.moveAsc(BAS);
-// break;
-// case '1':
-// ai.moveAsc(MILIEU);
-// break;
-// case '2':
-// ai.moveAsc(HAUT);
-// break;
-// }
+ switch(argv[i][0])
+ {
+ case '0':
+ ai_.ascenceur(false);
+ break;
+ case '1':
+ ai_.ascenceur(true);
+ break;
+ default:
+ throw std::runtime_error ("Param inconnue");
+ break;
+ }
break;
case 'v':
ai_.ventouses();
break;
case 'U':
- ai_.update();
+ while (!ai_.update());
break;
case 'z':
ai_.init();
break;
+ case 't':
+ if(++i > argc)
+ throw std::runtime_error("syntax error");
+ ai_.temporisation (argv[i][0]);
+ case 'o':
+ if(++i > argc)
+ throw std::runtime_error("syntax error");
+ switch (argv[i][0])
+ {
+ case '0':
+ while (true)
+ {
+ while (!ai_.update ());
+ if (ai_.objectInFront())
+ std::cout << "Objet devant" << std::endl;
+ else
+ std::cout << "Pas d'objet devant" << std::endl;
+ }
+ break;
+ case '1':
+ while (!ai_.update ());
+ if (ai_.objectInFront())
+ std::cout << "Objet devant" << std::endl;
+ else
+ std::cout << "Pas d'objet devant" << std::endl;
+ }
+ break;
+ case 'c':
+ if(++i > argc)
+ throw std::runtime_error("syntax error");
+ switch (argv[i][0])
+ {
+ case '0':
+ while (true)
+ {
+ while (!ai_.update ());
+ if (ai_.colorBouton())
+ std::cout << "Couleur vraie" << std::endl;
+ else
+ std::cout << "Couleur faux" << std::endl;
+ }
+ break;
+ case '1':
+ while (!ai_.update ());
+ if (ai_.colorBouton())
+ std::cout << "Couleur V" << std::endl;
+ else
+ std::cout << "Couleur F" << std::endl;
+ break;
+ default:
+ throw std::runtime_error ("Param inconnue");
+ }
+ break;
+ break;
default:
throw std::runtime_error ("Error de syntaxe");
}
- ai_.update ();
+ ai_.update (); // XXX à virer ?
break;
}
case 'w':