-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_Mission: better deal with home being in index 0. #29071
base: master
Are you sure you want to change the base?
Conversation
…when adding or replacing commands
…ill add home automaticaly
I have updated the copter |
I have updated mission write to not change |
This is a result of the discussion on #29039. The two key things are:
AP_Mission::add_cmd
will add home if needed and then add the passed in command so that the passed in command is always added and not lost in index 0.AP_Mission::replace_cmd
will not replace the command in index 0, but it does still return true in that case.AP_Mission::write_home_to_storage
will set_cmd_total
to 1 if it is 0.There are also a number of clean ups and bug fixes:
present()
method on mission which consolidates all the places that were trying to tell if there was a mission. We had been usingmission.num_commands() > 1
andmission.num_commands() <= 1
ormission.num_commands() < 2
for not present. This also replacesmission.num_commands() == 0
which copter was using incorrectly forAUX_FUNC::SAVE_WP
AUX_FUNC::SAVE_WP
and remove the need for the workaround in roverAUX_FUNC::SAVE_WP
write_home_to_storage
so it will always be upto date and we don't have to do it in rover and plane manually.The AHRS auto set of the home mission item is the only one users might notice, this was only done on plane and rover previously. Because it now also updates
_cmd_total
it is now more likely to be 1 than 0 with no mission loaded.