-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
MISSION_ITEM_REACHED not sent in SITL #8245
Comments
I can look at this, but when is MISSION_ITEM_REACHED (http://mavlink.org/messages/common#MISSION_ITEM_REACHED) actually needed? Isn't knowing the current waypoint you're on (MISISON_CURRENT) usually enough? |
I suppose you can use See mavlink/mavros#830 as well |
What were the 2 mission items above? |
CMD 16, NAV_WAPOINT. What I did: Take off, send mission, and put FCU in AUTO.MISSION. |
@dagar From a quick look, I can tell that navigator is calling the function to set the item as reached here https://github.com/PX4/Firmware/blob/e9e663432b397e939db0a0e20a7f9fbf242dbf06/src/modules/navigator/mission.cpp#L209 which is defined here But, when the mavlink module checks the mission item at the line I referenced above, it is false. Perhaps the reached flag is getting reset somewhere? |
You're definitely on the right track. I'm wondering if it's the takeoff logic (mission started from landed?). |
@dagar Nope. It isn't related to takeoff. The problem is that it's being reset to false by If I comment out this line (in Also, be aware that I've only been looking at this with SITL. HITL testing is probably necessary as there are time driven events happening also. So, if you open up QCG connected to a SITL environment (multicopter), put a few WPs out there and drag the slider to start the mission from the ground, you will get a message for each WP reached following the takeoff with the line mentioned earlier commented out. As it is now, you only get one message, once the mission is finished (seen by Lastly, you'll see that multiple duplicate reached messages are seen due to the condition here |
Yes, the handling with mission_result is a bit of a mess and needs to be sorted out. It's been the source of several other issues. Continuously publishing the reached bool and sequence number doesn't really make sense to me. When should we switch over to "no longer reached" for the next waypoint? It seems like navigator should be broadcasting once for each waypoint reached (and the seq number), but otherwise nothing. For mavlink it's necessary to continue streaming the messages periodically. These messages aren't acknowledged by the recipient. Great work looking through the code in detail. |
I'd expect to get a message with I guess you could find a different way/place to call We could also make a comparison with the |
Comparing seq_reached and seq_current in mavlink is another (potentially easy) option I was thinking about, but when should mavlink stop broadcasting the last waypoint reached? How about...
Does that cover everything? |
I'm assuming that by mavlink broadcasting you're referring to the In reality this isn't continuously sent (at least not in SITL -- because I'm not sure if this still works as intended here: I'm with you in that constantly sending this I also think the From a quick look (just now) at ArduPilot, they just send the mavlink message once, upon reaching the item (essentially make navigator publish the mavlink message directly I think). But I did see some open issues relating to the issue. Again, can't we just remove the line in |
It's not even a race condition (navigator is a single thread), just dumb code. With mavlink 2 you could add new fields, but this quickly gets into a larger discussion for mission protocol improvements. One thing I've wanted is a mission hash to ensure the GCS and vehicle are actually in sync. |
Could you open a PR for the mission reached change? Otherwise I can do it after the v1.7.0 release is out (hopefully next week). |
@dagar According to the Waypoint protocol: http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_reached_status_message_from_mav This message shouldn't be sent continuously. It should only be sent when the WP is reached. I recommend making it adhere to the protocol as defined, just like ArduPilot has. So, after the I'm not sure of the motivation in #5486 that made this change. The current mission is sent continuously with the current seq #. It makes not sense to continuously publish the last seq # reached when you have the current seq #. @LorenzMeier @julianoes thoughts? I called it a race condition because there are multiple places modifying the value of |
I've submitted a PR adhering to my comments above. See #8332 |
Per the merged PR, we're now sending the mavlink message when the item is reached, then another 10 messages, at the rate of broadcast for other mavlink mission items (currently 10Hz). The duplicate messages are sent because there is no ack and we wanted to reduce the chances of a missed message due to poor telemetry links. Closed. |
Bug Report
MISSION_ITEM_REACHED is not being sent for every WP reached. Verified using MAVLink Inspector in QGC, then set
mavlink verbose on
.Console output:
I loaded a mission with 2 waypoints. Expected to receive a reached message for seq 0 and didn't. Instead, got multiple reached messages for seq 1 once it was reached.
Related to something around here? https://github.com/PX4/Firmware/blob/3c18be387cc47c9875137745b171e7ccec901f2e/src/modules/mavlink/mavlink_mission.cpp#L502
Ubuntu 16.04, ROS Kinetic, PX4 aa699cf (today's master)
The text was updated successfully, but these errors were encountered: