Settings

== Settings ==
The settings attribute in the description of the aircraft in conf.xml allows the user to specify a list of variables for which values can be changed in-flight:
 <aircraft 
 name="Microjet"
 ...
 settings="settings/basic.xml"
 ...
 />
with the basic.xml file located in conf/settings/. A dl_setting element in this file associates buttons or sliders in the GCS interface to autopilot variables:
where dl_settings elements can be nested at any depth. A dl_setting element just specifies the name of the variable, the allowed range for the setting (min and max attributes) and the minimal step.
A notebook page will be associated in the GUI to each dl_settings element. A slider will be associated to each dl_setting entry except if the range is small (typically less than 3) and discrete (step=1): in the latter case, a set of radio buttons will be displayed.
The strip_button element adds a button to the GCS strip for commonly used tasks like "Launch" or "Circle". Multiple buttons can be used to assign different values to the same variable. If the attribute group is specified, all strip buttons of the same group will be placed vertically on top of each other.
The param attribute of a dl_setting element allows to specify the corresponding parameter in the airframe file in order to save a tuned value:
 <dl_setting max="0.3" min="-0.3" step="0.01" var="ir_roll_neutral" param="IR_ROLL_NEUTRAL_DEFAULT" unit="rad"/>
where the unit attribute is required for the parameters which do not use the same unit than the corresponding variable (currently only for some angle parameters in degrees in the airframe file and in radians for the variable).
The grammar of the setting file is described in conf/settings/settings.dtd. It is a tree of named variables. Each variable is associated with a min, max and step attributes. These attributes are used to build the graphical interface of the settings page in the GCS. A simple entry looks like
 <dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode">
More attributes may be added:
* shortname="s" : s will replace the variable name for the label in the GCS
* module="m" : It specifies the file where the variable is coming from. A corresponding #include "m.h" will be generated in the corresponding C code.
* handler="h" : Specifies a macro to be called to do the setting. Associated with a module m the macro actually must be named m_h()
Buttons, packed in the strip in the GCS, may be associated to variables. They are described as strip children elements of a dl_setting element.
 <dl_setting MAX="1" MIN="0.0" STEP="0.05" VAR="v_ctl_auto_throttle_cruise_throttle" shortname="cruise throttle" module="fw_v_ctl" handler="SetCruiseThrottle">
 <strip_button name="Dash" value="1"/>
 <strip_button name="Loiter" value="0.1"/>
 <strip_button name="Cruise" value="0"/>
 </dl_setting>
For a prettier strip, an icon can be used for a strip button:
 <dl_setting MAX="200" MIN="-200" STEP="10" VAR="nav_radius" module="nav" handler="SetNavRadius">
 <strip_button icon="circle-right.png" name="Circle right" value="1"/> 
 <strip_button icon="circle-left.png" name="Circle left" value="-1"/> 
 </dl_setting>
The image file must be located in the data/pictures/gcs_icons directory.
Key accelerators can also be specified (using the GTK syntax to specify the keysym):
 <dl_setting MAX="200" MIN="-200" STEP="10" VAR="nav_radius" module="nav" handler="SetNavRadius">
 <key_press key="greater" value="1"/>
 <key_press key="less" value="-1"/>
 <key_press key="F10" value="100"/>
 </dl_setting>
Some examples of settings files can be found in conf/settings (rotocraft_basic.xml and fixedwing_basic.xml).
== Changing settings via R/C Transmitter ==
With the advent of small modems such as the popular Zigbee-based models, the usage of the R/C transmitter as a simple data-link is substantially less. Nevertheless, this feature may still prove useful for extremely minimal hardware configurations. Also very useful for tuning of some parameters that are best adjusted by the pilot while flying, such as IR pile neutral settings. While a laptop in the field may be the best for most part of the tuning for sometimes it is more convenient from the transmitter directly. For this it is best to have little more advanced transmitter. For example a Graupner JR MX-22 or alike. On these transmitter there are controls that are good for up and down setting 
The tuning_rc.xml file is located in conf/settings.
A rc_settings element in this file associates switches and sliders of the RC to airborne variables:
First, settings are sorted by mode (AUTO1 or AUTO2). Then a setting is composed of a variable name, a range (corresponding to the range of the RC slider) and a RC name. The RC name prefix can be gain_1 or gain_2, which corresponds to the GAIN1 and GAIN2 channels of your RC transmitter configuration. The RC name suffix can be up or down, which is related to the position of the CALIB switch on the RC transmitter.
Category:Software Category:User_Documentation