Difference between revisions of "Airframe Configuration"

From PaparazziUAV
Jump to navigation Jump to search
(added ahrs stuff)
Line 63: Line 63:
     <define name="BODY_TO_IMU_PSI"  value="RadOfDeg( 0. )"/>
     <define name="BODY_TO_IMU_PSI"  value="RadOfDeg( 0. )"/>
</pre>
</pre>
}}  
}}
 
 
=== AHRS ===
The [[Subsytems/ahrs|AHRS subsystem]] specifies which attitude estimation filter you are using, e.g. for the complementary filter:
{{Box Code|conf/airframes/myplane.xml|
<pre>
  <firmware name="fixedwing or rotorcraft">
    ...
    <subsystem name="ahrs" type="int_cmpl_euler"/>
  </firmware>
</pre>
}}
See the [[Subsytems/ahrs|AHRS subsystem page]] for more details.


=== Radio Control ===
=== Radio Control ===

Revision as of 08:12, 23 November 2011

About

The airframe file is the most important configuration file and contains all the hardware and software settings for your airframe. It describes what hardware you have and which firmware, sensors, algorithms, etc. you want to use and also holds your configuration parameters. All gains, trims, and behavior settings are defined with standard XML elements.

The XML airframe configuration file is located in conf/airframes/<yourairframe>.xml and always begins with a <!DOCTYPE airframe SYSTEM "airframe.dtd"> line.

Also see the wiki pages for fixedwing specific configuration and rotorcraft specific configuration.

Creating a new Aircraft

While the airframe file is where you configure most aspects of your aircraft, a fully specified aircraft needs several XML configuration files:

Each aircraft is assigned a name, unique ID and the associated configuration files in conf/conf.xml. To create a new Aircraft, click new in the menu A/C in the Paparazzi Center and select your new airframe file, etc. (or specify it by hand in conf/conf.xml).

Firmware and Hardware definitions

First you should specify which firmware you want to use, i.e. if you have a fixedwing aircraft or a rotorcraft:

File: conf/airframes/myplane.xml
  <firmware name="fixedwing">
     ...
  </firmware>

Select your Board

To specify autopilot hardware you are using and it's low-level settings you have to add a target "ap" (autopilot) with board attribute.

Select the appropriate hardware autopilot board you are going to use in your airframe: "twog_1.0", "tiny_0.99", "tiny_1.1", "tiny_2.1", "tiny_2.11", "booz_1.0", "lisa_l_1.0", "lisa_l_1.1", "lisa_m_1.0", "lisa_s_1.0", "pc"


File: conf/airframes/myplane.xml
  <firmware name="fixedwing">
    <target name="sim" 			board="pc"/>
    <target name="ap" 			board="tiny_2.11"/>
     ...
  </firmware>

Note that the "pc" is a special kind of "board", and is mostly used only for simulation flights of an autopilot via your computer.

Direct Makefile

Optionally you can also add a raw Makefile section. This is only needed in very advanced setups. For example when testing newly developed hardware.

IMU

Add the imu subsystem with the type you are using. Also see the IMU calibration page.

File: conf/airframes/myplane.xml
  <firmware name="fixedwing or rotorcraft">
     ...
    <subsystem name="imu"       type="aspirin"/>
  </firmware>

Paparazzi has a parameter to define the orientation of the IMU with respect to the body of the vehicle:

File: conf/airframes/myplane.xml
    <define name="BODY_TO_IMU_PHI"   value="RadOfDeg( 0. )"/>
    <define name="BODY_TO_IMU_THETA" value="RadOfDeg( 0. )"/>
    <define name="BODY_TO_IMU_PSI"   value="RadOfDeg( 0. )"/>


AHRS

The AHRS subsystem specifies which attitude estimation filter you are using, e.g. for the complementary filter:

File: conf/airframes/myplane.xml
  <firmware name="fixedwing or rotorcraft">
     ...
    <subsystem name="ahrs" type="int_cmpl_euler"/>
  </firmware>

See the AHRS subsystem page for more details.

Radio Control

Supported types are:

  • ppm
  • spektrum
  • datalink

Just specify the appropriate radio control subsystem in your firmware section, e.g.:

File: conf/airframes/myplane.xml
  <firmware name="fixedwing or rotorcraft">
     ...
    <subsystem name="radio_control"     type="ppm"/>
  </firmware>

Telemetry (Modem)

The modem protocol and baud rate must be set in both the airframe file and ground station. Any standard baud rate can be used, with 9600 being adequate and 57600 recommended for most users to allow high speed telemetry for more detailed flight data analysis. The actual data rate is determined by the number of messages being sent and the period of each message as defined in your telemetry file, e.g. conf/telemetry/default.xml. Those wishing to experiment with "alternative" modems can reduce the number and period of each telemetry message to fit within most any bandwidth constraint.

Paparazzi supports the following modem protocols:

  • Standard transparent serial (pprz) - this is compatible with all modems and can be used to connect the autopilot directly to a PC for testing without a modem.
  • Maxstream API protocol (xbee) - compatible with all Maxstream modems including the 9XTend and Zigbee. This protocol enables hardware addressing, allowing multiple aircraft to be managed from a single ground modem.

