Posted by Jason Short on December 20, 2009 at 7:00pm
Just like in the previous version of Ardupilot, throttle control maintains speed and altitude. I've made a little demo to help demystify the behavior of throttle control. This loop uses a special scaling feature that brings up the throttle to a high level when the airspeed dips below the desired cruising speed. Altitude of the plane is also maintained with the throttle by increasing the desired airspeed. Finally airspeed is scaled to match a throttle output %.Here is the Flash Source: PID Throttle.fla.zipNext installment: Events API
Jason, Is there any way to save these animations (this one and Part 3) to hard disc so that I can run them off-line? I have downloaded the fla from the zip file but do not know how to run it. There was also not a zipfile for part 3.
A PID loop with a timer tick running that does the numerical integration.
Input from controls and from mouse position (giving delta height and delta airspeed by mouse input)
The code updates "text objects" that shows in the Flash application running.
Some bounds checking as well and some number to string conversions etc.
Very understandable, even if I am not a Java Script programmer.
I like the possibilities that Flash gives since its way faster than Java applets (I know Jave is not the same as Java Script) that need to be downloaded. It is also much more responsive.
I have some Flash and Flash programming on the future learning list.
I have this code inside the Flash file. It was quicker.
This is the code:
var e:Number;var err_I_a:Number = 0;
var err_I:Number = 0;
var airspeed_current:Number = 0;
var altitude_current:Number = 0;
var nav_airspeed:Number = 0;
var throttle:Number = 0;
var loopTimer:Number = 0;
var deltaMiliSeconds:Number = 0;
var THROTTLE_P:Number = 3;
var THROTTLE_I:Number = 1;
var THROTTLE_ABS:Number = 3;
var altitude_throttle_P:Number = 1.33;
var THROTTLE_CRUISE:Number = 30;
var old_throttle_output:Number = 0;
var ALTITUDE_AIRSPEED_MIN:Number = -15;
var ALTITUDE_AIRSPEED_MAX:Number = 15;
Nice! Thanks for sharing the code. Do I need he CS4 software to actually view the code? Tried top open it in a text editor, but no resemlance of Java Script in that editor :)
This is done is Adobe Flash CS4. The inputs for the numbers are prebuilt components by adobe. Everything else is using the standard flash movieclip objects and textfield objects. It's written in javascript which is virtually the same as C++. I just copy in the control code from the ardupilot and tweak the data types.
Unfortunately Flash is not a free tool and has a steep learning curve. But once you learn it, it is incredibly fast and graphically capable. I made this in about an hour.
Do you mind outlining the techniques you used to make the demo?
How did you implement the controls?
Are there existing class libraries available that programmers may reuse?
Comments
I'll post an exe of the final set and you'll be able to run them like a local app.
Keep up the good work
Richard
A PID loop with a timer tick running that does the numerical integration.
Input from controls and from mouse position (giving delta height and delta airspeed by mouse input)
The code updates "text objects" that shows in the Flash application running.
Some bounds checking as well and some number to string conversions etc.
Very understandable, even if I am not a Java Script programmer.
I like the possibilities that Flash gives since its way faster than Java applets (I know Jave is not the same as Java Script) that need to be downloaded. It is also much more responsive.
I have some Flash and Flash programming on the future learning list.
UFO_MAN
This is the code:
UFO_MAN
Unfortunately Flash is not a free tool and has a steep learning curve. But once you learn it, it is incredibly fast and graphically capable. I made this in about an hour.
Do you mind outlining the techniques you used to make the demo?
How did you implement the controls?
Are there existing class libraries available that programmers may reuse?
UFO_MAN