Why did Pixhawk auto mission halted in the middle?

Hi,

I had a failed auto mission with Pixhawk 2.4. In fact it followed the first waypoints fine until it was in between waypoint 5 and 6 (on a total of 9 waypoints). My X8 halted first 20 meters away from the 6th waypoint, it started slowly to descent from its 50m programmed altitude (as if it started to land) but then stopped in a hovering position 15 meters high for what seemed an eternity then started again its descend and landed. It landed thus in betrween two waypoints. In the meantime mission planner, with telemetry connected, had spoken all the waypoints, telling me the craft reached waypoint 9 ! There was no failsafe nor any other abnormal messages that i have noticed on mission planner.
How could that be mission planner thinks the drone is landing at waypoint 9 (last mission point) when the drone is actually not even at waypoint 6 ??

At least I did not loose the craft. I post hereunder mission planner screens and the mission log for anyone who could help me understand what happened, because I need to find the root causes of this failed auto mission.

I suspect this is because it doesn’t have to hit waypoint 8 to move on to LAND. It started navigating to 8 and then immediately started executing the LAND because LAND isn’t a nav command (it is more like a DO command)

Confusing, I know.

Long term, it’s probably going to be replaced by mission scripts on powerful hardware like pixhawk.

Will try to confirm with your log.

Your log is corrupt, can’t confirm. Please get it off the SD card.

thx for helping. I am able to open the log, so it does not appear corrupt; I try to attach it again.
Also I looked at the log and found this weird thing : if I filter on the CMD type of messages, I find this list of waypoints in the log which “repeats” the waypoints up to waypoint 6. How can that be ? (see screenshot)

I want to add/correct some info : the X8 landed BEFORE waypoint 6, not after so your explanation about the LAN command executing before reaching waypoint 8 is not right I guess.
In addition in an auto mission the LAND command always execute right after the previous waypoint command, which is waypoint 8 in my script, so it would not have landed right after waypoint 6. (for info waypoint 7 was a DO SET commanbd to stop the CAM-TRIGG-DIST)

Hope you can find out more analyzing my log, thx.

[quote=“Hugues”]I want to add/correct some info : the X8 landed BEFORE waypoint 6, not after so your explanation about the LAN command executing before reaching waypoint 8 is not right I guess.
In addition in an auto mission the LAND command always execute right after the previous waypoint command, which is waypoint 8 in my script, so it would not have landed right after waypoint 6. (for info waypoint 7 was a DO SET commanbd to stop the CAM-TRIGG-DIST)

Hope you can find out more analyzing my log, thx.[/quote]

I believe it would have executed both the DO_SET command and the LAND command in immediate sequence as soon as it decided that it had hit waypoint 6.

Edit: sorry no, it would’ve executed the DO_SET command as soon as it started navigating to waypoint 6. Then when it hit waypoint 6 it would execute the LAND.

I can’t confirm properly that it was this and not a fail-safe because again, your text log files are corrupt and missing data. Please post the .BIN log taken directly from the PIXHAWK’s SD card, per the sticky I made in this forum.

But why do you ignore waypoint 8? (Land command is after waypoint8). And the drone landed just BEFORE reaching waypoint 6. So I don’t understand your explanation, it makes no sense.

My SD card just contains an empty APM directory, no bin files. By the way I posted on pixhawk sub forum an issue with SD card not being detected when booting; I have to reformat the SD card before each new flight…
I guess pixhawk still lacks reliability and has these unexplained erratic behaviors.
And why is it I can open the log file just fine and you can’t?? Nothing logical here.

For a zero-delay waypoint, it will judge when it needs to start turning towards waypoint 8 and turn early. Testing if this result is repeatable will tell you if I’m right or not. If it happens again with the same mission, then I am right, and you can fix it by adding a copy of waypoint 8 after waypoint 8 (put a delay on waypoint 8, too.)

This is a known issue. Have you talked to 3dr support? They will probably send you an SD card that will be reliable. The Kingston card in mine has not yet become corrupt.

The behaviors aren’t erratic unless you can prove them to be erratic. See if the LAND is repeatable.

I’m not saying I can’t open your log file. I’m saying that it has missing data and it ends in midair. This isn’t a brownout crash so clearly it is corrupt. There is a NuttX bug in the released version of copter that causes these problems when downloading logs over the CLI.