Just specify the appropriate subsystem in your firmware section. You can currently choose between the types transparent, transparent_usb and xbee_api.

File: conf/airframes/myplane.xml
  <firmware name="fixedwing or rotorcraft">
     ...
    <subsystem name="telemetry"     type="transparent"/>
  </firmware>

See the telemetry subsystem page for more details.

GPS

The serial port settings must match that of the GPS and are configured here along with the necessary files to interpret the u-blox UBX binary protocol:

Just specify the appropriate subsystem in your firmware section. You can currently choose between the types ublox and ublox_utm for the older series 4 modules which still provide a UTM message.

File: conf/airframes/myplane.xml
  <firmware name="fixedwing or rotorcraft">
     ...
    <subsystem name="gps"               type="ublox"/>
  </firmware>

The correct UART is already defined by default according to your board. The default modem baudrate is 38400baud.

If you use different baud rates or UART set the according parameters, e.g.

File: conf/airframes/myplane.xml
  <firmware name="fixedwing or rotorcraft">
     ...
    <subsystem name="gps"               type="ublox">
      <configure name="GPS_BAUD"          value="B9600"/>
      <configure name="GPS_PORT"          value="UART0"/>
    </subsystem>
  </firmware>

Note:

  • u-blox GPS modules are factory configured for 9600 baud, 38,400 baud is recommended along with the other required changes. The GPS can be accessed directly thrugh the UART Tunnel and Configured with u-center

XML Parameters

Bat

This section gives characteristics for monitoring the main power battery.

MILLIAMP_AT_FULL_THROTTLE represents the actual current (in mA) when full THROTTLE is applied. Note that when flying the current typically is significantly lower than in static tests at home on your workbench. MILLIAMP_AT_FULL_THROTTLE is used to compute the energy value of the BAT message when no Current sensor is mounted in the airframe. This value can also be used in flight plans. For example, if at full throttle your motor consumes 10 Amps, use a value of 10000. You can "tweak" this number after a few flights to match the capacity of your battery. If upon landing your bat.energy messages says that you used 2500 mAh while the energy recharged into the battery is only 2000 mAh, you could reduce the MILLIAMP_AT_FULL_THROTTLE value by 20% to match your in-flight current consumption. This tweaking is most precise if you fly full throttle only (respectively no throttle to glide down again).

The CURRENT_ESTIMATION_NONLINEARITY can be added to tweak the energy estimation for non full throttle cruise. As the current consumption is nonlinear, at 50% throttle it is likely to be substantially less than 50%. A superellipse is used to approximate this nonlinearity. The default setting is 1.2 and is used if the CURRENT_ESTIMATION_NONLINEARITY is not defined in your airframe file. A value 1 corresponds to linear behaviour, 1.5 corresponds to strong nonlinearity. The tweaking is done same as decribed above for MILLIAMP_AT_FULL_THROTTLE, but only partial throttle (cruise throttle) should be applied in flight.

If both MILLIAMP_AT_FULL_THROTTLE and CURRENT_ESTIMATION_NONLINEARITY are tweaked well, you get precise energy estimations with less than 5% error independant of your flight pattern without even requiring a Current sensor.

The CATASTROPHIC_BAT_LEVEL (was previously LOW_BATTERY) value defines the voltage at which the autopilot will lock the throttle at 0% in autonomous mode (kill_throttle mode). This value is also used by the ground server to issue a CATASTROPHIC alarm message on the bus (this message will be displayed in the console of the GCS). CRITIC and LOW values will also used as threshold for CRITIC and WARNING alarms. They are optional and the respective defaults are 10.0 and 10.5V.

The MAX_BAT_LEVEL may be specified to improve the display of the battery gauge in the strip or in "papgets". Note that this definition is optional, with a default value of 12.5V.


<section name="BAT">
 <define name="MILLIAMP_AT_FULL_THROTTLE" value="12000" unit="mA" />
 <define name="VOLTAGE_ADC_A" value="0.0177531"/>
 <define name="VOLTAGE_ADC_B" value="0.173626"/>
 <define name="VoltageOfAdc(adc)" value ="(VOLTAGE_ADC_A * adc + VOLTAGE_ADC_B)"/>
 <define name="CATASTROPHIC_BAT_LEVEL" value="6.0" unit="V"/>
 <define name="CRITIC_BAT_LEVEL" value="6.5" unit="V"/>
 <define name="LOW_BAT_LEVEL" value="7.0" unit="V"/>
 <define name="MAX_BAT_LEVEL" value="8.4" unit="V"/>
</section>

Find more in depth information on how to get a separate current sensor working by clicking here

Modules

The modules allow to add new code in a flexible way with initialisation, periodic and event functions without modifying the main AP loop.


<modules main_freq="60">
 <load name="demo_module.xml"/>
</modules>

  • The main_freq parameter (in Hz) allows to specify the frequency of the main loop. Default is 60 Hz