ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Plane: Commanding a NAV waypoint outside of Auto mode has unintended effect.

Open mday299 opened this issue 13 years ago • 6 comments

This was encountered first during field flights. We wanted to modify a mission while the plane was still in flight, so we handed control to the pilot (Manual mode) whilst we were fiddling with nav waypoints. After the mission modification (still in Manual) we set the nav waypoint we wished to start with (e.g., wp 3). Then we had the pilot manually fly a good approach to this waypoint and switch to Auto. Upon switching to Auto, the plane did a crazy turn and headed for waypoint 2.

Similar tests revealed the plane always flies one waypoint previous that the intended waypoint if the waypoint change is specified during Manual mode. If waypoint 1 is specified then something quite strange happens: plane proceeds to waypoint 0 and loiters (won't do the mission at all without another waypoint command)!

This was all with the Mission Planner GCS. I later tested this in SITL with MAVProxy and similar behavior results.

I think I have narrowed this down to a line of code in APM:Plane in commands_process.pde ... the update_commands function does not allow commands to be updated outside of AUTO mode. When nav_command_index is decremented by the change_command method when the "change waypoint" command is sent, process_next_command never gets called and nav_command_index is stuck one index behind where it needs to be.

I will submit a patch shortly.

mday299 avatar Oct 19 '13 17:10 mday299

Is that a bug or do you simply use the 'Do_Jump' command?

Manual: http://copter.ardupilot.com/wiki/planning-a-mission-with-waypoints-and-events/

bstott avatar Oct 19 '13 18:10 bstott

Not sure why DO_JUMP would help there. Can you elaborate?

mday299 avatar Oct 19 '13 18:10 mday299

It looked like the example in the manual was describing a method to add interim waypoints or in your case alter or add more to your mission. I'm not working out the details nor doing missions yet but, from the read you would determine a point to inject your change and then use 'Do_Jump' to go to the new points. It, like all the rest, would take some thinking and ingenuity. I seem to recall reading something describing what you were trying to do but, sorry, do not have the link. --- Do_Jump....

bstott avatar Oct 19 '13 20:10 bstott

I appreciate that DO_JUMP can be used in that way and it would avoid the problem. However:

I have used DO_JUMP as you describe, but the underlying problem is that when a waypoint is specified in a manner that is totally supported by the GCS (manually specifying via GUI in Mission Planner, or command line in MAVProxy) the plane flies to a completely unexpected waypoint.

mday299 avatar Oct 20 '13 00:10 mday299

Thank you for bringing this bug to light. It has happened to me on a couple occasions and I always figured I had done something wrong.

iskess avatar Oct 20 '13 01:10 iskess

fixed long ago

magicrub avatar Jul 22 '15 20:07 magicrub