Given the following snippit of C code we are attempting to add damping or differential correction to the pitch stability. The values gain and DiffPitchRoll are constant doubles used to adjust the various gains. This chunk of code runs 75 times a second and er.Pitch is the IMU raw pitch output. Given we want rate damping what should the sign of the differential correction be ?
/*****************Code Snippit *******************/
static double pitch_prev;
double cur_pitch=PitchConvert(er.Pitch);
double pitch_err=Target_Pitch-cur_pitch;
double pitch_change=(cur_pitch-pitch_prev);
Elevator_Correction_Cmd=(-((pitch_err)*gain))?(pitch_change*(double)DiffPitchRoll);
pitch_prev=cur_pitch;
/*****************End Snippit *******************/
What should the Red ? Be?
If you choose ‘-‘ goto this video: Minus Video
If you choose ‘+’ goto this video: Plus Video
(We have a tethered burn time waiver inplace.)
The vehicle was undamaged in both videos above, We need to work on the altitude control a little bit more and we did eventually tangle the ropes around the the GPS antenna mast 3 flights after the “Plus” video and broke it off….all in all a good day.
Tidak ada komentar:
Posting Komentar