Mike's Posts (3)

Sort by

Traversing mountain peaks and valleys...

In an attempt to make a flight plan that will make it over a mountain peak and land in a valley, I have defined the following plan to command Ardupilot to loiter to a certain high altitude, traverse to another waypoint, then loiter safely down to another low altitude:

xplane_high_alt.h

 

#define WP_RADIUS 30 // What is the minimum distance to reach a waypoint?
#define LOITER_RADIUS 60 // How close to Loiter?
#define HOLD_CURRENT_ALT 0 // 1 = hold the current altitude, 0 = use the defined altitude to for RTL
#define ALT_TO_HOLD 100float mission[][5] = {
{WAYPOINT,0,528,49.9630094,-119.378643},
{LOITER_TURNS,1,1500,49.963037,-119.3742228},
{CONDITION_CHANGE_ALT,0,1500,1000,0},
{DO_JUMP,7,0,49,0},
{LOITER_TIME,5,1500,49.963037,-119.3730211},
{DO_JUMP,2,0,100,0},{WAYPOINT,0,1500,49.9585921,-119.3729353},
{LOITER_TURNS,1,1500,49.9585921,-119.3743086},
{CONDITION_CHANGE_ALT,0,528,1000,0},
{DO_JUMP,13,0,49,0},
{LOITER_TIME,5,528,49.9585645,-119.3757248},
{DO_JUMP,8,0,49,0},
{WAYPOINT,0,528,49.9583989,-119.3808317},
{RETURN_TO_LAUNCH,0,528,49.9629542,-119.3808746},
};

 

The first part works (loiter to altitude) perfectly, but the problem is as soon it reaches the second part (waypoint #7) Ardupilot just returns to launch without descending at all, as if it thinks it has already descended and should continue on. 

 

Have I messed up the flight plan, or is this a bug by chance?

 

 

 



 

 


Read more…

Quest for the perfect flight path...

After some decent results described in my previous post regarding PID tuning for high winds: http://www.diydrones.com/profiles/blogs/pid-tuning-for-high-winds, I wanted to see what it would take to get the best possible flight path with the least amount of flight planning possible. The end result was a three waypoint 90degree corner, as shown below.

 

3689430254?profile=original

 

The problem of course is wind... The above path was with no wind whatsoever, as soon as high winds are added the entire thing falls apart completely, as the plane often missed the last waypoint in the downwind turns and has to circle back.

 

I figured that if I could get a near perfect flight path with just three waypoints on each corner, what if I went back to using a single waypoint, but simply increased the waypoint radius such that the plane had enough room to make a perfect turn. In theory this should at least be flyable in high winds without having to circle back to hit any of the waypoints...

 

Unfortunately this failed as well, due to what I think is the Xtrack entry angle, and possibly a bug, or at least odd behavior from my understanding.

 

It appears that the plane always tries to approach the path at the Xtrack entry angle after a turn, but it also always overshoots the track by a similar angle then has to correct itself. I created the following path by starting with a 90degree Xtrack entry angle at waypoint #2, then cutting that in half for each subsequent waypoint until waypoint #5 where it was 11degrees:

3689430176?profile=originalI can understand some overshoot after waypoint #2 (90degree entry angle), and even #3 (45degree), but #4 (22.5degree) makes no sense to me. Its such a shallow angle there should be no problem whatsoever straightening out at the track and following it right on, especially with a Xtrack gain of 225 as shown below, but Ardupilot is still pointing the plane *off* the track (based on the green line) until its well past, then it finally corrects and gets it right.3689430213?profile=original

 

 

Can anyone explain why the Xtrack entry angle causes the track overshoot after every waypoint, regardless of how low the entry angle is set? Of course the major problem here is that if there is any wind at all this angle needs to be set sufficiently high enough for it to correct for the wind, otherwise the plane is hopelessly lost. 

 

Something seems strange to me...

 

 

Read more…

PID tuning for high winds...

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.

3689430020?profile=original

 

 

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.

3689429973?profile=originalResult #1 PIDs:

3689430063?profile=original

 

 

 

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.

3689430046?profile=original Result #2 PIDs:

3689429994?profile=original

 

 

 

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.

3689430076?profile=original

 

 

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:

xplane1_tuning_plan.h

xplane_pt_60_wind.param

 

Read more…