Expected MISSION_CURRENT behavior at end of mission?

Hi Folks -

We’re using the MAVLINK_MSG_ID_MISSION_CURRENT message to determine when our craft has begun it’s mission, and attempting to use it to determine when we’ve reached the last. We can successfully trigger our onboard sensors/processing after a particular waypoint is reached, but the last WP doesn’t seem to behave as expected.

We are basing this on the MISSION_COUNT returned from our Pixhawk. For instance if my mission were:

0-home
1-Takeoff
2-waypoint
3-waypoint
4-waypoint
5-RTL

MISSION_COUNT would return a 6. So we look for MISSION_CURRENT==5 (because >=4 would be before it reached 4)

When we reach waypoint 4, I would assume the a MAVLINK_MSG_ID_MISSION_CURRENT would be broadcast as a 5, because it is heading toward waypoint 5. Once it reaches five, does the APM then report heading to 0 (home)? Kinda tough to troubleshoot this on the bench. I spent about 10 minutes looking through the GitHub repo searching for instances of send_current_waypoint and the likes, but didn’t gain any insight.

Best Regards,
Jamie

Sorry I can’t help you with your query, but I notice that you have a RTL at the end of your mission. If I do that it changes the ALT from Relative to Absolute. I’ve not had this happening before on various missions.and I can not find any info in the GitHub about this happening. Latest Firmware and Mission Planner

Why not use MISSION_ITEM_REACHED?

Regarding your specific question, I don’t have a definitive answer. I’ve just (loosely) gone through code and I would say it would show as 6, but I’m not sure. In any case, I think that using the message I mentioned would be better - as at the point the mission ended, there’s no actual current mission item.

Maybe you can explain more - at what point do you see this? I have noticed some oddities related to ALT if I download a mission (from flight controller to Mission Planner), but ALT has not yet been a critical parameter for us so I’ve largely ignored it.

Short answer is that CURRENT_MISSION was the first status message that I encountered in searching around, and the first that I tried.

Long answer is that interfacing with Copter via MavLINK has been an absolute nightmare documentation wise, and so we take what seems to work and run with it. :slight_smile:

I appreciate the tip (thank you)! Will give it a shot.

Hi
If I save the mission to my computer, and then download it back into the Mission Page it stll shows Relative. Then write it to the Pixhawk. If I then read it back to the mission it has changed to Absolute. I did not try flying the mission as I did not want it to burying itself 90 mtrs down :slight_smile: