Initialize jump-tracking in AP_Mission::init()
The jump tracking array in AP_Mission only initializes when the mission is restarted, for example when disarming or when the waypoint is set to zero. This means it is possible for that array to never initialize, e.g. if you use Set WP to set the waypoint to anything other than zero after boot but before switching to Auto mode the first time.
It seems like AP_Mission::init() is an appropriate place to call init_jump_tracking.
I encountered this on a quadplane that uses RTL_AUTOLAND. It usually takes more than 30s after boot for me to connect, so it switches to auto mode and sets the waypoint to the landing sequence. Before takeoff, I set the waypoint to 1. In flight, my DO_JUMP commands were not working.
It's really easy to work around: I just set waypoint to 0 now instead of 1, but this should still be fixed.
@robertlong13,
Thanks for the contribution.
This looks like a good/harmless change to me although there are various ways that init_jump_tracking() can be called from the start and resume methods which makes me slightly suspicious that Plane is using the AP_Mission library differently than other vehicles. I wonder if this same problem happens with Copter.
It would be good to change the commit to be prefixed with "AP_Mission:" to match our regular style. To be clear, I mean the commit itself.. not the PR title.
~~Interesting, you're right, I wasn't able to reproduce the bug in Copter just now. When I get a chance tomorrow, I'll look and see why.~~
Actually, I was able to reproduce this in the latest Copter. Last night, I had accidentally disarmed, causing reset() to get called.
Great, txs. I've added this to the next dev call so it'll get discussed and possibly merged.