00001 00005 #ifndef motorsControl_h 00006 #define motorsControl_h 00007 00008 #include <WProgram.h> 00009 #include <motors.h> 00010 00011 /* 00012 motorsControl.h - Library for controling motors 00013 from Faulhaber (with RS232 link) 00014 00015 00016 Copyright (c) 2011 David Drissi. All right reserved. 00017 Property of the University of Angers. 00018 00019 Contact : philippe.lucidarme@univ-angers.fr 00020 00021 This library is distributed in the hope that it will be useful, 00022 but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 Lesser General Public License for more details. 00025 */ 00026 00027 #define __DEBUG__MOTORS__C__ 00028 00033 class Motors 00034 { 00035 public: 00036 00038 00040 Motors(); 00041 00043 ~Motors(); 00044 00045 00046 // Enable left or right 00049 void EnableLeft(); 00052 void EnableRight(); 00053 00054 00055 // Disable left or right 00058 void DisableLeft(); 00061 void DisableRight(); 00062 00063 00064 // Reset left or right 00067 void ResetLeft(); 00070 void ResetRight(); 00071 00072 bool ReadBufferRight (char *Buffer,int NbMax,int TimeOut); 00073 00074 // Wait for motors answer 00077 bool WaitLeftAnswer(); 00080 bool WaitRightAnswer(); 00081 00083 00084 // Set speed left or right (0 to 32767 rpm) 00088 void SetLeftSpeed(int Vit); 00092 void SetRightSpeed(int Vit); 00093 00094 00095 // Set absolute position left or right (-1.8*10^9 to +1.8*10^9) 00099 void SetLeftAbsolutePos(int Pos); 00103 void SetRightAbsolutePos(int Pos); 00104 00105 00106 // Set relative position left or right (-2.14*10^9 to +2.14*10^9) 00110 void SetLeftRelativePos(int Pos); 00114 void SetRightRelativePos(int Pos); 00115 00116 00117 // Set acceleration left or right (0 to 30000 r/sē) 00121 void SetLeftAcc(int Acc); 00125 void SetRightAcc(int Acc); 00126 00127 00128 // Set deceleration left or right (0 to 30000 r/sē) 00132 void SetLeftDec(int Dec); 00136 void SetRightDec(int Dec); 00137 00138 00139 // Set peak current left or right (0 to 12000 mA) 00143 void SetLeftPeakCurrentLimit(int Current); 00147 void SetRightPeakCurrentLimit(int Current); 00148 00149 // Set continuous current limit (0 to 12000 mA) 00153 void SetLeftContCurrentLimit(int Current); 00157 void SetRightContCurrentLimit(int Current); 00158 00159 00161 00162 // Get speed left or right (0 to 32767 rpm) 00165 int GetLeftSpeed(); 00168 int GetRightSpeed(); 00169 00170 00171 // Get position left or right (-1.8*10^9 to +1.8*10^9) 00174 int GetLeftPos(); 00177 int GetRightPos(); 00178 00179 00180 // Get acceleration left or right (0 to 30000 r/sē) 00183 int GetLeftAcc(); 00186 int GetRightAcc(); 00187 00188 00189 // Get deceleration left or right (0 to 30000 r/sē) 00192 int GetLeftDec(); 00195 int GetRightDec(); 00196 00197 00198 // Get peak current limit left or right (0 to 12000 mA) 00201 int GetLeftPeakCurrentLimit(); 00204 int GetRightPeakCurrentLimit(); 00205 00206 00207 // Get continuous current limit left or right (0 to 12000 mA) 00210 int GetLeftContCurrentLimit(); 00213 int GetRightContCurrentLimit(); 00214 00215 }; 00216 00217 #endif