summaryrefslogtreecommitdiff
path: root/i/chuck/src/ai/ai.hh
blob: 7241c252bcc9e184fa8b7780388dec623f032b7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef ai_hh
#define ai_hh
// ai.hh
// chuck - programme du robot 2007 {{{
//
// Copyright (C) 2007 Romain Becquet
//
// Robot APB Team/Efrei 2007.
//        Web: http://assos.efrei.fr/si2e/
//      Email: si2e AT efrei DOT frr
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// }}}
/// Intelligence sup�rieur(� celui d'une balle de ping-pong) artificielle
/// (comme une blonde) du robot.

#include "motor/motor.hh"
#include "es/es.hh"
#include "scheduler/scheduler.hh"
#include "scheduler/schedulable_read_fd.hh"
#include "log/log.hh"

class Ai
{
  private:
    // Modules de contr�les du robot
    Motor motor_;
    Es es_;
    /// Logger
    Log log_;
    // Le scheduler
    scheduler::Scheduler scheduler_;
    scheduler::SchedulableReadFd schedulableMotor_;
    scheduler::SchedulableReadFd schedulableEs_;
    // Param�tres g�n�rales du robot
    const int round_duration_;
    const int schedule_time_;
    const int reference_sensor_mask_;
    bool mustRotate_;
    const int coefcolor;
  public:
    /// Constructeur
    Ai(const Config & config);
    /// Destructeur du robot
    ~Ai(void);
    
    /// Initialisation du robal
    void init(void);
    /// Arr�te compl�tement le robot
    void stop(void);
    /// Fonction de tempo
    void temporisation (int msec);
    /// Attend le jack rentre(false) ou sorte (true)
    void waitJack (bool out);
    /// Attend une mise � jour...
    bool update (void);
    /// La c�l�bre fonction sync
    bool sync (void);
    /// Init things for a match.
    void prepare (void);
    /// Some after after a match
    void afterMatch(void);
    /// programme de match du robal
    void progMatch(void);
    void progHomoloRobal(void);
    bool motorMove (int d, int a);
    void motorRotate (double d);
    void motorDeblock(void);
    void avoidrobot(void);
};
#endif // ai_hh