From 032165203253df50890cf9a43d373d86792f3a21 Mon Sep 17 00:00:00 2001 From: schodet Date: Sat, 15 Nov 2003 22:46:05 +0000 Subject: Initial revision --- .../src/communication_asservissement_control.h | 48 +++++++++++++++++ i/siroco/src/communication_asservissement_data.h | 54 +++++++++++++++++++ i/siroco/src/communication_hub.h | 44 +++++++++++++++ i/siroco/src/communication_module.h | 40 ++++++++++++++ i/siroco/src/message.h | 62 ++++++++++++++++++++++ i/siroco/src/message_asservissement_control.h | 46 ++++++++++++++++ i/siroco/src/message_asservissement_data.h | 57 ++++++++++++++++++++ i/siroco/src/message_asservissement_get_info.h | 41 ++++++++++++++ i/siroco/src/message_asservissement_info.h | 50 +++++++++++++++++ 9 files changed, 442 insertions(+) create mode 100644 i/siroco/src/communication_asservissement_control.h create mode 100644 i/siroco/src/communication_asservissement_data.h create mode 100644 i/siroco/src/communication_hub.h create mode 100644 i/siroco/src/communication_module.h create mode 100644 i/siroco/src/message.h create mode 100644 i/siroco/src/message_asservissement_control.h create mode 100644 i/siroco/src/message_asservissement_data.h create mode 100644 i/siroco/src/message_asservissement_get_info.h create mode 100644 i/siroco/src/message_asservissement_info.h (limited to 'i/siroco') diff --git a/i/siroco/src/communication_asservissement_control.h b/i/siroco/src/communication_asservissement_control.h new file mode 100644 index 0000000..3e797ee --- /dev/null +++ b/i/siroco/src/communication_asservissement_control.h @@ -0,0 +1,48 @@ +#ifndef communication_asservissement_control_h +#define communication_asservissement_control_h +// communication_asservissement_control.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} + +class CommunicationAsservissementControl +{ + class Connector + { + public: + // Envoie les inforamtions de PID à l'objet. + virtual void recvPID (int p, int i, int d) = 0; + }; + Connector &connector_; + public: + // Paramètre le connecteur. + void setConnector (Connector &c); + // Recoie un message. + void recv (const Message &m); + // Envoie des messages de changement de Coef. + void coefP (int val) const; + void coefI (int val) const; + void coefD (int val) const; +}; + +#endif // communication_asservissement_control_h diff --git a/i/siroco/src/communication_asservissement_data.h b/i/siroco/src/communication_asservissement_data.h new file mode 100644 index 0000000..8c8eb31 --- /dev/null +++ b/i/siroco/src/communication_asservissement_data.h @@ -0,0 +1,54 @@ +#ifndef communication_asservissement_data_h +#define communication_asservissement_data_h +// communication_asservissement_data.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} + +class CommunicationAsservissementData +{ + // Classe de connection entre CommunicationAsservissementData et un autre + // objet. + class Connector + { + public: + // Recoit des données d'asservissement. + virtual void recvData (int consign, int pwm, int measure) = 0; + // Recoit les minimas et les maxima. + virtual void recvMinMax (int consignMin, int pwmMin, int measureMin, + int consignMax, int pwmMax, int measureMax) + = 0; + }; + Connector &connector_; + public: + // Destructeur. + ~CommunicationModule (void); + // Paramètre le connecteur. + void setConnector (Connector &c); + // Recoie un message. + void recv (const Message &m); + // Active (true) ou désactive (false) le module. + void activate (bool flag = true); +}; + +#endif // communication_asservissement_data_h diff --git a/i/siroco/src/communication_hub.h b/i/siroco/src/communication_hub.h new file mode 100644 index 0000000..d705d1d --- /dev/null +++ b/i/siroco/src/communication_hub.h @@ -0,0 +1,44 @@ +#ifndef communication_hub_h +#define communication_hub_h +// communication_hub.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} +#include "message.h" + +#include + +class CommunicationHub +{ + typedef std::list moduleList_type; + moduleList_type moduleList_; + public: + // Enregistre un module. + void add (CommunicationModule &m); + // Unregister a module. + void remove (CommunicationModule &m); + // Envoie un message à tout le monde sauf à soit même. + void send (CommunicationModule &sender, Message &m); +}; + +#endif // communication_hub_h diff --git a/i/siroco/src/communication_module.h b/i/siroco/src/communication_module.h new file mode 100644 index 0000000..865b882 --- /dev/null +++ b/i/siroco/src/communication_module.h @@ -0,0 +1,40 @@ +#ifndef communication_module_h +#define communication_module_h +// communication_module.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} +#include "message.h" + +class CommunicationModule +{ + public: + // Destructeur. + virtual ~CommunicationModule (void); + // Recoie un message. + virtual void recv (const Message &m); + // Active (true) ou désactive (false) le module. + virtual void activate (bool flag = true); +}; + +#endif // communication_module_h diff --git a/i/siroco/src/message.h b/i/siroco/src/message.h new file mode 100644 index 0000000..e5ad1fc --- /dev/null +++ b/i/siroco/src/message.h @@ -0,0 +1,62 @@ +#ifndef message_h +#define message_h +// message.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} + +namespace Siroco +{ + +class Message +{ + // Type du message contenu. + enum Type + { + typeAsservissementData, + typeAsservissementControl, + typeAsservissementGetInfo, + typeAsservissementInfo, + typeMax + }; + private: + Type type_; + public: + // Constructeur. + Message (Type type); + // Destructeur et Big 3. + virtual ~Message (void); + // Récupère le type du message. + Type getType (void) const; + // Récupère le message. + template + const T &get (void) const; + private: + // Méthodes interdites. + Message (const Message &); + Message &operator= (const Message &); +}; + +}; + +#endif // message_h diff --git a/i/siroco/src/message_asservissement_control.h b/i/siroco/src/message_asservissement_control.h new file mode 100644 index 0000000..f460656 --- /dev/null +++ b/i/siroco/src/message_asservissement_control.h @@ -0,0 +1,46 @@ +#ifndef message_asservissement_control_h +#define message_asservissement_control_h +// message_asservissement_control.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} +#include "message.h" + +namespace Siroco +{ + +// Message de modification des coefficients de PID. +class MessageAsservissementControl : public Message +{ + char type_; + int val_; + public: + // Constructeur. + MessageAsservissementControl (char type, int val); + // Récupère les valeurs. + void get (char &type, int &val) const; +}; + +}; + +#endif // message_asservissement_control_h diff --git a/i/siroco/src/message_asservissement_data.h b/i/siroco/src/message_asservissement_data.h new file mode 100644 index 0000000..915fab2 --- /dev/null +++ b/i/siroco/src/message_asservissement_data.h @@ -0,0 +1,57 @@ +#ifndef message_asservissement_data_h +#define message_asservissement_data_h +// message_asservissement_data.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} +#include "message.h" + +namespace Siroco +{ + +class MessageAsservissementData : public Message +{ + struct Point + { + int consign, pwm, measure; + // Constructeur d'aisance (hey, hey !). + Point (int c, int p, int m); + }; + typedef std::list pointList_type; + typedef pointList_type::iterator iterator; + typedef iterator const_iterator; + private: + pointList_type pointList_; + public: + // Constructeur. + MessageAsservissementData (void); + // Récupère les iterators de début et de fin. + iterator begin (void) const; + iterator end (void) const; + // Ajoute des points. + void add (int c, int p, int m); +}; + +}; + +#endif // message_asservissement_data_h diff --git a/i/siroco/src/message_asservissement_get_info.h b/i/siroco/src/message_asservissement_get_info.h new file mode 100644 index 0000000..191f264 --- /dev/null +++ b/i/siroco/src/message_asservissement_get_info.h @@ -0,0 +1,41 @@ +#ifndef message_asservissement_get_info_h +#define message_asservissement_get_info_h +// message_asservissement_get_info.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} +#include "message.h" + +namespace Siroco +{ + +class MessageAsservissementGetInfo : public Message +{ + public: + // Constructor. + MessageAsservissementGetInfo (void); +}; + +}; + +#endif // message_asservissement_get_info_h diff --git a/i/siroco/src/message_asservissement_info.h b/i/siroco/src/message_asservissement_info.h new file mode 100644 index 0000000..0075cae --- /dev/null +++ b/i/siroco/src/message_asservissement_info.h @@ -0,0 +1,50 @@ +#ifndef message_asservissement_info_h +#define message_asservissement_info_h +// message_asservissement_info.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// 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. +// +// }}} +#include "message.h" + +namespace Siroco +{ + +class MessageAsservissementInfo : public Message +{ + int p_, i_, d_; + int consignMin_, pwmMin_, measureMin_; + int consignMax_, pwmMax_, measureMax_; + public: + // Constructeur. + MessageAsservissementInfo (int p, int i, int d, int consignMin, int + pwmMin, int measureMin, int consignMax, int + pwmMax, int measureMax); + // Récupère les données. + void getPID (int &p, int &i, int &d) const; + void getMinMax (int &consignMin, int &pwmMin, int &measureMin, int + &consignMax, int &pwmMax, int &measureMax) const; +}; + +}; + +#endif // message_asservissement_info_h -- cgit v1.2.3