Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Composants | Déclarations

ServoMotor.h

Aller à la documentation de ce fichier.
00001 /***************************************************************************
00002                           ServoMotor.h  -  description
00003                              -------------------
00004     begin                : ven jun 08 2003
00005     copyright            : (C) 2003 by Michel Dubois, Yann Le Guyadec
00006     email                : Michel.Dubois@univ-ubs.fr, Yann.Le-Guyadec@univ-ubs.fr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 
00019 // Modèle statique
00020 /*
00021   * changes :
00022   *  - 08/06/03 MD Creation !
00023   */
00024 
00025 
00026 #ifndef __SERVOMOTOR__
00027 #define __SERVOMOTOR__
00028 
00029 
00030 // Include files
00031 #include "Leg.h"
00032 #include "SimServoMotor.h"
00033 
00034 #define KEEP           0
00035 #define REPLACE        1
00036 
00037 class SimServoMotor;
00038 
00039 namespace API {
00040 
00041   class Leg;
00049   class ServoMotor
00050   {
00051     friend class Leg;
00052     friend class Atom;
00053     class Util;
00054     friend class Util;
00055 
00056     public:
00065       class Util {
00066         friend class ServoMotor;
00067         friend class Leg;
00068         friend class Atom;
00069         private:
00070           SimServoMotor * simservo;
00071           ServoMotor * servo;
00072           Util(ServoMotor * servo);
00073           ~Util();
00074         public:
00078           void print() const;
00079           
00084           SimServoMotor * getSimulatedObject() const;
00085 
00086         protected:
00092           void setSimulatedObject(SimServoMotor * aSimServoMotor );
00093       };
00094 
00099       Util * util;
00100       private:
00101       Leg * leg;
00102       int servoID;
00103       int targetPos;
00104       int targetVelocity;
00105     
00106     public:
00112       int     getID() const;
00113 
00119       Leg *   getLeg() const;
00120       
00126         int     getTargetPosition() const;  // [SERVO_MOTOR_MIN_POS..SERVO_MOTOR_MAX_POS]
00127 
00133         double  getTargetAngle() const;
00134 
00140       double  getTargetVelocity() const;  // en radians/sec
00141 
00147       double  getTargetForce() const;
00148       
00154       int     getCurrentPosition() const;
00155       
00161         double  getCurrentVelocity() const;
00162 
00168       double  getCurrentForce() const;
00169       
00175         double  getCurrentAngle() const;
00176       
00182       double  getHighStopAngle() const;
00183 
00189         double  getLowStopAngle() const;
00190 
00196       int     getMinPosition() const;
00197 
00203       int     getMaxPosition() const;
00204 
00213       void    setToHalfPosition(int mode=KEEP, Real deltaTime=0,unsigned int index=0);
00214 
00223       void    setTargetAngle(double aTargetAngle, int mode=KEEP, Real deltaTime=0,unsigned int index=0);
00224 
00233       void    setTargetPosition(int aTargetPosition, int mode=KEEP, Real deltaTime=0,unsigned int index=0);
00234 
00243       void    setTargetVelocity(int aTargetVelocity, int mode=KEEP, Real deltaTime=0,unsigned int index=0);
00244 
00253       void    setTargetForce(double aTargetForce, int mode=KEEP, Real deltaTime=0,unsigned int index=0);
00254 
00258       void    stop();
00259 
00260     protected:
00265       ServoMotor();
00270       ~ServoMotor();
00271 
00276       void    setID(int aServoMotorID);
00277 
00282       void    setLeg(Leg * aLeg);
00283     
00284   };// END CLASS DEFINITION ServoMotor
00285 }
00286 #endif // __SERVOMOTOR__

Généré le Mon Mar 1 01:29:41 2004 par doxygen 1.3.3