Skip to content

fix mission sysid for mission_ack#23684

Merged
sfuhrer merged 6 commits intoPX4:mainfrom
Dani3L9H:fix_mission_sysID_implementation
Oct 8, 2024
Merged

fix mission sysid for mission_ack#23684
sfuhrer merged 6 commits intoPX4:mainfrom
Dani3L9H:fix_mission_sysID_implementation

Conversation

@Dani3L9H
Copy link
Copy Markdown
Contributor

@Dani3L9H Dani3L9H commented Sep 17, 2024

Solved Problem

While connected over a groundstation and e.g. using a separate instance like MAVSDK to also download a mission, there will be timeout warnings in the groundstation when trying to make operations in the mission like clearing it.

This is due to the fact that PX4 currently stores the system and component ID of the last connection partner who uploaded or downloaded a mission. When a mission clear command is received by PX4 it sends the Ack to the last learnt connection partner and not to the partner who send the clear request.

Solution

  • Make sure that the mavlink ack is actually sent to the right connection partner who requested it.
  • Make sure that PX4 only accepts mission items from the connection partner who sent the mission upload request
  • Make sure to only accept a mission request item from the connection partner who requested the mission download
  • Make sure a mission count from another partner is ignored, when a mission upload is in progress
  • Do not send a mission count to the ground system if the mission changed. This will break the current behavior, but there is a better way to detect mission changes over the mission ID

For release notes:

Bugfix: Make sure to send Mavlink mission response to the right connection partner if multiple connections are made requesting the mission.

Alternatives

We could keep the mission count being sent but then PX4 needs to keep track of the connection partner who are interested in the mission and sent it to each of them. This was not deemed worthy to implement as each partner has the ability to detect a mission change over the mission ID, which is anyways more robust.
What is still missing is that the jump mission item the jump counter is still only sent for the last connected partner. But instead of sending a mission item the jump counter should have a separate mavlink message which can be broadcasted. Would need to be implemented in a separate PR.

Test coverage

Tested in SIH connecting a groundstation (with AMC and QGC) and an APP using MAVsdk to download the mission. Different possible mission interactions (download, upload, save, clear) were tested.

@KonradRudin KonradRudin self-requested a review September 18, 2024 06:46
Copy link
Copy Markdown
Contributor

@KonradRudin KonradRudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending the PR. This part seems to be very buggy when you connect with a second instance trying to read the mission. However, i think there are more things that need to be changed:

@KonradRudin KonradRudin self-requested a review September 18, 2024 16:00
@KonradRudin
Copy link
Copy Markdown
Contributor

KonradRudin commented Sep 20, 2024

I mae a proposal now for the fixes. @Dani3L9H Can you please retest? Just have most of my requests addressed. Except: This

one is tricky: https://github.com/Dani3L9H/PX4-Autopilot/blob/a76095030ec51dcd797c9eae701670774113beee/src/modules/mavlink/mavlink_mission.cpp#L539 its in the send function which gets periodically called. But where to we send the update for a jump item if it changed? Currently it is send to the last identitiy who up/downloaded the mssion. At least we would need to make sure it is send to the GCS if your isntance is also needing this information then we would need to distribute it to all. I think the send to GCS is an acceptable first step.

However, this is not so easy to be solved, and the system should preferably just broadcast a change in the jump counter instead of sending it to one specific partner only. So we do not need to keep track of it

Also with 4753aec i removed the mission count when the mission has changed. AS now we could detect if a mssion has changed over the MISSION_CURRENT id. I do not know if we should already remove this as i don't think it is already implemented in QGC. However i would be in favor to remove it

@KonradRudin
Copy link
Copy Markdown
Contributor

I have created an issue in QGC to use the mission ID in the MISSION_CURRENT message to detect plan changes:
mavlink/qgroundcontrol#11915

@Dani3L9H
Copy link
Copy Markdown
Contributor Author

I tested it and it looks good.

@KonradRudin KonradRudin dismissed their stale review October 7, 2024 15:22

Reviews addressed by myself. Need someone else to check

@sfuhrer sfuhrer merged commit daf604b into PX4:main Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants