We always say the best thing about ArduPilot is there are a thousand+ parameters and the worst thing about ArduPilot is there are a thousand+ parameters…
I’ve been thinking that it might help if there were at least some guidelines for parameter names, (if not “standards”) which were generally followed. It really would help to improve the useability of ArduPilot for non-developers.
So sure there are reasons for some of the naming issues. The 16 character limit on the length of a parameter name (which really should be addressed), does create challenges.
So I’m going to take a stab at suggesting some guidelines. I’m doing it here so there can be discussion, and I plan to CHANGE my proposals (this post) as the discussion progresses.
This is just a suggestion for go-foward new parameters or any refactoring, it’s not a suggestion for a wholesale renaming of parameters now, (even though I use some existing parameters as examples).
Interestingly most of the Q_ parameters seem to follow these rules.
General Principles
- Names should have a logical structure (see below)
- Names should not have information embedded that is included in the metadata (e.g. units)
- Abbreviations should follow some standard rules
- Certain standard agreed abbreviations and qualifiers should be used
- Abbreviations should generally be used even if not needed due to the 16 character limit (this should be able to be dropped if the 16 character limit can be fixed)
- Underlying sub-system names should be hidden from end users
- use pitch, roll and yaw instead of elevator, aileron and rudder
Names should have a logical structure
It helps people to understand things when there is a logical structure that makes sense, but with ArduPilot there can’t be just one logical structure because there are several different kinds of concepts at play. I think this doesn’t mean we need to fall back to a “case by case” basis, I think it can mostly be done by having several broad categories of structures that can be applied. Here are my suggestions:
Entity_attribute, Entity_attribute_qualifier/function.
Feature_attribute, Feature_attribute_qualifier
Lets look at each one of these with some examples:
Entity_Attribute or Entity_Attribute_qualfier/function
I think “TRIM_PITCH” is a good example of this, because as far as I can see it is so obvious that “PITCH” is the entity here. Pitch can exist by itself, but trim makes no sense unless applied to something. So this should be PITCH_TRIM, ROLL_TRIM, YAW_TRIM, THR_TRIM and not TRIM_PITCH, TRIM_ROLL, TRIM_THROTTLE and TRIM_YAW - trim is the attribute and it only makes sense when it is an attribute of an “entity” - pitch, roll, yaw, throttle, etc.
By adding the qualifier at the end you get sensible things like PITCH_TRIM_MAX and PITCH_TRIM_MIN.
I would argue that this would make strange parameters like KFF_THR2PTCH_MIX and KFF_RDDRMIX a lot easier to understand and find because they would be something like:
- PITCH_THR_MIX
- YAW_ROLL_MIX
Now you could use the same thing for FENCE. Fence is an “Entity” and other things that apply to fences should be FENCE_attributes. All the existing FENCE_ parameters comply with this rule.
Following this logic, WP_MAX_RADIUS should have been WP_RADIUS_MAX, or maybe WP_RAD_MAX. WP_LOITER_RAD is a good name by this rule, but RTL_RADIUS should probably have been RTL_LOITER_RAD.
I think something using the word “cruise” was suggested as a replacement for FBW_ARSPD_MIN and FBW_ARSPD_MAX. That probably makes a lot of sense. These don’t really have anything to do with FBW, so these might become
- FBW_ARSPD_MIN → CRUISE_ARSPD_MIN
- FBW_ARSPD_MAX → CRUISE_ARSPD_MAX
- FBW_ELEV_REV becomes something like CRUISE_PITCH_REV
Feature_attribute or Feature_Attribute_qualifier/function
Takeoff or landing are good examples of these. They are features or functions, so all things that apply to each should start with the feature TKOFF and LAND.
The existing TKOFF_THR_MINSPD - probably should be TKOFF_THR_ARSPD_MIN but that’s > 16 chars, so as is makes sense.
USE_REV_THRUST is a good example of an existing parameter that might be better if it follows this rule - should be THRUST_REV_USE (Feature_attribute_qualifier).
Abbreviations and Qualifiers
English has a fairly standard set of rules for abbreviations. You can find lots of suggestions online. I like these simple rules
- Shorten long words by using the beginning of the word. THROTTLE becomes THR.
- Omit vowels starting at the right and once the vowels are gone, start dropping consonants from the right - SPOILER becomes SPOILR or SPLR or SP.
- Use just the first and last letter of monosyllabic words - MOUNT becomes MT
- Use acronyms when it makes sense - eg. FBW for Fly by Wire, RTL for Return to Launch
Following these rules Differential Spoiler should probably have become DIFFSPLR or DIFFSP (rather than DSPOILR)
Some standard abbreviations should be used as a general rule:
MAN - rather than MANUAL
FLTMODE (or FLTMD?) for Flight mode
YAW, PIT, RLL, THR for yaw, pitch, roll, throttle - IMO PTCH should be deprecated.
_MASK - used for all bit masks, except for _AXES which is a special case bitmask
_OPTIONS - used for options
TH for threshold because the current use of THR can easily be confused with THRottle
ARSPD for airspeed - never AIRSPEED. SPD can be used if 16 characters is a challenge but should be avoided if possible.
_LIM not _LIMIT for any limits - e.g. LEVEL_ROLL_LIMIT should have been LEVEL_ROLL_LIM
ALT should aways be used for altitude - HEIGHT, HGT, etc. should never be used.
Again - This is just a suggestion for go-foward new parameters or any refactoring, it’s not a suggestion for a wholesale renaming of parameters now, (even though I use some existing parameters as examples).
Please add suggestions, additions, improvements or disagreements below and I’ll update the main article based on the discussion.