ardusub-gitbook icon indicating copy to clipboard operation
ardusub-gitbook copied to clipboard

pymavlink: read/set params improvements

Open ES-Alexander opened this issue 4 years ago • 1 comments

Existing docs could be updated to make use of master.param_fetch_*, and master.param_set_send or pymavlink.mavparm.MAVParmDict.mavset.

Would also be good to format the output values as floats, since not all parameters are integers (as brought up here). Likely worth changing to .format syntax (or f-strings, but since they require Python >= 3.6 they aren't compatible with the current companion, so would only work on the surface computer or a companion with a more recent Python version)

ES-Alexander avatar Sep 07 '21 02:09 ES-Alexander

Current example has a few other issues that should be fixed:

  • is incorrect about persistence of param_set_send - says it's temporary but it's not
  • needlessly requests param after setting, despite having already received a PARAM_VALUE response
  • mentions but doesn't show how to handle if no PARAM_VALUE response is returned within a timeout period
  • This approach may be a reasonable reference, although it's written for Python >= 3.8
  • should also cover how to make use of param_type (mavutil.mavlink.enums['MAV_PARAM_TYPE'])

ES-Alexander avatar Nov 02 '21 16:11 ES-Alexander