July 14, 200619 yr Well, I figured out what my problem was with earlier code. Turns out it was a variable not getting set like it should.So, now with a new object all programed, I have reduced my callback function to this:FLOAT64 FSAPI Attitude_Bank_cb(PELEMENT_SPRITE pelement){ return gyroAttitude.getBank();}which is handy. The Gyro takes care of all the gritty details:class Gyro{public: Gyro(string gyroName, GAUGE_TOKEN pitchToken, double pitchLimit, double pitchDamper, GAUGE_TOKEN bankToken, double bankLimit, double bankDamper, GAUGE_TOKEN yawToken, double yawLimit, double yawDamper); string getGyroName(); bool isGyroPowerOn(); void toggleGyroPower(); FLOAT64 getPitch(); FLOAT64 getBank(); FLOAT64 getYaw();private: FLOAT64 Gyro::dampened(double &axis, double goal, double damp_factor); bool gyroPowerOn; string name; double pitch; double bank; double yaw; MODULE_VAR goal_pitch; MODULE_VAR goal_bank; MODULE_VAR goal_yaw; double limit_pitch; double limit_bank; double limit_yaw; double damp_pitch; double damp_bank; double damp_yaw;};Now, after looking more closely at the dampening formula, we get a graph like the blue below. What I really need is something more like the red with a gradual falloff to asomptote.http://forums.avsim.net/user_files/152469.jpgI am, however, not the math guru. Any ideas? Maybe I could do a web search on logrythmic functions or something.Patrick
July 14, 200619 yr Looks like you're trying to simulate an object with mass that is undergoing constant acceleration. Try something like this:bank=28speed=0in each time step: speed=speed+0.05 bank=bank-speedYou'll almost certainly have to tweak the 0.05 -- it's just a wild guess. The other question is what you want to do when you hit zero... but maybe you can come up with suitable logic for that yourself...HTHMartin
July 14, 200619 yr Hi,In this case I think you could try a 2nd/3rd order polinomial, use Excel to find the formula.Tom
July 14, 200619 yr Tom,Yes, I too think I'm probably looking for a such a polynomial. I'll keep experimenting in Excel.Thanks for the thoughts.Patrick
Create an account or sign in to comment