BeoHead.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef BeoHead_H_DEFINED
00039 #define BeoHead_H_DEFINED
00040
00041 #include "Component/ModelComponent.H"
00042 #include "Component/ModelParam.H"
00043 #include "Devices/Pololu.H"
00044 #include "Controllers/PID.H"
00045 #include "Util/Types.H"
00046 #include <deque>
00047 #include <pthread.h>
00048 #include <stdarg.h>
00049
00050 class BeoHead : public ModelComponent
00051 {
00052 public:
00053
00054 BeoHead(OptionManager& mgr,
00055 const std::string& descrName = "BeoHead",
00056 const std::string& tagName = "BeoHead");
00057
00058 bool setLeftEyePan(float pos);
00059 bool setLeftEyeTilt(float pos);
00060 bool setRightEyePan(float pos);
00061 bool setRightEyeTilt(float pos);
00062
00063 bool setHeadPan(float pos);
00064 bool setHeadTilt(float pos);
00065 bool setHeadYaw(float pos);
00066
00067
00068 float getLeftEyePanPos(){ return itsLeftEyePanPos; }
00069 float getRightEyeTiltPos(){ return itsRightEyeTiltPos;}
00070 float getRightEyePanPos(){ return itsRightEyePanPos; }
00071 float getLeftEyeTiltPos(){ return itsLeftEyeTiltPos; }
00072 float getHeadPanPos(){ return itsHeadPanPos; }
00073 float getHeadTiltPos(){ return itsHeadTiltPos; }
00074 float getHeadYawPos(){ return itsHeadYawPos; }
00075
00076
00077 bool relaxNeck();
00078 bool relaxHead();
00079 bool moveRestPos();
00080
00081
00082 float trackTarget(float desiredVisualPosX, float desiredVisualPosY,
00083 float currentVisualPosX, float currentVisualPosY);
00084
00085
00086 void start2();
00087
00088 void initHead();
00089
00090
00091 static const byte LEFT_EYE_PAN = 2;
00092 static const byte LEFT_EYE_TILT = 1;
00093 static const byte RIGHT_EYE_PAN = 0;
00094 static const byte RIGHT_EYE_TILT = 3;
00095
00096 static const byte HEAD_PAN = 6;
00097 static const byte HEAD_LEFT = 7;
00098 static const byte HEAD_RIGHT = 5;
00099
00100 private:
00101
00102 nub::soft_ref<Pololu> itsPololu;
00103
00104 float itsLeftEyePanPos;
00105 float itsRightEyeTiltPos;
00106 float itsRightEyePanPos;
00107 float itsLeftEyeTiltPos;
00108 float itsHeadPanPos;
00109 float itsHeadTiltPos;
00110 float itsHeadYawPos;
00111
00112 PID<float> pidLeftPan;
00113 PID<float> pidLeftTilt;
00114 PID<float> pidHeadPan;
00115
00116
00117 bool isNeckRelaxed;
00118 };
00119
00120
00121 #endif
00122
00123
00124
00125
00126
00127