From ac7a3ff340bcbbcb43318d7ace513806882b309c Mon Sep 17 00:00:00 2001 From: dufourj Date: Thu, 5 May 2005 13:58:19 +0000 Subject: Ai du premier match : rectangle --- 2005/i/robert/src/ai/ai.cc | 9 ++++++++- 2005/i/robert/src/socket/test_server.cc | 4 ++++ 2005/i/robert/src/socket/test_socket.cc | 11 ++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to '2005') diff --git a/2005/i/robert/src/ai/ai.cc b/2005/i/robert/src/ai/ai.cc index 34eb75d..4ae0184 100644 --- a/2005/i/robert/src/ai/ai.cc +++ b/2005/i/robert/src/ai/ai.cc @@ -125,6 +125,7 @@ void Ai::run(void) // on lance le temps std::cout << "Lancmeent du match" << std::endl; Timer::startRound(); + /* // On temporise pour laisser Taz sortir std::cout << "Attente du 15 secondes" << std::endl; temporisation(15000); ///XXX @@ -147,7 +148,7 @@ void Ai::run(void) // On va derière les quilles std::cout << "GoTo" << std::endl; goTo(motor_.getX(),motor_.getY() - 150 ,M_PI); -/* // On set la vitesse à 2 + // On set la vitesse à 2 int MaxLSpeedConf = motor_.getMaxLSpeed(); std::cout << "Reduction vitesse" << std::endl; motor_.setMaxSpeed(2, -1); @@ -158,6 +159,12 @@ void Ai::run(void) std::cout << "Acceleration vitesse" << std::endl; motor_.setMaxSpeed(MaxLSpeedConf, -1); // XXX On temporise et on fait mumuse avec l'ascenceur */ + temporisation (30000); + basic ( 600 ); + rotation ( - M_PI / 2 ); + basic ( 300 ); + rotation ( M_PI ); + basic ( 450 ); // On a fini notre run std::cout << "On a fini" << std::endl; } diff --git a/2005/i/robert/src/socket/test_server.cc b/2005/i/robert/src/socket/test_server.cc index 40224a7..81399ec 100644 --- a/2005/i/robert/src/socket/test_server.cc +++ b/2005/i/robert/src/socket/test_server.cc @@ -47,6 +47,10 @@ main (int argc, char **argv) st.nonblock (); // DataBuffer de reception DataBuffer db; + uint8_t c = 'a'; + DataBuffer dbAskImg (&c, 1, 1, DataBuffer::AskImage); + st << dbAskImg; + st.send (); // Reception des données while (!st.recv ()); st >> db; diff --git a/2005/i/robert/src/socket/test_socket.cc b/2005/i/robert/src/socket/test_socket.cc index 01c853a..f2beb51 100644 --- a/2005/i/robert/src/socket/test_socket.cc +++ b/2005/i/robert/src/socket/test_socket.cc @@ -48,13 +48,18 @@ main (int argc, char **argv) // Ecriture des données du fichier dans le buffer DataBuffer db (&img[0], img.size (), img.size (), DataBuffer::Image); + DataBuffer dbAnswer; // Création du socket char *h = argv[1]; SocketText st (Address (h, atoi (argv[2]))); st.nonblock (); - // Envoie des données - st << db; - while (st.send () != 0); + st >> dbAnswer; + if (dbAnswer.type () == DataBuffer::AskImage) + { + // Envoie des données + st << db; + while (st.send () != 0); + } } catch (const std::runtime_error &r) { -- cgit v1.2.3