dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.6k stars 1.44k forks source link

Add VFR_HUD info #150

Open maruina opened 9 years ago

maruina commented 9 years ago

I'd like to add the support for all the info you can find under VFR_HUD:

I have a PR ready with a new class, HUD. If you think it's better to add these as vehicle's attributes, I will change my code and submit a PR.

hamishwillee commented 9 years ago

Well, airspead, and groundspeed are already in the vehicle class. I think that velocity gives you the three elements for a heading (or were you thinking something else)?

What is the climb? Pitch angle? Is this something that you can get from Vehicle.attitude? Or again, is it an element from the velocity value?

For throttle, are you after the current channel value? This can be set using channel_override and default values (I think the throttle is channel 3). Are you just trying to get it, or set it? My concern here is that generally people shouldn't be setting throttle (or any channel_override), but instead using commands like takeoff and the change speed messages (in AUTO).

My general thoughts are:

@mrpollo - thoughts?

maruina commented 9 years ago

Since I wanted to add some attributes and they are all grouped under the same mavlink message, I thought would have been useful to have all of them under the same class like Attitude, Battery and Location, but maybe this is too much opinionated :)

hamishwillee commented 9 years ago

Hi @maruina Thank you for the explanation. I guess this is kind of a "philosophical" question - Python tends to promote just one way to do stuff, and having separate classes duplicates information. On the other hand, if the aim is to provide a nice wrapper for sending MAVLink commands, then it makes sense to map the MAVLink command structure.

Thinking about it I'm not sure which is better design. Having the information as vehicle attributes is only a little bit more obvious than having the vehicle own a HUD object to access the information. Deciding that we'll always extend the vehicle by adding an attribute that maps to the command type (like HUD) would significantly reduce the work in thinking about how the architect changes in future.

I don't know which philosophy @mrpollo subscribes to :-) Lets see. Thanks for your patience.