From 994270d9db219b565fcf940c6214e046f91aba35 Mon Sep 17 00:00:00 2001 From: haller Date: Tue, 3 May 2005 23:28:11 +0000 Subject: Implémentation des scheduler dans ai --- 2005/i/robert/src/ai/ai.cc | 11 ++++++++++- 2005/i/robert/src/ai/ai.hh | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to '2005') diff --git a/2005/i/robert/src/ai/ai.cc b/2005/i/robert/src/ai/ai.cc index 7331d8c..cdb9d4c 100644 --- a/2005/i/robert/src/ai/ai.cc +++ b/2005/i/robert/src/ai/ai.cc @@ -25,12 +25,21 @@ #include"ai.hh" +static void +callback (void) +{ +} + /// Constructeur Ai::Ai(const Config & config) :motor_(config), es_(config), roundDuration_(config.get("ai.roundDuration")), - vitesseAsc_(config.set("ai.vitesseAsc")) + vitesseAsc_(config.set("ai.vitesseAsc")), + schedulableMotor_ (callback, motor_.getFd ()), + schedulableEs_ (callback, es_.getFd ()) { + scheduler_.insert (schedulableMotor_); + scheduler_.insert (schedulableEs_); } /// Initialise le robot diff --git a/2005/i/robert/src/ai/ai.hh b/2005/i/robert/src/ai/ai.hh index 68a99b9..a349ca4 100644 --- a/2005/i/robert/src/ai/ai.hh +++ b/2005/i/robert/src/ai/ai.hh @@ -40,6 +40,8 @@ class Ai ovision_ ov_; // Scheduler du robot scheduler::Scheduler scheduler_; + scheduler::SchedulableReadFd schedulableMotor_; + scheduler::SchedulableReadFd schedulableEs_; // Paramètre de Ai const int roundDuration_; const int vitesseAsc_; @@ -67,7 +69,7 @@ class Ai /// Rotation. void rotation (double a); /// Monte(vrai) ou descend(faux) l'ascenceur - void ascenceur (stateAsc monte); + void ascenceur (bool monte); /// Désactive les ventouse void ventouses (void); /// Attend une mise à jour -- cgit v1.2.3