Repository navigation
Parameter Page
The ASM can edit parameters for a mavlink vehicle using the code written in pageParameters.ino
The parameters to be included on the page are currently (May 2013) defined as follows.
The parameters are enumerated at the top of uav.h, e.g.
enum PARAMS {
// PID Paramters
RATE_RLL_P,
RATE_RLL_I,
RATE_RLL_D,
RATE_RLL_IMAX,
// Parameter page parameters
WP_LOITER_RAD,
WP_RADIUS,
XTRK_GAIN_SC,
.
.
PARAM_COUNT
};
Note that the parameters on the parameter page start after the // Parameter page parameters comment (this is likely to change when the PID pages are updated).
Subsequently the parameters' mavlink type names are stored using progmem, e.g.
// Parameter page params prog_char param_16[] PROGMEM = "WP_LOITER_RAD"; prog_char param_17[] PROGMEM = "WP_RADIUS"; prog_char param_18[] PROGMEM = "XTRK_GAIN_SC";
These are then added to the paramTable
PROGMEM const char *paramTable[] = { param_0, param_1, param_2, param_3, ...};
Then the names of the parameters to be displayed to the screen are set in pages.h
PROGMEM const prog_char ParamNames[] = "Loiter rad\n" "Waypoint rad\n";
Next, the scaling of the parameters must be set, for example a parameter might hold an angle in micro-degrees. We would like to display that parameter to screen in degrees, so we have to divide it by 1000. Therefore the scaling of it is 10^(-3). This is handled via the ParamScales variable
const uint8_t ParamScales[] = { 0, 0, 2, 2, 2, 0, 0, 0, 0, 0}; // *10^(-x)
Additionally, we might want to edit the parameter to 1 decimal place, this is set in the ParamDPs variable
const uint8_t ParamDPs[] = { 0, 0, 2, 1, 1, 0, 0, 2, 2, 0}; // 99 in both denotes boolean
I have currently set the code to print all the parameters to the terminal when you download them. This can be used to work out the mavlink names and scaling. Simply open up a serial terminal and select request parameters from the commands page on the ASM. When parameters arrive they're printed to the terminal. e.g.
GPS UBLOX library test Connected to a new UAV UAV Type: Quadrotor Autopilot Type: Ardupilot Mega Requesting params SYSID_SW_MREV = 120.00 SYSID_SW_TYPE = 10.00 SYSID_THISMAV = 1.00