Advertisement
Guest User

Untitled

a guest
Sep 15th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 14.84 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.  
  5. <airframe name="Mothra">
  6.   <firmware name="fixedwing">
  7.     <target name="ap" board="lisa_mx_2.1">
  8.       <define name="I2C2_CLOCK_SPEED" value="400000"/>
  9.       <subsystem name="radio_control" type="spektrum">
  10.         <define name="RADIO_MODE" value="RADIO_AUX2"/>
  11.         <configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" value="1"/>
  12.       </subsystem>
  13.      
  14.      <subsystem name="ins" type="alt_float">
  15.        <define name="USE_BAROMETER" value="TRUE"/>
  16.      </subsystem>
  17.    
  18.       <define name="USE_ADC"/>
  19.       <define name="USE_ADC_2"/>
  20.     </target>
  21.  
  22.     <target name="sim" board="pc">
  23.       <subsystem name="radio_control" type="ppm"/>
  24.       <subsystem name="ins" type="alt_float"/>
  25.    
  26.     </target>
  27.  
  28.     <subsystem name="actuators"     type="pwm">
  29.      
  30.       <!-- define name="USE_SERVOS_7AND8"/-->
  31.     </subsystem>
  32.    
  33.     <define name="RC_LOST_MODE" value="PPRZ_MODE_AUTO2"/>
  34.  
  35.  
  36.  
  37.     <subsystem name="gps" type="ublox">
  38.       <configure name="GPS_BAUD" value="B57600"/>
  39.     </subsystem>
  40.     <subsystem name="telemetry" type="transparent">
  41.       <configure name="MODEM_BAUD" value="B57600"/>
  42.     </subsystem>
  43.     <subsystem name="imu" type="lisa_mx_v2.1"/>
  44.     <subsystem name="navigation" />
  45.     <subsystem name="control"/>
  46.     <subsystem name="ahrs" type="float_cmpl_quat">
  47.       <define name="ASPIRIN_2_DISABLE_MAG" value="TRUE" />
  48.       <define name="USE_MAGNETOMETER" value="TRUE"/>
  49.       <define name="AHRS_FC_MAG_ID" value="MAG_HMC58XX_SENDER_ID"/>
  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.   </firmware>
  59.  
  60. <!--The following is the commands sections. This deals with how the control surface relate to movement and rc inpu-->
  61.   <commands> <!--The commands the autopilot board outputs-->
  62.     <axis name="THROTTLE" failsafe_value="0"/>
  63.     <axis name="ROLL" failsafe_value="9600"/>
  64.     <axis name="PITCH" failsafe_value="-9600"/>
  65.     <axis name="BRAKE" failsafe_value="0"/>
  66.     <axis name="YAW" failsafe_value="0"/>
  67.     <axis name="GEAR" failsafe_value="0"/>
  68.   </commands>
  69.  
  70.  
  71.   <servos><!--the servos the outpilot autoputs commands output to-->
  72.     <servo name="THROTTLE" max="2000" neutral="1000" min="1000" no="5"/>
  73.     <servo name="DROP" max="2000" neutral="1500" min="1000" no="0"/>
  74.     <servo name="ELEVATOR" max="1000" neutral="1359" min="2000" no="3"/>
  75.     <servo name="AILERON_RIGHT" max="1800" neutral="1396" min="1200" no="2"/>
  76.     <servo name="AILERON_LEFT" max="1800" neutral="1400" min="1200" no="1"/>
  77.     <servo name="RUDDER" max="2000" neutral="1444" min="1000" no="4"/>
  78.   </servos>
  79.  
  80.  
  81.   <command_laws> <!--How the commands relate to servo movement-->
  82.     <set value="@ROLL-.6*(@BRAKE)" servo="AILERON_LEFT"/>
  83.     <set value="@ROLL+.6*(@BRAKE)" servo="AILERON_RIGHT"/>
  84.     <set value="@THROTTLE" servo="THROTTLE"/>
  85.     <set value="@PITCH" servo="ELEVATOR"/>
  86.     <set value="@YAW" servo="RUDDER"/>
  87.     <set value="@GEAR" servo="DROP"/>
  88.   </command_laws>
  89.  
  90.  
  91.   <rc_commands> <!--controls available to pilot in full RC-->
  92.     <set value="@THROTTLE" command="THROTTLE"/>
  93.     <set value="@ROLL" command="ROLL"/>
  94.     <set value="@PITCH" command="PITCH"/>
  95.     <set value="@YAW" command="YAW"/>
  96.     <set value="@GEAR" command="GEAR"/>
  97.     <set value="@AUX1" command="BRAKE"/>
  98.   </rc_commands>
  99.  
  100.  
  101.   <auto_rc_commands> <!--controls available to pilot in AUTO2-->
  102.     <set value="@YAW" command="YAW"/>
  103.     <set command="GEAR" value="@GEAR"/>
  104.     <set value="@AUX1" command="BRAKE"/>
  105.   </auto_rc_commands>
  106.    
  107.  
  108.   <!--The following are sensor calibrations that need to be performed-->
  109.   <!--Note some calibrations are location specific. These need to be modified when flying at different fields-->
  110.  
  111.   <section name="IMU" prefix="IMU_">
  112.     <!--These values can be calibrated by perfectly leveling the plane.-->
  113.     <!--Then open the messages windows and look at the attitude data-->
  114.     <!--Attitude should be completely 0. -->
  115.     <!--If not take the value given, convert to degrees and subtract from current values-->
  116.     <define name="BODY_TO_IMU_PHI" value="90." unit="deg"/>
  117.     <define name="BODY_TO_IMU_THETA" value="-90." unit="deg"/>
  118.     <define name="BODY_TO_IMU_PSI" value="180." unit="deg"/>
  119.  
  120.    
  121.  
  122.     <!--See http://wiki.paparazziuav.org/wiki/ImuCalibration -->
  123.    
  124. <!-- Calibrate via sw/tools/calibration/calibrate.py-->
  125.  
  126.  
  127.  
  128. <define name="MAG_X_NEUTRAL" value="-54"/>
  129. <define name="MAG_Y_NEUTRAL" value="-94"/>
  130. <define name="MAG_Z_NEUTRAL" value="69"/>
  131. <define name="MAG_X_SENS" value="3.04514558766" integer="16"/>
  132. <define name="MAG_Y_SENS" value="3.16456881858" integer="16"/>
  133. <define name="MAG_Z_SENS" value="3.55946548535" integer="16"/>
  134.  
  135.  
  136.  
  137.  
  138.     <!-- Current draw magnetic field calibration-->
  139.     <!--Please note that if you dont have any experience in Paparazzi and are not looking online you can enable current calibration raw data from a module. look below at modules and uncomment the module.-->
  140.  
  141. <!--
  142.    <define name= "MAG_X_CURRENT_COEF" value="0.00320590964876"/>
  143.    <define name= "MAG_Y_CURRENT_COEF" value="-0.00177605577317"/>
  144.    <define name= "MAG_Z_CURRENT_COEF" value="0.000959756979821"/>
  145. -->
  146.   </section>
  147.  
  148.   <section name="AHRS" prefix="AHRS_"> <!--This is local magnetic field data. Needs to be changed for different fields-->
  149.     <!--CHANGE THIS FOR DIFFERENT LOCATIONS!!-->
  150.     <!--See http://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Local_Magnetic_Field For more details-->
  151.     <!--Note a module that automatically updates this value has been added, see below. (geo_mag.xml)-->
  152.  
  153. <!-- Local magnetic field vector Bremner Field-->
  154.  
  155.     <define name="H_X" value="0.281865"/>
  156.     <define name="H_Y" value="0.0634601"/>
  157.     <define name="H_Z" value="0.957353"/>
  158.   </section>
  159.  
  160.  
  161.   <section name="BAT">
  162.     <!--<define name="MILLIAMP_AT_FULL_THROTTLE" value="3000"/> not needed due to current sensor-->
  163.     <define name="CATASTROPHIC_BAT_LEVEL" value="12.7" unit="V"/>
  164.     <define name="CRITIC_BAT_LEVEL" value="14.7" unit="V"/>
  165.     <define name="LOW_BAT_LEVEL" value="15.1" unit="V"/>
  166.     <define name="MAX_BAT_LEVEL" value="16.8" unit="V"/>
  167.     <define name="VOLTAGE_ADC_SCALE" value="0.0052047"/>
  168.     <define name="VOLTAGE_ADC_OFFSET" value="-0.011815"/>
  169.     <define name="VoltageOfAdc(adc)" value="(VOLTAGE_ADC_SCALE * adc + VOLTAGE_ADC_OFFSET)"/>
  170.  
  171.     <define name="ADC_CHANNEL_CURRENT" value="ADC_2" />
  172.     <define name="CURRENT_ADC_SCALE" value="1"/>
  173.     <define name="CURRENT_ADC_OFFSET" value="0"/>
  174.     <define name="MilliAmpereOfAdc(adc)" value="0.2489*(80.55*(adc-185))-11232"/>
  175.   </section>
  176.  
  177.   <section name="FAILSAFE" prefix="FAILSAFE_">
  178.     <define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
  179.     <define name="DEFAULT_THROTTLE" value="0" unit="%"/>
  180.     <define name="DEFAULT_ROLL" value="17.2" unit="deg"/>
  181.     <define name="DEFAULT_PITCH" value="28.6" unit="deg"/>
  182.   </section>
  183.  
  184.   <section name="MISC">    
  185.     <define name="CARROT" value="4." unit="s"/> <!-- hen carrot time away from waypoint in go and path, Paparazzi determines it has reached the waypoint-->
  186.     <define name="KILL_MODE_DISTANCE" value="(2.0*MAX_DIST_FROM_HOME)"/>
  187.     <define name="DEFAULT_CIRCLE_RADIUS" value="100."/>
  188.  
  189.     <define name="NOMINAL_AIRSPEED" value="15." unit="m/s"/>
  190.     <define name="CLIMB_AIRSPEED" value="12." unit="m/s"/>
  191.     <define name="GLIDE_AIRSPEED" value="12." unit="m/s"/>
  192.     <define name="RACE_AIRSPEED" value="25." unit="m/s"/>
  193.     <define name="STALL_AIRSPEED" value="8." unit="m/s"/>
  194.     <define name="AIRSPEED_SETPOINT_SLEW" value="0.2" unit="m/s/s"/> <!--default is 1-->
  195.   </section>
  196.  
  197.  
  198. <!--AUTOPILOT TUNING SECTION-->
  199.   <section name="INS" prefix="INS_"> <!--These are the angles which are output when the plane is in the "flat" position. Similar to BODY_TO_IMU -->
  200.     <define name="ROLL_NEUTRAL_DEFAULT" value="-2.6" unit="deg"/>
  201.     <define name="PITCH_NEUTRAL_DEFAULT" value="0" unit="deg"/>
  202.   </section>
  203.  
  204.   <section name="AUTO1" prefix="AUTO1_"><!-- roll and pitch in auto1-->
  205.     <define name="MAX_ROLL" value="40." unit="deg"/>
  206.     <define name="MAX_PITCH" value="35." unit="deg"/>
  207.   </section>
  208.  
  209.   <section name="HORIZONTAL CONTROL" prefix="H_CTL_">
  210.    
  211.     <!--<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--> <!-- commented out as it has been incorporated into command laws.-->
  212.  
  213.     <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-->
  214.     <define name="COURSE_DGAIN" value=".30" />
  215.  
  216.     <define name="ROLL_MAX_SETPOINT" value="35" unit="deg"/> <!-- these are the max and min values the plane can roll and pitch when in auto -->
  217.     <define name="PITCH_MAX_SETPOINT" value="30" unit="deg"/>
  218.     <define name="PITCH_MIN_SETPOINT" value="-10" unit="deg"/>
  219.  
  220.  
  221.  
  222.     <define name="PITCH_PGAIN" value="18513"/><!-- the rate at which paparazzi will change the pitch  -->
  223.     <define name="PITCH_DGAIN" value="1.5"/> <!-- the rate at which paparazzi couteracts pgain -->
  224.  
  225.  
  226. <!-- twinstar energyadaptive has there ariframe set at 7400 and 200 for the next two values.-->
  227.     <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-->
  228.     <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.-->
  229. <!--most likely doesn't work as it uses a gyro and we have not defined one-->
  230.  
  231.     <define name="ELEVATOR_OF_ROLL" value="3409"/><!--Adjust to maintain altitude on turns-->
  232.  
  233.     <define name="PITCH_IGAIN" value="100."/>
  234.     <define name="PITCH_KFFA" value="0."/>
  235.     <define name="PITCH_KFFD" value="0."/>
  236.  
  237.   </section>
  238.  
  239.   <section name="VERTICAL CONTROL" prefix="V_CTL_">
  240.     <define name="POWER_CTL_BAT_NOMINAL" value="14.9" unit="V"/>
  241.  
  242.     <define name="THROTTLE_SLEW_LIMITER" value="1.5" unit="s"/><!-- time it takes to go from 0% throttle to 100% throttle-->
  243.     <define name="ALTITUDE_PGAIN" value="0.06"/><!--the rate at which paparazzi will change the altitude-->    
  244.     <define name="ALTITUDE_MAX_CLIMB" value="2." unit="m/s"/> <!-- max climb setting -->
  245.  
  246.     <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.48"/> <!-- nominal cruise throttle %-->
  247.    
  248.     <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.10" unit="%/(m/s)"/> <!-- rate at which to increase throttle on climb error-->
  249.  
  250.  
  251.     <!--comment out the following for energy control-->
  252.     <define name="AUTO_THROTTLE_MIN_CRUISE_THROTTLE" value="0.33"/> <!-- minimum cruise throttle setting-->
  253.     <define name="AUTO_THROTTLE_MAX_CRUISE_THROTTLE" value="0.85"/> <!-- maximum cruise throttle setting-->
  254.  
  255.     <define name="AUTO_THROTTLE_LOITER_TRIM" value="3248"/> <!--elevator trim when on min cruise throttle setting to maintain altitude-->
  256.     <define name="AUTO_THROTTLE_DASH_TRIM" value="2492"/> <!--elevator trim when on max cruise throttle setting to maintain altitude-->
  257.  
  258.     <define name="AUTO_THROTTLE_PGAIN" value="0.01"/> <!-- rate at which to change speed based on climb-->
  259.     <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.-->
  260.  
  261.     <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.09"/><!-- how much to change pitch based on climb error -->
  262.    
  263.  
  264.     <!-- energy control
  265.    <define name="ALTITUDE_PGAIN" value="0.1049"/>
  266.  
  267.    <define name="ALTITUDE_MAX_CLIMB" value="2."/>
  268.  
  269.  
  270.    <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.3"/>
  271.    <define name="AUTO_THROTTLE_NOMINAL_CRUISE_PITCH" value="0."/>
  272.    <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.1" unit="%/(m/s)"/>
  273.    <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.15"/>
  274.  
  275.    <define name="AIRSPEED_PGAIN" value="0."/>
  276.  
  277.    <define name="AUTO_THROTTLE_OF_AIRSPEED_PGAIN" value="0.069"/>
  278.    <define name="AUTO_THROTTLE_OF_AIRSPEED_IGAIN" value="0.01"/>
  279.  
  280.    <define name="AUTO_PITCH_OF_AIRSPEED_PGAIN" value="0.01"/>
  281.    <define name="AUTO_PITCH_OF_AIRSPEED_IGAIN" value="0.003"/>
  282.    <define name="AUTO_PITCH_OF_AIRSPEED_DGAIN" value="0.03"/>
  283.  
  284.    <define name="ENERGY_TOT_PGAIN" value="0."/>
  285.    <define name="ENERGY_TOT_IGAIN" value="0."/>
  286.    <define name="ENERGY_DIFF_PGAIN" value="0."/>
  287.    <define name="ENERGY_DIFF_IGAIN" value="0."/>
  288.  
  289.    <define name="AUTO_GROUNDSPEED_SETPOINT" value="6.0" unit="m/s"/>
  290.    <define name="AUTO_GROUNDSPEED_PGAIN" value="0.75"/>
  291.    <define name="AUTO_GROUNDSPEED_IGAIN" value="0.25"/>
  292. -->
  293.   </section>
  294.  
  295.   <section name="NAV">
  296.     <define name="DEFAULT_CIRCLE_RADIUS" value="60."/>
  297.     <define name="NAV_PITCH" value="0."/> <!--Not Tuned-->
  298.     <define name="NAV_GLIDE_PITCH_TRIM" value="0"/> <!--Not Tuned-->
  299.   </section>
  300.  
  301.   <section name="AGGRESSIVE" prefix="AGR_">
  302.     <define name="BLEND_START" value="75"/><!--really high to prevent it-->
  303.     <!-- Altitude Error to Initiate Aggressive Climb CANNOT BE ZERO!!-->
  304.     <define name="BLEND_END" value="15"/>
  305.     <!-- Altitude Error to Blend Aggressive to Regular Climb Modes CANNOT BE ZERO!!-->
  306.     <define name="CLIMB_THROTTLE" value=".85"/>
  307.     <!-- Gaz for Aggressive Climb -->
  308.     <define name="CLIMB_PITCH" value="30" unit="deg"/>
  309.     <!-- Pitch for Aggressive Climb -->
  310.     <define name="DESCENT_THROTTLE" value="0.1"/>
  311.     <!-- Gaz for Aggressive Decent -->
  312.     <define name="DESCENT_PITCH" value="-30" unit="deg" />
  313.     <!-- Pitch for Aggressive Decent -->
  314.     <define name="CLIMB_NAV_RATIO" value="0.8"/>
  315.     <!-- Percent Navigation for Altitude Error Equal to Start Altitude -->
  316.     <define name="DESCENT_NAV_RATIO" value="1.0"/>
  317.  
  318.   </section>
  319.  
  320.  
  321.  
  322.  
  323.   <modules>
  324.     <load name="geo_mag.xml"/>
  325.  
  326.     <!--load name="airspeed_ets.xml">
  327.      <define name="AIRSPEED_ETS_SYNC_SEND"/>
  328.      <define name="AIRSPEED_ETS_I2C_DEV" value="i2c2"/>
  329.    </load-->
  330.  
  331.     <load name="mag_hmc58xx.xml">
  332.       <define name="MODULE_HMC58XX_UPDATE_AHRS" value="TRUE" />
  333.       <configure name="MAG_HMC58XX_I2C_DEV" value="i2c2"/>
  334.     </load>
  335.     <!--load name="send_imu_mag_current.xml"/--> <!-- uncomment this line to measure IMU current Calibration-->
  336.  </modules>
  337.  
  338. </airframe>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement