Difference between revisions of "Settings"

From PaparazziUAV
Jump to navigation Jump to search
(how to write a settings file)
 
(moved settings stuff here from telemetry page)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The grammar of the setting file is described in <tt>conf/settings/settings</tt>. It is a tree of named variables. Each variable is associated with a <tt>min</tt>, <tt>max</tt> and <tt>step</tt> attributes. These attributes are used to build the graphical interface of the settings page in the [[GCS]]. A simple entry looks like
== Settings ==
 
The <tt>settings</tt> attribute in the description of the aircraft in <tt>conf.xml</tt> allows the user to specify a list of variables for which values can be changed in-flight:
<source lang="xml"><aircraft
  name="Microjet"
  ...
  settings="settings/basic.xml"
  ...
/></source>
 
with the <tt>basic.xml</tt> file located in <tt>conf/settings/</tt>. A <tt>dl_setting</tt> element in this file associates [[GCS#Settings|buttons or sliders in the GCS interface]] to autopilot variables:
{{Box Code|conf/settings/basic.xml|
<source lang="xml">
<tt><!DOCTYPE settings SYSTEM "settings.dtd">
<settings>
  <dl_settings>
    <dl_settings NAME="flight params">
      <dl_setting MAX="1000" MIN="-50" STEP="10" VAR="altitude_shift"/>
    </dl_settings>
    <dl_settings NAME="mode">
      <dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode">
        <strip_button name="AUTO2" value="2"/>
      </dl_setting>
      <dl_setting MAX="1" MIN="0" STEP="1" VAR="launch">
        <strip_button name="Launch" value="1"/>
      </dl_setting>
      <dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle"/>
    </dl_settings>
  </dl_settings>
</settings></source>}}
 
where <tt>dl_settings</tt> elements can be nested at any depth. A <tt>dl_setting</tt> element just specifies the name of the variable, the allowed range for the setting (<tt>min</tt> and <tt>max</tt> attributes) and the minimal <tt>step</tt>.
 
A notebook page will be associated in the GUI to each <tt>dl_settings</tt> element. A slider will be associated to each <tt>dl_setting</tt> 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 <tt>strip_button</tt> element adds a button to the [[GCS#Strip|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 <tt>group</tt> is specified, all strip buttons of the same group will be placed vertically on top of each other.
 
The <tt>param</tt> attribute of a <tt>dl_setting</tt> element allows to specify the corresponding parameter in the airframe file in order to save a tuned value:
<source lang="xml"><dl_setting max="0.3" min="-0.3" step="0.01" var="ir_roll_neutral" param="IR_ROLL_NEUTRAL_DEFAULT" unit="rad"/></source>
where the <tt>unit</tt> 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 <tt>conf/settings/settings.dtd</tt>. It is a tree of named variables. Each variable is associated with a <tt>min</tt>, <tt>max</tt> and <tt>step</tt> attributes. These attributes are used to build the graphical interface of the settings page in the [[GCS]]. A simple entry looks like
  <tt><dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode"></tt>
  <tt><dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode"></tt>
More attributes may be added:
More attributes may be added:
Line 20: Line 63:
The image file must be located in the <tt>data/pictures/gcs_icons</tt> directory.
The image file must be located in the <tt>data/pictures/gcs_icons</tt> directory.


Some examples of settings files can be found in <tt>conf/settings</tt> ([http://cvs.savannah.nongnu.org/viewvc/paparazzi3/conf/settings/basic.xml?root=paparazzi&view=log basic.xml] and [http://cvs.savannah.nongnu.org/viewvc/paparazzi3/conf/settings/tuning.xml?root=paparazzi&view=log tuning.xml]).
Key accelerators can also be specified (using the GTK syntax to specify the keysym):
<tt><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></tt>
 
Some examples of settings files can be found in <tt>conf/settings</tt> ([https://github.com/paparazzi/paparazzi/blob/master/conf/settings/rotorcraft_basic.xml rotocraft_basic.xml] and [https://github.com/paparazzi/paparazzi/blob/master/conf/settings/fixedwing_basic.xml 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
 
[[Image:Ap_calib_sliders_via_rc.jpg|thumb|right|Use these up/down buttons for realtime tuning]]
 
The <tt>tuning_rc.xml</tt> file is located in <tt>conf/settings</tt>.
{{Box Code|conf/settings/tuning_rc.xml|
<source lang="xml"><aircraft
  name="Microjet"
  ...
  settings="settings/tuning_rc.xml"
  ...
/></source>}}
 
A <tt>rc_settings</tt> element in this file associates switches and sliders of the RC to airborne variables:
 
{{Box Code|conf/settings/tuning_rc.xml|
<source lang="xml">
<!DOCTYPE settings SYSTEM "settings.dtd">
<!-- A conf to use to tune an A/C using only the rc -->
<settings>
  <rc_settings>
    <rc_mode NAME="AUTO1">
      <rc_setting VAR="ir_pitch_neutral" RANGE="2"  RC="gain_1_up"  TYPE="float"/>
      <rc_setting VAR="ir_roll_neutral"  RANGE="-2" RC="gain_1_down" TYPE="float"/>
    </rc_mode>
    <rc_mode NAME="AUTO2">
      <rc_setting VAR="course_pgain"  RANGE="0.1" RC="gain_1_up"  TYPE="float"/>
      <rc_setting VAR="pitch_of_roll" RANGE=".2"  RC="gain_1_down" TYPE="float"/>
    </rc_mode>
  </rc_settings>
</settings></source>}}
 
First, settings are sorted by mode (<tt>AUTO1</tt> or <tt>AUTO2</tt>). Then a setting is composed of a <tt>var</tt>iable name, a <tt>range</tt> (corresponding to the range of the RC slider) and a <tt>RC</tt> name. The RC name prefix can be ''gain_1'' or ''gain_2'', which corresponds to the <tt>GAIN1</tt> and <tt>GAIN2</tt> channels of your RC transmitter [[Radio_Control|configuration]]. The RC name suffix can be ''up'' or ''down'', which is related to the position of the <tt>CALIB</tt> switch on the RC transmitter.
 
[[Category:Software]] [[Category:User_Documentation]]

Latest revision as of 03:58, 5 December 2015

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:

File: conf/settings/basic.xml
 <tt><!DOCTYPE settings SYSTEM "settings.dtd">
 <settings>
  <dl_settings>
    <dl_settings NAME="flight params">
      <dl_setting MAX="1000" MIN="-50" STEP="10" VAR="altitude_shift"/>
    </dl_settings>
    <dl_settings NAME="mode">
      <dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode">
        <strip_button name="AUTO2" value="2"/>
      </dl_setting>
      <dl_setting MAX="1" MIN="0" STEP="1" VAR="launch">
        <strip_button name="Launch" value="1"/>
      </dl_setting>
      <dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle"/>
    </dl_settings>
  </dl_settings>
 </settings>

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

Use these up/down buttons for realtime tuning

The tuning_rc.xml file is located in conf/settings.

File: conf/settings/tuning_rc.xml
<aircraft 
  name="Microjet"
  ...
  settings="settings/tuning_rc.xml"
  ...
 />

A rc_settings element in this file associates switches and sliders of the RC to airborne variables:


File: conf/settings/tuning_rc.xml
 <!DOCTYPE settings SYSTEM "settings.dtd">
 <!-- A conf to use to tune an A/C using only the rc -->
 <settings>
  <rc_settings>
    <rc_mode NAME="AUTO1">
      <rc_setting VAR="ir_pitch_neutral" RANGE="2"  RC="gain_1_up"   TYPE="float"/>
      <rc_setting VAR="ir_roll_neutral"  RANGE="-2" RC="gain_1_down" TYPE="float"/>
    </rc_mode>
    <rc_mode NAME="AUTO2">
      <rc_setting VAR="course_pgain"  RANGE="0.1" RC="gain_1_up"   TYPE="float"/>
      <rc_setting VAR="pitch_of_roll" RANGE=".2"  RC="gain_1_down" TYPE="float"/>
    </rc_mode>
  </rc_settings>
 </settings>

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.