pymavlink
pymavlink copied to clipboard
Update deprecated MAV_TYPE enum for tailsitter
Hi,
This fixes https://github.com/ArduPilot/pymavlink/issues/571.
With latest Pymavlink (master), the mavgen step works, but on trying to import mavutil, I get this error.
It seems that these two enums were changed, but weren't reflected in mavutil.py
- MAV_TYPE_VTOL_TAILSITTER_QUADROTOR was previously MAV_TYPE_VTOL_QUADROTOR
- MAV_TYPE_VTOL_TAILSITTER_DUOROTOR was previously MAV_TYPE_VTOL_DUOROTOR
I believe there is still a reference to the old enum name in Swift generator tests pymavlink/generator/swift/Tests/MAVLinkTests/Testdata/common.xml
, but I haven't run that locally.
So it was discussed with @auturgy @DonLakeFlyer @meee1 both in https://github.com/mavlink/mavlink/pull/1818 and also offline. The reasoning for the change is mostly here: https://github.com/mavlink/mavlink/pull/1808#issue-1157921604
- the description does not precluse the use of MAV_TYPE_VTOL_DUOROTOR for belly-sitters as well as tailsitters.
W.r.t. there is no such thing. Though note that I see https://mavlink.io/en/messages/minimal.html#MAV_TYPE_VTOL_TAILSITTER is misdocumented in the description to mention that removed concept. It should say MAV_TYPE_VTOL_TAILSITTER_DUOROTOR.
For a two rotor bellysitter you'd have to use MAV_TYPE_VTOL_FIXEDROTOR or a more specific MAV_TYPE_VTOL_FIXEDROTOR_DUO_ROTOR or similar. If that is invalid then yes, more thinking needed.
I've created a PR with an alternative approach here: https://github.com/ArduPilot/pymavlink/pull/898
That will let mavutil.py work with both old and new message definitions.
Why has this only just now become a problem? It looks like these renames happened quite some time ago, which should have led to the mavutil.py AttributeErrors?!?