From 016484d07ca7c6516bb47464756b85bf664fc856 Mon Sep 17 00:00:00 2001 From: dufourj Date: Thu, 25 May 2006 01:27:52 +0000 Subject: Ai : - correction dans la classe de test (postcall et wait). --- i/marvin/src/ai/test_ai.cc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'i') diff --git a/i/marvin/src/ai/test_ai.cc b/i/marvin/src/ai/test_ai.cc index 6635ce2..27d32a1 100644 --- a/i/marvin/src/ai/test_ai.cc +++ b/i/marvin/src/ai/test_ai.cc @@ -25,18 +25,32 @@ #include "tester/tester.hh" #include "ai/ai.hh" +#include "timer/timer.hh" -class TestAI : public Tester +class TestAi : public Tester { private: Ai ai_; /// Called after each command void postcall (void) { - // Update ? + while (!ai_.update ()) + ; + } + /// Wait. + void wait (int ms) + { + int t, stop; + t = Timer::getProgramTime (); + stop = t + ms; + while (t < stop) + { + ai_.temporisation (stop - t); + t = Timer::getProgramTime (); + } } public: - TestAI(int argc, char ** argv) + TestAi(int argc, char ** argv) :Tester(argc, argv), ai_(config_) {} void preRun (void) @@ -60,6 +74,8 @@ class TestAI : public Tester interpreter.add("homologation", Interpreter::memFunc(ai_, &Ai::progHomoloRobal), "Programme d'homologation du robal"); + interpreter.add ("_postcall", + Interpreter::memFunc (*this, &TestAi::postcall)); } void postRun(void) { @@ -72,7 +88,7 @@ int main (int argc, char **argv) { try { - TestAI ta(argc, argv); + TestAi ta(argc, argv); ta.run (); } catch (const std::exception &e) -- cgit v1.2.3