After a grossly failed attempt at fully automatic landing due to mild winds (luckily no damage), I decided to go back to the simulator and see what PID tuning is required to handle the harshest flyable wind conditions that I could throw at Ardupilot. Because I fly in the mountains and I'm interested in fully automatic take-off and landings, path following needs to be as accurate as possible.


Xplane settings:

Plane: Radio controlled PT60

Weather: Wind: 25kts at 145degrees (from waypoint #3 to #5, never a direct head or tail wind). Shear Speed/Direction 0, Turbulence 0.



Result #1: 


As you can see the air speed (and cruise speed) is around 19m/s and Ardupilot is calculating the wind speed at 12m/s, which should be much higher than you would ever normally fly in.

Result #1 PIDs:




Result #2:


Much higher Nav/Servo P settings, but only marginally better path following, by simply reducing the "bulge" at each waypoint. However as I discuss below, these higher P settings can start to cause major problems.

 Result #2 PIDs:




Result #1 PIDs with no wind whatsoever:


I wanted to find values that still worked relatively well when there is no wind, as you can see they are not too bad but there definitely is some snaking caused by the high Xtrack gain. Lowering this to around 100 reduces the snaking, but virtually kills and high wind path tracking at the same time.



What I've learned:


When dealing with wind, Xtrack Gain and Entry Angle seem to make the biggest difference, increasing P or I values above a no wind situation while can offer minor improvements also introduce a level of risk (at least in the simulator) where in some cases the plane would start rocking and eventually lose control and go into a dive. However increasing the Xtrack gain too much (ie: 1000) often results in high frequency "snaking", because the wind blows the plane slightly off track, Ardupilot over corrects to bring it back onto the track, straightens out, then the wind blows it off track again... Rinse and repeat.

Based on the different forum/blog posts regarding PIDs, they still don't make much sense to me and I haven't been able to get I or D settings to actually help matters, despite hours of tests. :(

The biggest problem with accurate track following appears to be with the fact that Ardupilot doesn't have any turn prediction, so it doesn't start its turn until its right on top of the way point, at which time the wind has already started to blow the plane off track and the PIDs need to be set sufficiently high enough to get it back on track before the next way point. This results in the path "bulges" near each way point where the approach has a tail wind, and "snaking" after way points turning into a headwind, as you saw in the screenshots above.


Does anyone have any suggestions on improving things further? Unless I'm missing something, I would be surprised if anything better than the above paths can be achieved until additional smarts are added to Ardupilot, along the lines of this Turn Prediction.


If anyone wants to give it a try, below are the flight plan and parameter settings that I used:




Views: 2771

3D Robotics
Comment by Chris Anderson on October 25, 2011 at 6:01pm

Nice analysis. I'd love to post a good PT60 param file in the wiki. Do you recommend your for general use, or it is just for a wind conditions?

Comment by Mike on October 25, 2011 at 6:55pm

It seems to work quite well in no winds at all, as shown above. Its better than nothing, I would just include a note saying its designed for high winds of 25kt, but works in no winds as well.

Comment by Brian Maisler on October 25, 2011 at 8:09pm

I live in a place where I regularly see wind conditions similar to what you have posted above. My aircraft shows similar behavior. I think I may have identified some ways to improve the high-wind behavior. It's still very speculative right now. I will probably post something when I get a little further along.

3D Robotics
Comment by Chris Anderson on October 25, 2011 at 10:03pm

Many thanks! Config file added to the manual here

Comment by Héctor García de Marina on October 25, 2011 at 11:46pm

In my opinion this is really not a control problem, but a guidance problem. I mean, if you must strictly follow a path with (for example) some extras such as coordinated turns as constraints, you would probably need more than only 5 geographical waypoints.

Comment by Ryan Beall on October 26, 2011 at 5:42am

I did some work on this a while back.  I'll have to do a write up on it and see if it is worth the dev team including it in the code.  It might help bring some linearity to the heading/ground track controller.  I'm busy with work here at the moment but I'll revisit this and post soon.  Improved Heading Controller

Comment by Ryan Beall on October 26, 2011 at 5:49am

It has been so long that I forgot that I had already written something on this idea.  If I remeber correctly I hadn't cross checked a couple things before I got side tracked and it  wasn't 100% validated by my sim.  Now that we have the HIL I'll push some code around and see what we can come up with. Here is the old post

And here is the link to the write up.


Standy by for some more validation and updated notes on this!

Thanks for the reminder!


Comment by Mike on October 26, 2011 at 8:28am

Ryan, if I read your blog post correctly the primary goal of your work here is to eliminate the oscillation in the track following when there are high winds, which would definitely be welcome.


My only concern is that eliminating the oscillation doesn't solve the root cause of the oscillation, which in my opinion has more to do with the lack of turn prediction than anything. If you notice my screenshot for "Result #1 with no winds", even when there is no wind whatsoever in the simulator the plane still oscillates and the path still bulges at every waypoint. If there is no bulge at each waypoint, there will be less room for the plane to start oscillating in the first place.


Ideally (in a perfect world) at each waypoint the plane would make a smooth "sweeping 90degree" turn hitting the exact waypoint at the 45degree mark, starting the turn exactly on the path and ending the turn exactly on the path. If it does that, then oscillations shouldn't occur to begin with, at least for straight track following. In each of my above tests, by the time the plane had completed 50% of each leg, any oscillations originating from the waypoint turn had been smoothed out. 



Comment by Mike on October 26, 2011 at 8:33am

Hector, that will be one of my next projects, seeing if I can create a flight plan with a significant number of additional waypoints that forces the plane to actually follow the path that I want. Obviously this is far from ideal and Ardupilot should be able to get the same result with just a single waypoint at each corner, but it should be an interesting exercise nonetheless. It may also help prove my original blog post theory about the path bulges. 

3D Robotics
Comment by Chris Anderson on October 26, 2011 at 9:11am

Mike: Turn prediction has been on our to-do list for some time, but there have been higher priorities. If you'd like to submit a patch that adds this, that would be great and we'll have the team consider it ASAP. Otherwise, it's just a matter of waiting until the dev team gets to it.


As an open source autopilot, we look to the community to contribute the features they want added, while the core dev team works on basic architecture, stability and platform evolution to new hardware. This is a great example of the sort of thing we'd look to the community to create. The upside being that you not only get the feature sooner, but such contributions often lead to an invitation to join the dev team and all the goodies that come with that ;-)


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

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service