fix(mavlink): execute CONDITION_DELAY mission items as NAV_DELAY#27453
Conversation
MAV_CMD_CONDITION_DELAY was accepted on upload but mapped to a nav_cmd
(112) that no navigator code recognizes, so the mission feasibility check
rejected it ("unsupported cmd") and its delay was never executed. PX4
already implements an identical seconds-hold via NAV_CMD_DELAY, whose
duration comes from param1 (params[0], aliasing time_inside). Map
CONDITION_DELAY to NAV_CMD_DELAY at parse time so the requested hold is
honored, reusing the existing, tested delay execution and feasibility
logic.
Fixes PX4#27289
Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
julianoes
left a comment
There was a problem hiding this comment.
Should we rename NAV_CMD_DELAY to MAV_CMD_CONDITION_DELAY?
No. There are two messages (MAV_CMD_NAV_DELAY and MAV_CMD_CONDITION_DELAY). The difference being that This is the easiest fix in that it should work. I do not love it because it promotes poor "future" MAVLink hygiene - if someone populates param2,3,4,5 on the MAV_CMD_CONDITION_DELAY these could in theory be unintentionally handled in the same way if that message is extended. The proper MAVLink thing to do would be for Given that we widely do not properly support rejecting unsupported params, this is perhaps overkill. |
|
Oh, sorry, I hadn't seen the mavlink command equivalent. |
@julianoes It was news to me too that there was an alternative MAV_CMD too - I had kind of assumed it wasn't implemented anywhere ... Note that I left it to you to decide whether this quick fix is reasonable or we should ask for separate handling of this command. |
|
I’ll keep this PR focused on making I agree the stricter MAVLink handling would be to validate unsupported params separately for |
hamishwillee
left a comment
There was a problem hiding this comment.
I’ll keep this PR focused on making
MAV_CMD_CONDITION_DELAYexecute correctly by mapping it to the existing delay behavior.
Thanks @anoshyn. Sounds good to me.
#27541 is going to do param checking, so provided we update that to check each of these commands separately it should be much harder for later updates to this to break for extensions to later break MAV_CMD_CONDITION_DELAY handling silently.
I'm going to merge as @dakejahl has approved it and @julianoes seen it too.
A mission item with
MAV_CMD_CONDITION_DELAYis accepted during upload but parsed into anav_cmdvalue (112) that no navigator code recognizes. As a result the mission feasibility check rejects the mission ("unsupported cmd: 112"), and even if it reached execution the requested hold would never run — the delay duration is effectively lost.PX4 already implements exactly this behavior through
NAV_CMD_DELAY, which holds at the current position forparam1seconds (stored inparams[0], which aliasestime_inside). SinceMAV_CMD_CONDITION_DELAY'sparam1carries the same delay-in-seconds, this maps the command toNAV_CMD_DELAYat parse time, so the hold is honored by the existing, tested delay execution and feasibility logic without duplicating it.Behavior is identical to a normal
NAV_DELAYitem: the vehicle holds position for the requested duration, then continues. LikeNAV_DELAY, the item is uploaded in theMAV_FRAME_MISSIONframe.Fixes #27289