-
Notifications
You must be signed in to change notification settings - Fork 602
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
mavutil: Return mode as 'Mode(msg.custom_mode)' for high-latency streams #779
mavutil: Return mode as 'Mode(msg.custom_mode)' for high-latency streams #779
Conversation
This also looks like we will no longer map the base mode to a string on ArduPilot. Could you put your two new lines just within the PX4 bloc there, please - just stop us reading those attributes within that block if the message is a Apologies for the breakage - we really should have picked this up. @stephendade FYI |
5b81644
to
bdb30c1
Compare
@peterbarker Just changed it. Is this what you had in mind? :) |
bdb30c1
to
c6318c9
Compare
FYI in ArduPilot, we do send the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
mavutil.py
Outdated
@@ -2272,14 +2272,19 @@ def mode_mapping_bynumber(mav_type): | |||
|
|||
def mode_string_v10(msg): | |||
'''mode string for 1.0 protocol, from heartbeat''' | |||
if msg.get_type() == "HIGH_LATENCY2": | |||
return f"Mode({msg.custom_mode})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use fstrings - python2 :-(
Really looking forward to dropping Py2 - I like fstrings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry - still have the f-string :-/
c6318c9
to
0f20b0b
Compare
Before, when reading HIGH_LATENCY2 messages that came from a PX4 controller mavutil threw an exception because after the check for PX4, `msg.base_mode` was read immediately. It was not regarded that the `HIGH_LATENCY2` message does not contain a `base_mode` field. This introduces a fix where the mode string for HIGH_LATENCY2 messages from a PX4 controller is returned as `Mode(msg.custom_mode)`.
0f20b0b
to
c0b3528
Compare
@peterbarker No worries, changed it to the way it's done at the bottom of the function. Hope it's alright now. :) |
Merged, thanks @dernatsch |
Before, when reading high-latency messages that came from PX4, mavutil threw an exception because after the check for PX4,
msg.base_mode
was read immediately. It was not regarded that theHIGH_LATENCY2
message does not contain abase_mode
field.This introduces a fix where the mode string for all
HIGH_LATENCY2
messages is returned asMode(msg.custom_mode)
.