dronekit / dronekit-python

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

Command API does not sufficiently abstract MAVLink_mission_item_message #67

Open hamishwillee opened 9 years ago

hamishwillee commented 9 years ago

The Command object is, I believe, a thin wrapper around a mavutil.mavlink.MAVLink_mission_item_message. It allows you to create a command object like this:

cmd = Command(0,
      0,
      0,
      mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT,
     mavutil.mavlink.MAV_CMD_NAV_WAYPOINT,
      0, 0, 0, 0, 0, 0,
       lat, lon, altitude)
cmds.add(cmd)

The values of the parameters are the same as the mavutil.mavlink.MAVLink_mission_item_message and I believe this to be a bug.

The problem is that I don't believe that most of these can or should be set by the user. It may be that they are already correctly set by the system, but IMO they should also be hidden. If we can't hide them we need to clearly state what values can be set, and this is not documented anywhere!

Specifically

So in summary, lets hide target_system, target_component, seq, current, autocontinue from the API.

hamishwillee commented 9 years ago

@mrpollo You indicated that target_system, target_component, sequence number are handled by the API. As understand it you disagreed with removing them from the API because even though they aren't particularly useful right now (and are not necessarily implemented in Autopilots) there is no reason they might not be useful in future. I see your point.

I'm keeping this open and assigning to you because AFAIK there is still no real purpose for exposing: seq (the mission handling code should always handle this), current and autocontinue are both not used/meaningless and unlikely to ever be useful. If you still think this is not needed, then feel free to close.