This is a simulation I'm working on to improve the Loiter control laws and discover optimal gains. I have identical code from Arducopter running in Flash as OO Javascript so I can ensure the behavior is the same as the real thing. I tested the MTEK GPS to find the actual latency and accuracy and then modeled it in code. This allows me to test PIDs and other coding ideas to see how the copter will behave in real life. The copter itself is a simple physics equation and should be fairly accurate. To better tune the SIM, I can compare AC Flash Logs from real flights side-by-side with the SIM flights which also output the same text based logs.

I've already found many areas for improvement in the Loiter code which i've just checked in to the GIT repository. 

 

Hopefully this tool will serve as a great PID introduction as well. I know I've learned a lot by comparing plots with small changes in the gains. 

 

Jason

 

 

Views: 9778

Tags: Arducopter


Developer
Comment by jasonshort on May 19, 2012 at 9:40am

Daniel, 

I''m pretty far on a second version that includes the stability routines. It will also do navigation and include the Nav PIDs.  


Developer
Comment by jasonshort on May 19, 2012 at 9:42am

I've got another 2-3days work to finalize it.


Developer
Comment by Ryan Beall on May 19, 2012 at 10:57am

Jason, That's not exactly what you want to do.  You don't want to derive a separate state from the gps measurements.  You want to smooth the ones you already have!  So Speed would output a smoothed speed and position x&y would output a smoothed x&y position.  

Speed over ground = SOG

SOG_estimate = SOG_now + (SOG_now - SOG_old);


Developer
Comment by Ryan Beall on May 19, 2012 at 11:22am

And you can tweak it if you want by doing something like this:

SOG_estimate = SOG_now + K*(SOG_now - SOG_old);


Where K is some gain typically 1 or less and always positive.


Developer
Comment by jasonshort on May 21, 2012 at 10:08am

Thanks Ryan. I'll try it. 

Comment by Christiaan van Vollenstee on May 21, 2012 at 11:37am

All is very awesome and all, but what if I have a 10kg Quad running twin 20 volt batteries with 1000Wat motors and a 4kg scientific camera. I feel you need to include these variables because alot of people create their own styles and is very hard to test those PID's across the APM.

 

Regards


Developer
Comment by jasonshort on May 21, 2012 at 11:51am

Here's a question. If you could have a SIM that had all of these factors and could simulate virtually all of AC flight (but 2d Only) what would it be worth? Would you donate towards its development?

Jason

Comment by CharlieNoFun on May 21, 2012 at 11:58am

I would donate! It would be neat to have an web based sim where you enter all your copter measurements, motor speed, weight... Then get an starting spot for PID's specific to the parameters you enter :)

Comment by Christiaan van Vollenstee on May 21, 2012 at 12:08pm

I recon what made this product sooo successful is that there is not just the hardware but there is software supporting the product as well and as a software developer I know that no piece of software will ever become grate if there is no criticism and external inputs.


Developer
Comment by jasonshort on May 21, 2012 at 12:37pm

I'm asking because I'm developing a very sweet SIM and it's quite an effort. It will have all of the AC params and some hardware details like Kv and weight. I'll probably post more in a week.

Jason

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service