Hi. I have made some modifications to the MatrixPilot code to do tests on In flight tunable gain. If this is further refined, it will be possible to do tuning of P/D gains on roll, pitch and yaw axis while in flight. The idea is that the gains can be tuned with a spare button on your RC transmitter one after the other (separately) while you fly the plane in stabilized mode. The gain you want to tune is gradually increased until oscillation is seen at max desired airspeed and then reduced back somewhat to ensure stability on that axis with that gain. My code mods is a hack at the moment, but this is just to illustrate the concept.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Hi, OK there are several models then. I think I got a model offline from Paul (not Peter, sorry for mixing up names) at a time. I havent had time to look at it much.

    I have the X-plane / UDB stuff running (less stab), but the surface model in X-plane I am not sure if can properly simulate an RC airplane due to small dimensions and different Reynolds numbers etc. I have not found many RC models for it and the one I have found acts very strange and oscillates (without the plugin, just running plane X-plane).

    I would just like to play with a simple model that takes into account moments from rudders (based on dimensions and max airspeed), linkages and servo parameters, and the planes inertia + some dimensions, like distance between tail and the "aerodynamic zero" at main wing etc. What I would like to do is to estimate max gains for different plane / wing types.
  • T3
    Hi UFO-MAN,

    I hope that I am not generating any confusion. The Matlab model that I was referring to was a very simple yaw-axis model for a helicopter that I put together to investigate the stability of a heading-hold algorithm. Beyond that, I do not have any other Matlab models.

    I confess that I have not been able to keep track of everything that is going on, so I am not sure who has a Matlab airplane dynamics model.

    There is an X-plane interface for the UDB, I somehow thought that you were one of the people who were using it. If not, I suggest that you contact Ben Levitt when he gets back from vacation.

    Paul Bizard developed a Matlab model for one of his planes, but I don't think he published it.

    Best regards,
  • Excellent Bill, will take a look at that. Btw. the airplane dynamics Matlab model, where can I get hold of that? I know Peter sent me something earlier, from the DCM simulation. Is it that model you are reffering to?
  • T3
    Hi UFO-MAN,

    I did some Matlab simulations for "John Mac" while we were trying to get heading hold working for his helicopter. We had a "damping" feedback gain turned too high, it was pushing a servo into rate limiting, I finally figured it out with some simulations.

    There are two nonlinear blocks in Matlab's simulink library that do a nice job of capturing the most important features of the deflection of a control surface that is driven by a servo: a "Saturation" block, followed by a "Rate Limiter" block. You set the saturation block to represent the limits of the deflection. You set the rate limiter block to represent the maximum slew rate.

    Once you have the deflection of the control surface, you can compute everything else from the model of the airplane dynamics.

    Best regards,
  • Bill, a question about phase: is it correct understood that since the limited slew rate of the servo gives a time delay, this time delay can be seen as a phase delay? What is the typical transfer function of a slew rate limited servo? Have you or Peter H made a transfer funtion block diagram for the system: servo, linkage, control surface, force, moment etc? I would like to be able to model the response of a typical model aircraft in Matlab.
  • T3
    Hi Ric,

    Thanks for the information. You are absolutely correct, centering is important.

    Which reminds me, there is a mechanical technique that you can use to raise the effective slew rate of the controls. You can use leverage to reduce the required deflection at the servo. You use the holes in the servo arm that are far from the center, and the holes on the control surface arm that are close to the surface. This increases the effective control gain without bumping into the rate limit.

    Of course, if you use this technique, you must eliminate all "free play" in the mechanical linkage, and the manual control will not be easy. But the control stabilization will be better.

    Best regards,
  • Hi Bill,

    the servos I'm using on my Funjet are those (0.068 at 60° / 6V). They are well centering and generally well suited.
    Centering is a main must, because high speed and bad centering isn't worth a penny (not forgetting leverage accuracy and free play).
    Those servos are small and light enough (10.9g), not needing high voltage (HV 380 12V !?) and, not least, cheap.

    Best regards,

  • Tip: you could just download the free demo version of X-plane to begin with because the plugin you need to get the HIL to work will work regardless of the timeout of the joystick! (We don't need joystick because the RC transmitter/UDB / MatrixPilot is taking the role of the Joystick).
  • UFO-MAN you really are talking my languuage. I think I'm going to start enjoying this again! I'll look into x-plane a little more closely.

    I'm begining to see things more clearly :) Thanks
  • By the way Tim, if you are looking for hardware in the loop simulation (HIL), this has been done with X-plane 9 and MatrixPilot. We use a duplex serial link to send data from the X-plane sim to UDB and MatrixPilot. Control surface deflections are sent back to X-plane 9. Take a look at the wiki pages for more information. Search for HIL. I have managed control of aircraft in X-plane 9 from the UHF TX / RX chain connected to UDB. However stab seems to have some problems at the moment, but it has been done. We are trying to iron out some issues at the moment. My HIL platform runs on Win7 with VC++ 2010 EE and X-plane 9 commercial version.
This reply was deleted.