If a mission is deleted from the drone no mission_changed event is triggered if it's deleted using the MAV_MISSION_TYPE_ALL-type. As can be seen in [0] the MAV_MISSION_TYPE type is checked. If it is MAV_MISSION_TYPE_ALL no mission_changed event will be triggered despite the mission changed (was deleted).
Thanks for reporting! Would you be willing to open a pull request to fix this?
Sure, just give me some days.
Might be related. I Just wanted to open a bug report for the python mission_changed subscription not working. Looks like it has a related problem. QGC seems to upload missions with mission type 2 (MAV_MISSION_TYPE_RALLY) which also does not trigger a mission changed event.
Also in case of deleting a QGC mission the result type is 2. I guess this is a design choice if you want to trigger an event in any of the cases. I would suggest doing so as it is a mission in every case? At least MAVLINK calls it MissionItems even for the Geo-Fence points.
see MAV_MISSION_TYPE
Still gonna open the python-report and link it so others know about it.
@JonasVautherin : it seems like the problem is even deeper.
As far as I can tell then drone just doesn't sent the MISSION_ACK command to anyone except for QGC.
I even tried running QGC with the same sys-id as mavsdk. QGC reports MISSION_ACK messages with sysid 1 and comp id 190 but the mavsdk does not receive such a packet. It seems like this message alone is not enough to report mission changes, not sure how QGC does it so accurate.
Can you describe your setup? Is it something like below?
Can you reproduce the bug with SITL?
I can't test it with a real drone ;)
Its the setup described in https://github.com/mavlink/MAVSDK-Python/issues/244 except for the python part.
Drone is a px4-gazebo setup from https://github.com/PX4/Firmware.git, I am using tag v1.10.2
MAVSDK is udp://:14560
QGC uses whatever its default is
QGC seems to upload missions with mission type 2 (MAV_MISSION_TYPE_RALLY) which also does not trigger a mission changed event.
This would be expected, because rally points are not technically mission items. And they are not supported with MAVSDK yet, I think.
Feels a bit strange I would say. I mean, it is called "MAV_MISSION_[...]".
Does that mean that the current behavior is the intended one?
If so this should probably be noted somewhere in the documentation. I mean the API endpoint states that it is meant to be used to detect mission uploads from other GC stations and QGC is as far as I know one of the most widely used ones ?
Or could we just add another parameter (mission_type) into the detection which is returned so one knows which kind of "mission" was changed?
It is called MAV_MISSION_ because it re-uses the mission messages for upload. But the "MISSION_TYPE" is RALLY.
I would say it's the correct implementation but we should add a rally_points_changed() notification for rally points.
I'm closing this because I think this would need to be fixed as part of a rally points plugin. To me it has not much to do with the mission_raw plugin which only handles MAV_MISSION_TYPE_MISSION for now.
@Jonsen94 feel free to start a PR in https://github.com/mavlink/MAVSDK-Proto if you want to add a rally plugin.