Further, I never said I was right, I said that I have a suspicion and that I want to confirm it. In order to confirm it now, it must be repeatable. If it isn’t repeatable, it was a failsafe causing it to land. Whatever happened, from your description it clearly decided to execute a LAND.

Sorry, if I had read your initial post better I could have told you with absolute certainty that I am right. Mission planner said that it reached waypoint 9, and then it landed. There’s your explanation.

Here’s how this would have happened:
Copter starts flying to waypoint 5, fetches waypoint 6 to measure turn angle.
Copter computes where it will start turning.
Copter hits the turn point, starts flying towards waypoint 6.
Copter fetches waypoint 7 and executes it because it is a DO command.
Copter fetches waypoint 8 and computes where it will start turning.
Copter hits turn point, starts flying towards waypoint 8.
Copter fetches waypoint 9 and executes it because it is a DO command.

This is how it has always worked.

If I understand you right, the next commands in the script are executed as fast as pixhawk can read them, without waiting for the previous command to have finished?
I thought that when you had a navigation waypoint in a script, pixhawk would wait for the GPS confirming it has reached this waypoint, before executing the next command in the auto mission script. Previously it has always worked like this for me!
So assuming it works as you say, what should have been my mission script to have the land command happen AT waypoint 8 (instead of before reaching waypoint6 as it did)?
Thx for your help, I appreciate it.

[quote=“Hugues”]If I understand you right, the next commands in the script are executed as fast as pixhawk can read them, without waiting for the previous command to have finished?
I thought that when you had a navigation waypoint in a script, pixhawk would wait for the GPS confirming it has reached this waypoint, before executing the next command in the auto mission script. Previously it has always worked like this for me!
So assuming it works as you say, what should have been my mission script to have the land command happen AT waypoint 8 (instead of before reaching waypoint6 as it did)?
Thx for your help, I appreciate it.[/quote]

There are sort of two categories of commands, I think they’re called nav commands and do commands. Do commands are executed immediately, and nav commands are executed when the last waypoint finishes. It is kind of silly and arbitrary, but I think we’re probably going to move to scripts before we fix it.

how should the auto mission commands be corrected to work correctly?

I believe copter’s default behavior is to land after a mission is complete, so you could just remove the land and put a short delay (2 seconds) on waypoint 8 so that it doesn’t land at the waypoint radius.

Otherwise you need to add a copy of waypoint 8 just before the LAND and then put a short delay (2 seconds) on the original waypoint 8 so that it doesn’t land at the waypoint radius.

Additionally, you’ll want to swap waypoint 7 (DO_SET_CA…) and waypoint 8 so that the DO_SET is triggered when I assume you want it to be.

Thx.
I remain still very puzzled for two reasons: for the last two years almost I am flying auto mission, the waypoint commands never have worked like that (on APM, maybe there is a difference with the way Pixhawk interprets auto missions?) And the second reason is the wiki does not explain what you have showed here.

I believe the problem is:

Your Land command has no coordinates. It is therefore a conditional command, and not a discrete command such as “land HERE”. I think it you give it some coordinates, it will land exactly where you want. In fact, you could just replace WP8 entirely with a Land waypoint with coordinates. It should fly exactly there, then land. I believe you can put coordinates on the Land command, if you right click on the map, and select “Land” that will set a Land command, with those coordinates.

So, to explain what actually happened here:

The conditional commands are executed immediately after the waypoint proceeding them. You also have to understand the way copter navigation works. There is a “leash” which leads the copter around, and it is actually ahead of the copter at all times. The leash is what actually follows the waypoints. So, due to the speeds involved, I think the head of you leash actually hit WP8 before the copter actually reached WP 6. Once the head passed WP8, it triggered the conditional “land now” function.

Thx Rob, that makes it clearer on how it works.
I guess it would be useful to protect users like me by “auto scripting” protection, a bit like auto spelling correction, to avoid creating scripts that look perfectly ok but could be dangerous. In my specific case the X8 landed dangerously close to trees and luckily in a place close enough where I could intervene in manual control if needed. But if this land action, because of such a confusing script logic, happened 100 m away, I would have been in trouble.
More simply, the script logic should be …logic and we should not have to know the underlying programmatic logic to build such a simple auto mission.
Maybe this a theme to consider for future improvements if not already on the board.
Thx