Developer

Flight testing 2.5.03

Hi All,
I just uploaded the last version of 2.5.0(3) I wanted this one to be rock solid before 2.5.1 came out.

I got a few hours today to tweak code and gains for my EZ Star. I implemented the derivative term in the heading/navigation loop and all the other loops used just the p term. The derivative term helped reduce overshoot by about 50%. I'm not kidding about the wind. The plane was flying at a 30° angle to fight the wind.

Altitude hold was working very well. Pitch_comp reduced to .1 was about all I needed. The airspeed control needs work, but Doug is tackling that.

I have my own personal ground station in Flash and I added uploading of all of the major variables in order to tune the aircraft in flight. This worked great so I'll leave the code included for the GCS team to check out. I didn't use error checking, I had the plane echo back the values so I could see if the uploaded values worked correctly before re-entering AP. It was far less complicated to do it that way than to try and implement errror-checking through code.

I've also implemented a simple dampening system for flying into the wind based on ground speed. Doug has a much more complex version, but this one worked remarkably well. Here you can see the loiter pattern. Please note that I was flying into a terrific headwind. The plane was moving 12 mph upwind and over 40MPH downwind. Sometimes the wind would pick up and the plane would virtually stand still, hence the strange patterns. Overall the snaking was minimal and far better than before. I was able to hold the 45m radius no problem. I could have cut that down to 30.







Altitude hold with 15 loops around home, then a landing.


E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Developer
    So right now I am scaling the roll down based on groundspeed.
    here's my code:
    float calc_nav_roll(float error){
    static float err_rate_limiter = 0;

    integrators[I_ROLL] += (error * head_I * deltaMiliSeconds)/1000.0;

    // Limit Integrator
    // ----------------
    integrators[I_ROLL] = constrain(integrators[I_ROLL], -HEAD_I_MAX, HEAD_I_MAX);

    derivative_roll = (error * last_errors[I_ROLL]) * 1000 / deltaMiliSeconds;

    // Sum the errors
    // --------------
    error = (head_P * error) + integrators[I_ROLL] + (derivative_roll * head_D);

    last_errors[I_ROLL] = error;
    error = constrain(error, -roll_max, roll_max);

    // Adjust gain based on ground speed - We need lower nav gain going in to a headwind, etc.
    // this is a cheap approx
    nav_gain_scaler = (float)ground_speed/ 1200; // 1000 = 10 m/s = 22.4mph
    nav_gain_scaler = constrain(nav_gain_scaler, 0.4, 1);

    error *= nav_gain_scaler;

    return (error);
    }

    Roll output is scaled down if we are under 30mph. It definitely works! I need to adjust it a bit as I made an educated guessed about the scaler values.
  • Developer
    Getting Closer man! Add in the GS compensation and you will be golden. I'm gonna write up a more elegant approach to that here soon!
  • @ Marc - I save those gains on the Aurdustation eeprom and they auto upload when evere Station and pilot are both on. Changes can be made in any mode, and then saved on the Ardustation and then back home at home you can change the ?.h file and still tweeq it in the air any time. There's a lot of stuff added to the ground station.
    It's a version of 2.4 with extras.
  • Developer
    @Jay,
    That's great to hear. I want to try it on my aileron trainer, but the motor is busted. My goal is for it to work OK on any airframe without gain adjustment. If you want high performance, you'll have to continue to tweak.

    How was the startup sequence for you? That was a big change.
    Jason
  • Jason I loaded 2.5.03 into my ardupilot equipped radian and flew a simple cross pattern. Worked great just the way you have it set up. Only change I made was for was for the em406. I need to tweak the throttle values a bit as the radian is so overpowered. Fly by wire worked great as well. I don't have it set up for telemetry Looking forward to better flying weather and more tests. I should get a easy star built to compare apples to apples but your setting are pretty close for the radian
  • Developer
    Hi Marc,
    I think the next release of the ground station could do it. On Mega we have plenty of Flash, on the 328 we only can write 512bytes. :(
  • Jason, that groundstation code is really clever! Is there any reason we can't save those settings in eeprom or is that something already in the works? I've been flying with a couple different airframes and it would be great to just be able to transfer the AP and easily reload gains etc. via the GCS.
  • Developer
    Nice work Jason!
  • Developer
    Note that you only send the part in quotes "!!r|65"
  • Developer
    If someone wants to upload values to the plane here's how you can do it without a ground station.
    - Connect Arduino serial window to your Xbee.
    - you should see the telemetry stream
    - put the plane in manual control
    - upload your values with this format: "!!h|80" (then hit return to send)
    - you should see that the plane received it, and get the value echoed back (actually all values will be sent back)

    Set Heading P to .8
    !!h|80

    Set Heading I to .01
    !!H|01

    Set the Rudder/Aileron P (the control surface response) to .65
    !!r|65

    Also change this code in Ardupilot_25_03.pde
    from
    #if GROUNDSTATION == 1
    readCommands_GS();
    #endif

    to
    //#if GROUNDSTATION == 1
    readCommands_GS();
    //#endif
This reply was deleted.