Adaptive

From PaparazziUAV
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Implementation of stabilization adaptive


File: conf/airframes/myplane.xml
  <define name="USE_ANGLE_REF"/>  <!-- USING ATTITUDE REFERENCE GENERATOR -->
  <define name="USE_GYRO_PITCH_RATE" value="TRUE"/> <!--default TRUE-->
 <!-- <define name="USE_KFF_UPDATE_ROLL"/> -->
 <!-- <define name="USE_KFF_UPDATE_PITCH"/> --> 

  <command_laws>
    <set servo="MOTOR_LEFT"  value="@THROTTLE"/>
    <set servo="MOTOR_RIGHT" value="@THROTTLE"/>
    <set servo="ELEVATOR" value="@PITCH"/>
    <let var="roll" value="@ROLL"/>
    <set servo="AILERON_LEFT" value="($roll > 0 ? AILERON_DIFF : 1) * $roll"/>
    <set servo="AILERON_RIGHT" value="($roll > 0 ? 1 : AILERON_DIFF) * $roll"/>
    <set servo="RUDDER" value="@YAW"/> <!-- with yaw damper active -->
    <!-- <set servo="RUDDER" value="@YAW" + @ROLL"/>--> <!-- without yaw damper -->
    <set servo="FLAP_LEFT" value="@CL"/>
    <set servo="FLAP_RIGHT" value="@CL"/>
  </command_laws>

  <section name="AUTO1" prefix="AUTO1_">
    <define name="MAX_ROLL" value="RadOfDeg(60)"/>
    <define name="MAX_PITCH" value="RadOfDeg(30)"/>
    <define name="MAX_YAW_RATE" value="RadOfDeg(100)"/> <!-- rad/s for yaw damper-->
  </section>

  <section name="HORIZONTAL CONTROL" prefix="H_CTL_">

    <define name="COURSE_PGAIN" value="0.8"/>
    <define name="COURSE_DGAIN" value="0.3"/>

    <define name="ROLL_MAX_SETPOINT" value="50" unit="deg"/>
    <define name="ROLL_ATTITUDE_GAIN" value="7400."/>
    <define name="ROLL_RATE_GAIN" value="200."/>
    <define name="ROLL_IGAIN" value="100."/>
    <define name="ROLL_KFFA" value="1."/>
    <define name="ROLL_KFFD" value="1."/>

    <define name="PITCH_MAX_SETPOINT" value="30" unit="deg"/>
    <define name="PITCH_MIN_SETPOINT" value="-30" unit="deg"/>
    <define name="PITCH_PGAIN" value="8000."/>
    <define name="PITCH_DGAIN" value="0."/>
    <define name="PITCH_IGAIN" value="100."/>
    <define name="PITCH_KFFA" value="1."/>
    <define name="PITCH_KFFD" value="1."/>

    <define name="PITCH_OF_ROLL" value="0.03"/>
    <define name="AILERON_OF_THROTTLE" value="0.0"/>

    <define name="YAW_LOOP" value="TRUE"/>
    <define name="YAW_TRIM_NY" value="TRUE"/>
    <define name="YAW_DGAIN" value="5000."/>
    <define name="YAW_NY_IGAIN" value="5000."/>

    <define name="CL_LOOP" value="TRUE"/>
    <define name="CL_LOOP_USE_AIRSPEED_SETPOINT" value="TRUE"/>
    <define name="CL_LOOP_INCREASE_FLAPS_WITH_LOADFACTOR" value="TRUE"/>
    <define name="CL_FLAPS_STALL" value="0.5"/>
    <define name="CL_FLAPS_NOMINAL" value="0."/>
    <define name="CL_FLAPS_RACE" value="-0.5"/>
    <define name="CL_DEADBAND" value="1."/>