Advertisement
Guest User

Untitled

a guest
Jul 21st, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 13.15 KB | None | 0 0
  1. <!DOCTYPE airframe SYSTEM "../airframe.dtd">
  2. <!-- This is the UA_Mothra airframe file. The plane is equipped with a lisa MX, two spectrum satteilte receivers, ubox neo gps, xbee pro telemetry link, a current sensor(.6V at 0 A and 40mV/A scale, a vbat in with an external resistor of 2kohm. Firmware is flashed via black magic probe.-->
  3.  
  4. <airframe name="Mothra">
  5.   <firmware name="fixedwing">
  6.     <target name="ap" board="lisa_mx_2.1">
  7.       <subsystem name="radio_control" type="spektrum">
  8.         <define name="RADIO_MODE" value="RADIO_AUX2"/>
  9.         <configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" value="1"/>
  10.       </subsystem>
  11.      
  12.      <subsystem name="ins" type="alt_float">
  13.        <define name="USE_BAROMETER" value="TRUE"/>
  14.      </subsystem>
  15.    
  16.       <define name="USE_ADC"/>
  17.       <define name="USE_ADC_2"/>
  18.       <define name="USE_I2C2" />
  19.       <define name="MEASURE_AIRSPEED"/> <!-- change from MEASURE <=> USE -->
  20.  
  21.     </target>
  22.  
  23.     <target name="sim" board="pc">
  24.       <subsystem name="radio_control" type="ppm"/>
  25.       <subsystem name="ins" type="alt_float"/>
  26.    
  27.     </target>
  28.  
  29.     <subsystem name="actuators"     type="pwm">
  30.      
  31.       <define name="USE_SERVOS_7AND8"/>
  32.     </subsystem>
  33.    
  34.     <define name="RC_LOST_MODE" value="PPRZ_MODE_AUTO2"/>
  35.  
  36.  
  37.  
  38.     <subsystem name="gps" type="ublox">
  39.       <configure name="GPS_BAUD" value="B57600"/>
  40.     </subsystem>
  41.     <subsystem name="telemetry" type="transparent">
  42.       <configure name="MODEM_BAUD" value="B57600"/>
  43.     </subsystem>
  44.     <subsystem name="imu" type="lisa_mx_v2.1"/>
  45.     <subsystem name="navigation" />
  46.     <subsystem name="control"/>
  47.     <subsystem name="ahrs" type="float_cmpl_quat">
  48.       <configure name="USE_MAGNETOMETER" value="TRUE"/>
  49.       <define name="F_PROPAGATE_QUAT"/>
  50.     </subsystem>
  51.    
  52.  
  53.  
  54.     <configure name="NO_LUFTBOOT" value="1"/>
  55.     <configure name="FLASH_MODE" value="SWD"/>
  56.     <!--- <configure name="BMP_PORT" value="/dev/ttyACM0"/> -->
  57.  
  58.    
  59.  
  60.   </firmware>
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. <!--The following is the commands sections. This deals with how the control surface relate to movement and rc input-->
  71.   <commands> <!--The commands the autopilot board outputs-->
  72.     <axis name="THROTTLE" failsafe_value="0"/>
  73.     <axis name="ROLL" failsafe_value="9600"/>
  74.     <axis name="PITCH" failsafe_value="-9600"/>
  75.     <axis name="BRAKE" failsafe_value="0"/>
  76.     <axis name="YAW" failsafe_value="0"/>
  77.     <axis name="GEAR" failsafe_value="0"/>
  78.   </commands>
  79.  
  80.  
  81.   <servos><!--the servos the outpilot autoputs commands output to-->
  82.     <servo name="THROTTLE" max="2000" neutral="1000" min="1000" no="5"/>
  83.     <servo name="DROP" max="2000" neutral="1500" min="1000" no="0"/>
  84.     <servo name="ELEVATOR" max="1000" neutral="1359" min="2000" no="3"/>
  85.     <servo name="AILERON_RIGHT" max="1800" neutral="1396" min="1200" no="2"/>
  86.     <servo name="AILERON_LEFT" max="1800" neutral="1400" min="1200" no="1"/>
  87.     <servo name="RUDDER" max="2000" neutral="1444" min="1000" no="4"/>
  88.   </servos>
  89.  
  90.  
  91.   <command_laws> <!--How the commands relate to servo movement-->
  92.     <set value="@ROLL-.6*(@BRAKE)" servo="AILERON_LEFT"/>
  93.     <set value="@ROLL+.6*(@BRAKE)" servo="AILERON_RIGHT"/>
  94.     <set value="@THROTTLE" servo="THROTTLE"/>
  95.     <set value="@PITCH" servo="ELEVATOR"/>
  96.     <set value="@YAW" servo="RUDDER"/>
  97.     <set value="@GEAR" servo="DROP"/>
  98.   </command_laws>
  99.  
  100.  
  101.   <rc_commands> <!--controls available to pilot in full RC-->
  102.     <set value="@THROTTLE" command="THROTTLE"/>
  103.     <set value="@ROLL" command="ROLL"/>
  104.     <set value="@PITCH" command="PITCH"/>
  105.     <set value="@YAW" command="YAW"/>
  106.     <set value="@GEAR" command="GEAR"/>
  107.     <set value="@AUX1" command="BRAKE"/>
  108.   </rc_commands>
  109.  
  110.  
  111.   <auto_rc_commands> <!--controls available to pilot in AUTO2-->
  112.     <set value="@YAW" command="YAW"/>
  113.     <set command="GEAR" value="@GEAR"/>
  114.     <set value="@AUX1" command="BRAKE"/>
  115.   </auto_rc_commands>
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.   <!--The following are sensor calibrations that need to be performed-->
  125.   <!--Note some calibrations are location specific. These need to be modified when flying at different fields-->
  126.  
  127.   <section name="IMU" prefix="IMU_">
  128.  
  129.     <define name="BODY_TO_IMU_PHI" value="90." unit="deg"/>
  130.     <define name="BODY_TO_IMU_THETA" value="-90." unit="deg"/>
  131.     <define name="BODY_TO_IMU_PSI" value="180." unit="deg"/>
  132.  
  133.    
  134.  
  135.     <!--See http://wiki.paparazziuav.org/wiki/ImuCalibration -->
  136.    
  137. <!-- Calibrate via sw/tools/calibration/calibrate.py-->
  138.  
  139.  
  140. <define name="MAG_X_NEUTRAL" value="-415"/>
  141. <define name="MAG_Y_NEUTRAL" value="814"/>
  142. <define name="MAG_Z_NEUTRAL" value="223"/>
  143. <define name="MAG_X_SENS" value="2.76789774165" integer="16"/>
  144. <define name="MAG_Y_SENS" value="3.15959835097" integer="16"/>
  145. <define name="MAG_Z_SENS" value="2.63119798642" integer="16"/>
  146.  
  147.  
  148.  
  149.  
  150.     <!-- Current draw magnetic field calibration-->
  151.     <!--Please note that you must enable a module for current calibration. look below at modules and uncomment the module.-->
  152.  
  153. <define name= "MAG_X_CURRENT_COEF" value="0.00320590964876"/>
  154. <define name= "MAG_Y_CURRENT_COEF" value="-0.00177605577317"/>
  155. <define name= "MAG_Z_CURRENT_COEF" value="0.000959756979821"/>
  156.  
  157.  
  158.    
  159.   </section>
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.   <section name="AHRS" prefix="AHRS_"> <!--This is local magnetic field data. Needs to be changed for different fields-->
  170.     <!--CHANGE THIS FOR DIFFERENT LOCATIONS!!-->
  171.     <!--See http://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Local_Magnetic_Field For more details-->
  172.     <!--Note a module that automatically updates this value has been added, see below. (geo_mag.xml)-->
  173.  
  174. <!-- Local magnetic field vector Bremner Field-->
  175.  
  176.     <define name="H_X" value="0.244216"/>
  177.     <define name="H_Y" value="0.0640397"/>
  178.     <define name="H_Z" value="0.967604"/>
  179.  
  180.  
  181.   </section>
  182.  
  183.  
  184.  
  185.  
  186.   <section name="BAT">
  187.     <!--<define name="MILLIAMP_AT_FULL_THROTTLE" value="3000"/> not needed due to current sensor-->
  188.     <define name="CATASTROPHIC_BAT_LEVEL" value="12.7" unit="V"/>
  189.     <define name="CRITIC_BAT_LEVEL" value="14.7" unit="V"/>
  190.     <define name="LOW_BAT_LEVEL" value="15.1" unit="V"/>
  191.     <define name="MAX_BAT_LEVEL" value="16.8" unit="V"/>
  192.     <define name="VOLTAGE_ADC_SCALE" value="0.0052047"/>
  193.     <define name="VOLTAGE_ADC_OFFSET" value="-0.011815"/>
  194.     <define name="VoltageOfAdc(adc)" value="(VOLTAGE_ADC_SCALE * adc + VOLTAGE_ADC_OFFSET)"/>
  195.  
  196.     <define name="ADC_CHANNEL_CURRENT" value="ADC_2" />
  197.     <define name="CURRENT_ADC_SCALE" value="1"/>
  198.     <define name="CURRENT_ADC_OFFSET" value="0"/>
  199.     <define name="MilliAmpereOfAdc(adc)" value="0.2489*(80.55*(adc-185))-11232"/>
  200.   </section>
  201.  
  202.  
  203.  
  204.  
  205.   <section name="FAILSAFE" prefix="FAILSAFE_">
  206.     <define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
  207.     <define name="DEFAULT_THROTTLE" value="0" unit="%"/>
  208.     <define name="DEFAULT_ROLL" value="17.2" unit="deg"/>
  209.     <define name="DEFAULT_PITCH" value="28.6" unit="deg"/>
  210.   </section>
  211.  
  212.  
  213.  
  214.   <section name="MISC">
  215.     <define name="NOMINAL_AIRSPEED" value="15." unit="m/s"/>
  216.     <define name="CARROT" value="4." unit="s"/> <!-- when carrot time away from waypoint in go and path, Paparazzi determines it has reached the waypoint-->
  217.     <define name="KILL_MODE_DISTANCE" value="(2.0*MAX_DIST_FROM_HOME)"/>
  218.     <define name="DEFAULT_CIRCLE_RADIUS" value="100."/>
  219.   </section>
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. <!--AUTOPILOT TUNING SECTION-->
  227.  
  228. <!--These are the angles which are output when the plane is flying in 'level' flight -->
  229.   <section name="INS" prefix="INS_">
  230.     <define name="ROLL_NEUTRAL" value="-2.6" unit="deg"/>
  231.     <define name="PITCH_NEUTRAL" value="0" unit="deg"/>
  232.   </section>
  233.  
  234.  
  235.   <section name="AUTO1" prefix="AUTO1_"><!-- roll and pitch in auto1-->
  236.     <define name="MAX_ROLL" value="40." unit="deg"/>
  237.     <define name="MAX_PITCH" value="35." unit="deg"/>
  238.   </section>
  239.  
  240.  
  241.  
  242.  
  243.  
  244.   <section name="HORIZONTAL CONTROL" prefix="H_CTL_">
  245.    
  246.     <!--<define name="AILERON_OF_THROTTLE" value="0.0"/> --> <!-- as RPM of Prop increases more aileron may be need to obtain steady flight. Use this gain to adjust that--> >
  247.  
  248.     <define name="COURSE_PGAIN" value="1.37"/> <!-- used to be 57.3 deg. when a new heading is given to paparazzi the change the roll by this much-->
  249.     <define name="COURSE_DGAIN" value="17.1" unit="deg"/>
  250.  
  251.  
  252.  
  253.     <define name="ROLL_MAX_SETPOINT" value="34.4920593063" unit="deg"/> <!-- these are the max and min values the plane can roll and pitch when in auto -->
  254.     <define name="PITCH_MAX_SETPOINT" value="30" unit="deg"/>
  255.     <define name="PITCH_MIN_SETPOINT" value="-10" unit="deg"/>
  256.  
  257.  
  258.  
  259.     <define name="PITCH_PGAIN" value="18513"/><!-- the rate at which paparazzi will change the pitch  -->
  260.     <define name="PITCH_DGAIN" value="1.5"/> <!-- the rate at which paparazzi couteracts pgain -->
  261.  
  262.     <define name="ROLL_ATTITUDE_GAIN" value="21698"/> <!--same idea as pitch pgain but for roll.--> <!--ROLL_PGAIN is still valid but paparazzi recommends using this one-->
  263.     <define name="ROLL_RATE_GAIN" value="1500"/> <!-- thinking this is probably some sort of gain that maintains flight with no Roll. So for example when flying straight and level and the wind rolls the plane, this will correct it. Maybe.-->
  264. <!--most likely doesn't work as it uses a gyro and we have not defined one-->
  265.  
  266.   <define name="ELEVATOR_OF_ROLL" value="3409"/><!--Adjust to maintain altitude on turns-->
  267.  
  268.   <define name="ROLL_SLEW" value="0.1"/> <!-- not too sure trying playing around with it. -->
  269.  
  270.   </section>
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.   <section name="VERTICAL CONTROL" prefix="V_CTL_">
  278.     <define name="POWER_CTL_BAT_NOMINAL" value="14.9" unit="V"/>
  279.  
  280.     <define name="THROTTLE_SLEW_LIMITER" value="1.5" unit="s"/><!-- time it takes to go from 0% throttle to 100% throttle-->
  281.  
  282.  
  283.  
  284.     <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.48"/> <!-- nominal cruise throttle %-->
  285.     <define name="AUTO_THROTTLE_MIN_CRUISE_THROTTLE" value="0.33"/> <!-- minimum cruise throttle setting-->
  286.     <define name="AUTO_THROTTLE_MAX_CRUISE_THROTTLE" value="0.85"/> <!-- maximum cruise throttle setting-->
  287.  
  288.  
  289.  
  290.     <define name="AUTO_THROTTLE_LOITER_TRIM" value="3248"/> <!--elevator trim when on min cruise throttle setting to maintain altitude-->
  291.     <define name="AUTO_THROTTLE_DASH_TRIM" value="2492"/> <!--elevator trim when on max cruise throttle setting to maintain altitude-->
  292.  
  293.  
  294.      <define name="ALTITUDE_PGAIN" value="0.06"/><!--the rate at which paparazzi will change the altitude-->
  295.    
  296.     <define name="ALTITUDE_MAX_CLIMB" value="2." unit="m/s"/> <!-- max climb setting -->
  297.    
  298.  
  299.     <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.10" unit="%/(m/s)"/> <!-- rate at which to increase throttle on climb error-->
  300.  
  301.     <define name="AUTO_THROTTLE_PGAIN" value="0.01"/> <!-- rate at which to change speed based on climb-->
  302.     <define name="AUTO_THROTTLE_IGAIN" value="0.10"/> <!-- additional increase in rate dependant on time that speed is not ideal. Example if the speed required is 15m/s and the current speed is 12m/s and has been for 3s. then throttle setting = value+(15-12)(Pgain)+3*igain.-->
  303.  
  304.     <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.09"/><!-- how much to change pitch based on climb error -->
  305.  
  306.    
  307.     <!--airspeed tuning
  308.    <define name="AUTO_AIRSPEED_SETPOINT" value="13.0"  unit="m/s" /> SETPOINT values may need to be adjusted to suit your aircraft
  309.    <define name="AUTO_AIRSPEED_PGAIN"    value="0.060" />
  310.    <define name="AUTO_AIRSPEED_IGAIN"    value="0.050" />
  311.  
  312.    <define name="AUTO_GROUNDSPEED_SETPOINT" value="7.0"  unit="m/s" /> SeTPOINT values may need to be adjusted to suit your aircraft
  313.    <define name="AUTO_GROUNDSPEED_PGAIN"    value="0.75" />
  314.    <define name="AUTO_GROUNDSPEED_IGAIN"    value="0.25" />
  315.  
  316.    <define name="AUTO_PITCH_MAX_PITCH" value="RadOfDeg(25)"/>
  317.    <define name="AUTO_PITCH_MIN_PITCH" value="RadOfDeg(-20)"/>
  318. --->
  319.  
  320.   </section>
  321.  
  322.  
  323.  
  324.   <section name="NAV">
  325.     <define name="DEFAULT_CIRCLE_RADIUS" value="60."/>
  326.   </section>
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.   <section name="AGGRESSIVE" prefix="AGR_">
  334.     <define name="BLEND_START" value="75"/><!--set really high to prevent agressive mode-->
  335.     <!-- Altitude Error to Initiate Aggressive Climb CANNOT BE ZERO!!-->
  336.     <define name="BLEND_END" value="15"/>
  337.     <!-- Altitude Error to Blend Aggressive to Regular Climb Modes CANNOT BE ZERO!!-->
  338.     <define name="CLIMB_THROTTLE" value=".85"/>
  339.     <!-- Gaz for Aggressive Climb -->
  340.     <define name="CLIMB_PITCH" value="0.6"/>
  341.     <!-- Pitch for Aggressive Climb -->
  342.     <define name="DESCENT_THROTTLE" value="0.1"/>
  343.     <!-- Gaz for Aggressive Decent -->
  344.     <define name="DESCENT_PITCH" value="-0.2" />
  345.     <!-- Pitch for Aggressive Decent -->
  346.     <define name="CLIMB_NAV_RATIO" value="0.8"/>
  347.     <!-- Percent Navigation for Altitude Error Equal to Start Altitude -->
  348.     <define name="DESCENT_NAV_RATIO" value="1.0"/>
  349.  
  350.   </section>
  351.  
  352.  
  353.   <modules>
  354.     <load name="geo_mag.xml"/>
  355.  
  356.     <load name="airspeed_ets.xml">
  357.       <define name="AIRSPEED_ETS_SYNC_SEND"/>
  358.       <define name="AIRSPEED_ETS_I2C_DEV" value="i2c2"/>
  359.  
  360.     </load>
  361.     <!--load name="send_imu_mag_current.xml"/--> <!-- uncomment this line to measure IMU current Calibration-->
  362.  </modules>
  363.  
  364. </airframe>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement