ardusub-gitbook
ardusub-gitbook copied to clipboard
pymavlink: read/set params improvements
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)
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_VALUEresponse - mentions but doesn't show how to handle if no
PARAM_VALUEresponse 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'])