### 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?

﻿

• Developer

Mike - we did have a bug where the change altitude command only worked one direction (up if I remember).  I thought that had been fixed, but I could be wrong.  Please put a report in the issue tracker.

• Chris: Well the first part of the plan works fine, and its identical to the second part just with different altitudes and around a different waypoint.

I may have been a little misleading, the plane doesn't actually return to launch immediately, it continues through all the waypoints/commands as if it descended to the proper altitude and headed to the last waypoint, then RTL.

As you can see, entry #10 in the plan immediately after the last CHANGE_CONDITION_ALT (to descend) says jump to waypoint #13, so the only way I can see it getting to waypoint 13 is if it descended to the defined altitude, but it never does... It actually gets about half way through one loiter turn barely descending if at all then heads straight for waypoint #13.

Any other path through the plan tells it to repeat the loiter and change altitude... Assuming I'm reading it correctly that is...

• 3D Robotics

Are you sure you're following waypoint logic? From the manual:

"Note: When you're using the Jump command, remember that waypoint logic can be a bit confusing. A waypoint command means "start heading to this WP", not "wait until you get to this WP." So, for example, if you put a "Jump to WP1" command in-between WP4 and WP5, the aircraft will never get to WP4. That's because once it starts heading in the direction of WP4, it then executes the next command, which is the jump command, and which will execute immediately without waypoint 4 being reached. So in that instance, if you want the aircraft to hit WP4, you'd include the Jump command after WP5. Note that in some situations you will need to create a "dummy" waypoint to insert after the waypoints of interest as if the mission runs out of Navigation commands it will return to the home location."