Ardusoar cross country X-Plane simulation

3689576559?profile=original

Hello all,

I have been doing some work on Peter Braswell's Ardusoar code (http://diydrones.com/forum/topics/autonomous-soaring?xg_source=activity) to improve thermal centring.

I finally got around to getting HIL working in XPlane to allow some cross country soaring simulations. I am using the PT60 model which has a terrible glide ratio (about 1:7) so thermal strength has been set quite high (1000 ft/min) although thermal coverage is only 10%. The Ardusoar code is working very well - the extended Kalman filter does a good job of centring thermals and almost never loses them. The throttle is set to zero when soaring but is re-enabled if the altitude drops too low, allowing automated climbs back to a good altitude. The flight mode is AUTO until an updraft is encountered (climbrate exceeds a certain threshold) at which point the mode is switched to LOITER. In LOITER mode, the Kalman filter is updated whenever new measurements (GPS positions and barometric altitude) are available. The update takes 4-5ms and doesn't appear to slow down the main loop below 50Hz. My repository is here if anyone is interested in trying out the code. https://github.com/samuelctabor/Arduplane

Below is a several kilometre flight (this was a 5-hour Xplane flight) with quite a lot of thermal encounters. The code includes logic about whether a thermal at a given strength and height is worth taking. This leads to quite a few brief thermal encounters in which the algorithm begins to search for the thermal but decided not to continue based on the thermals strength (too weak for the altitude the plane is at).

Below is the altitude throughout the flight (after the initial climb to 850m, the motor is off). There are a few long thermal climbs, especially early in the flight up to 3000m (cloudbase).3689576511?profile=original

Below is a close up of a typical climb. After switching to loiter mode (purple)  it takes a couple of circles to centre the thermal. 

3689576618?profile=original

The filter's states are saving in the onboard log to allow post-flight analysis. Here the algorithm's estimate of the thermal centre location is the blue track. You can see it moves it quite a bit during the initial centring and very little after that.3689576591?profile=original

The internal model of the updraft strength is a Gaussian distribution. Effectively the Kalman filter tries to adjust the estimated strength size and location to match the measurements.

3689576534?profile=original

As you can see the states change quite a lot during the initial centring. After that they are quite stable except for some ripple. This is due to the XPlane thermals not quite matching the Gaussian distribution assumed in the algorithm.

3689576642?profile=original

I am hoping to do some real-world flight testing when the weather improves here. Eventually this code is going to be used in a 3m balsa Bird of Time glider I am building, but flight testing will probably be done on something a little more tough and expendable, probably a Parkzone Radian.

3689576664?profile=original

Happy flying!

Sam

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Hi Thomas,
    Thanks for your interest, yes I can update the code to the current release. Unfortunately the release version is not always tagged but I'll have a look. What plane are you planning to use?
  • Hi Sam, very nice working! I'm bulding an soaring machine and like to put your fork in it, is it possible to match the actual stable release?
  • Hi Sam,

    Great stuff. Very interesting reading here. I'm looking forward to seeing more results.

    I have been doing somthing similar, yet different:

    ATV Autonomous Thermalling

    All the best,

    Kees

  • Sam,

    Thanks for the feedback. Interesting obsevation that one tends to overestimate the actual airspeed. Shows that it is difficult to tell from the ground by eye-sight alone, I guess.

    So, great -- now I have some realistic velocity values when trying to determine the magnitude of the centripetal compensation which I suspect is necessary for prolonged stable and balanced banking in circling flight.

    Bye for now,

    // Martin

  • Hey Martin,

    I have done some tests,  the data is pretty noisy so I need to get some more really. However from what I have, I would say both speeds are lower than you expect, for my Radian at least. These speeds both scale with the square root of wing loading.

    - min sink is pretty much as slow as you can fly, which I have found to be around 5.5-6m/s depending on wind

    - best glide is not much higher, maybe 7 m/s.

    I usually fly at 8m/s, which is around 10% worse glide ratio than 7m/s. 

    I read an article about testing the glide polar of the RnR SBXC which also noted that best glide and sink speed were lower than pilot expectation.

    My Radian isn't that aerodynamically clean unfortunately so that will tend to lower the best glide speed. I want to move the telemetry radio out of the air flow and embed the airspeed sensor in the wing rather than a fairing beneath it which should help a bit, but the best glide speed is quite a weak function of Cd0 so it will not make a massive difference.

    Cheers,

    Sam

    http://www.xcsoaring.com/techPicts/%20Ellias%20performance%20test.pdf
  • @Sam Tabor
    Hi,
    I remember reading somewhere (although not in this thread, I think) that you were planning to empirically find the Radian's glide polar. Have you come to any conclusions or informed opinion regarding the speed for the maximum lift coefficient (ie optimal thermalling speed) and the best L/D speed respectively yet? I have not done any instrumented tests myself, by I expect those values to be in the region of 6-7 m/s versus perhaps 10 m/s. What values would you suggest?

    //Martin
  • Hi Trung,

    5m is certainly excessive, my APM is showing +-0.3 m/s. You could try adding foam over the baro (I haven't but it can help), this adds some pressure damping and also keeps light off the sensor.

    Nice choice on the BOT, I am looking forward to getting mine finished. I am building mine with spoilers which will be nice to have, the Radian has none and was sucked up to ~850m AGL a couple of times this summer! It was completely out of sight, still flying it's circular mission. The only thing to do to get it down was to set airspeed to maximum and wait for it to reappear . . . 

  • 100KM

    Thanks, Sam!  Yesterday was the first attempt with APM2.6 in the EZGPro.  I am still working through a noisy/jumpy baro (I think).  Until I get it resolved, I'm afraid auto soaring will not be possible.  It jumps +/-5m very quickly while stationary and flying.

    3701860577?profile=original

    I have a new BOT ARF on the way.  I have to resist the urge to throw the other APM in it and get the EZGPro flying properly first.

  • Hi Trung,

    I'm glad you're interested in testing, I have added an up to date hex file with the SOAR_ALT_CUTOFF parameter here . I have also updated the default soaring parameters to those I am currently using.

    Let me know how you get on.

    Cheers,

    Sam

  • 100KM

    Hello Sam,

    Thanks for all your work.  I'm finally going to try it out today.  Is there a hex file of the latest version with SOAR_ALT_CUTOFF?

This reply was deleted.