feat: Adding and implementing set_mavlink_version function in mavutil.py#1207
feat: Adding and implementing set_mavlink_version function in mavutil.py#1207noahredon wants to merge 3 commits into
Conversation
|
Tested with a v2-only dialect : set_dialect's auto-gen fallback hits an XML lookup that appearently doesn't exist for a single-version dialect... its not a bug in this PR that you made (existing set_dialect behaviour) but the new docstring is the obvious place to flag it since you are adding it :) something like an alert/warning would be nice to see |
ddd09aa to
453c3c8
Compare
5d01363 to
9c07a2e
Compare
|
Thanks for testing this and for the feedback! I just updated the PR to add a warning in the docstring about this specific edge case. To be honest, this is actually the behavior I was aiming for. It makes sense that the script fails and stops execution if it tries to load a dialect that doesn't exist for the newly selected MAVLink version. In this case, you only need to set the MAVLink version before the dialect, which makes sense. And for most cases (for example when using a common dialect like ardupilotmega), it works perfectly fine. Let me know if the updated docstring looks good to you! |
Hi! I thought having a simple function capable of changing the MAVLink version could be useful. For example, if you create a custom MAVLink dialect for MAVLink 2 only and don't change the version before setting the dialect, the script will try to import the default MAVLink 1 dialect, which will crash.
I've tested it, and it works as expected.
I also implemented it in mavfile.auto_mavlink_version for better readability.