Changeset 214 in flair-src for trunk/lib/FlairSimulator/src/X4.cpp
- Timestamp:
- 02/07/18 17:49:27 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/X4.cpp
r167 r214 20 20 #include <Tab.h> 21 21 #include <DoubleSpinBox.h> 22 #include <SpinBox.h> 22 23 #include <GroupBox.h> 23 24 #include <math.h> … … 73 74 j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001, 74 75 5); // moment d'inertie d'un axe (N.m.s²/rad) 76 77 motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100); 75 78 76 79 motors = new SimuBldc(this, name, 4, modelId,0); … … 199 202 float fl_speed, fr_speed, rl_speed, rr_speed; 200 203 float u_roll, u_pitch, u_yaw, u_thrust; 204 Time motorTime; 201 205 #ifdef GL 202 206 motor_speed_mutex->GetMutex(); 203 207 #endif // GL 204 motors->GetSpeeds(motor_speed); 208 motors->GetSpeeds(motor_speed,&motorTime); 209 if((GetTime()-motorTime)/1000000>motorTimeout->Value()) { 210 for(int i=0;i<4;i++) { 211 if(motor_speed[i]!=0) { 212 //Printf("timout\n"); 213 for(int i=0;i<4;i++) motor_speed[i]=0; 214 break; 215 } 216 } 217 } 205 218 #ifdef GL 206 219 motor_speed_mutex->ReleaseMutex(); 207 220 #endif // GL 221 208 222 fl_speed = motor_speed[0]; 209 223 fr_speed = motor_speed[1]; … … 212 226 213 227 /* 214 215 216 217 218 228 ** =================================================================== 229 ** u roll: roll torque 230 ** 231 ** =================================================================== 232 */ 219 233 u_roll = arm_length->Value() * k_mot->Value() * 220 234 (fl_speed * fl_speed + rl_speed * rl_speed - fr_speed * fr_speed -
Note:
See TracChangeset
for help on using the changeset viewer.