paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Paparazzi-devel] with new control type, airspeed sensor, PID problem.


From: afish douban
Subject: [Paparazzi-devel] with new control type, airspeed sensor, PID problem.
Date: Mon, 7 Oct 2013 02:33:29 -0500

Dear All

I need help for a airspeed with new control loop type.

here is the airframe file.

<!DOCTYPE airframe SYSTEM "./airframe.dtd">

<!-- this is a Zephyr II 
  * Autopilot:   Lisa/M 2.0              http://paparazzi.enac.fr/wiki/Lisa/M_v20
  * IMU:         Aspirin 2.2             http://paparazzi.enac.fr/wiki/AspirinIMU
  * GPS:         Ublox 6H                http://paparazzi.enac.fr/wiki/Subsystem/gps
  * RC:          PPM system to SERVO6    http://paparazzi.enac.fr/wiki/Subsystem/radio_control#PPM
  * AIRSPEED:    ETS AIRSPEED V3 to I2C2
  * Modem        XBee in transparent mode at 57600 baud
  code by kevin
-->

<airframe name="ZII_Lisa/M 2.0">

  <firmware name="fixedwing">

    <target name="sim" board="pc"/>
   
    <target name="ap" board="lisa_m_2.0">
      <configure name="FLASH_MODE" value="DFU"/>
      <configure name="PERIODIC_FREQUENCY" value="120"/>
      <configure name="AHRS_PROPAGATE_FREQUENCY" value="100"/>
      <configure name="AHRS_CORRECT_FREQUENCY" value="100"/>
    </target>
    
    <define name="USE_I2C2"/>
    <define name="SENSOR_SYNC_SEND" value="1"/>
    <define name="USE_AIRSPEED"/>
    <define name="AGR_CLIMB"/>
    <define name="LOITER_TRIM"/>
    <define name="STRONG_WIND"/>
    <define name="USE_MAGNETOMETER" value="FALSE"/>

    <subsystem name="radio_control" type="ppm">
      <configure name="RADIO_CONTROL_PPM_PIN" value="SERVO6"/>
    </subsystem>

    <subsystem name="telemetry" type="transparent"/>
    <subsystem name="imu" type="aspirin_v2.2"/>
    <subsystem name="gps" type="ublox"/>
    <subsystem name="ins" type="alt_float"/>
    <subsystem name="ahrs" type="int_cmpl_quat"/>
    <subsystem name="control" type="new"/>
    <subsystem name="navigation" type="extra"/>

  </firmware>


  <modules>

    <load name="digital_cam.xml">
      <define name="DC_SHUTTER_LED" value="4"/>
    </load>

    <load name="airspeed_ets.xml">
      <define name="AIRSPEED_ETS_I2C_DEV" value="i2c2"/>
    </load>

  </modules>


<!-- commands section -->
  <servos>
    <servo name="THROTTLE" no="0" min="1000" neutral="1000" max="2000"/>
    <servo name="AILEVON_LEFT" no="1" min="1900" neutral="1500" max="1100"/>    
    <servo name="AILEVON_RIGHT" no="2" min="1100" neutral="1500" max="1900"/>
  </servos>

  <section name="MIXER">
    <define name="AILEVON_AILERON_RATE" value="0.75"/>
    <define name="AILEVON_ELEVATOR_RATE" value="0.75"/>
  </section>

  <commands>
    <axis name="THROTTLE" failsafe_value="0"/>
    <axis name="ROLL" failsafe_value="0"/>
    <axis name="PITCH" failsafe_value="0"/>
  </commands>

  <rc_commands>
    <set command="THROTTLE" value="@THROTTLE"/>
    <set command="ROLL" value="@ROLL"/>
    <set command="PITCH" value="@PITCH"/>
  </rc_commands>

  <command_laws>
    <let var="aileron" value="@ROLL * AILEVON_AILERON_RATE"/>
    <let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>
    <set servo="THROTTLE" value="@THROTTLE"/>
    <set servo="AILEVON_LEFT" value="$elevator + $aileron"/>
    <set servo="AILEVON_RIGHT" value="$elevator - $aileron"/>
  </command_laws>

  <section name="AUTO1" prefix="AUTO1_">
    <define name="MAX_ROLL" value="50." unit="deg"/>
    <define name="MAX_PITCH" value="35." unit="deg"/>
  </section>

<!--硬件section-->

  <section name="DIGITAL_CAMERA" prefix="DC_">
      <define name="AUTOSHOOT_QUARTERSEC_PERIOD" value="8" unit="quarter_second"/>
      <define name="AUTOSHOOT_METER_GRID" value="60" unit="meter"/>
  </section>

  <section name="BAT">
    <define name="MILLIAMP_AT_FULL_THROTTLE" value="30000" unit="mA"/>
    <define name="CATASTROPHIC_BAT_LEVEL" value="9.6" unit="V"/>
    <define name="CRITIC_BAT_LEVEL" value="10" unit="V"/>
    <define name="LOW_BAT_LEVEL" value="10.5" unit="V"/>
    <define name="MAX_BAT_LEVEL" value="12.5" unit="V"/>
  </section>

  <section name="IMU" prefix="IMU_">
    <!-- ACCEL and GYRO calibration left out to take default datasheet values -->

    <define name="BODY_TO_IMU_PHI" value="0." unit="deg"/>
    <define name="BODY_TO_IMU_THETA" value="0." unit="deg"/>
    <define name="BODY_TO_IMU_PSI" value="0." unit="deg"/>
  </section>

  <section name="MISC">
    <define name="NOMINAL_AIRSPEED" value="20." unit="m/s"/>
    <define name="CARROT" value="10." unit="s"/>
    <define name="KILL_MODE_DISTANCE" value="(1.2*MAX_DIST_FROM_HOME)"/>
    <define name="NAV_RADIUS" value="30" unit="m"/>
    <define name="NO_XBEE_API_INIT" value="TRUE"/>
    <define name="ALT_KALMAN_ENABLED" value="TRUE"/>
    <define name="UNLOCKED_HOME_MODE" value="TRUE"/>
    <define name="RC_LOST_MODE" value="PPRZ_MODE_AUTO2"/>
    <define name="DEFAULT_CIRCLE_RADIUS" value="80."/>
  </section>

<!--  -->

  <section name="AHRS" prefix="AHRS_">
    <!--local Magnetic Field need to be tunning -->
    <define name="H_X" value=" 0.51562740288882"/>
    <define name="H_Y" value="-0.05707735220832"/>
    <define name="H_Z" value=" 0.85490967783446"/>
  </section>

  <section name="INS" prefix="INS_">
    <define name="ROLL_NEUTRAL_DEFAULT" value="0" unit="deg"/>
    <define name="PITCH_NEUTRAL_DEFAULT" value="0" unit="deg"/>
  </section>

  <section name="Takeoff" prefix="Takeoff_">
   <define name="Height" value="30" unit="m"/>
   <define name="Speed" value="12" unit="m/s"/>
   <define name="Distance" value="2" unit="m"/>
   <define name="Minspeed" value="4" unit="m/s"/>
  </section>

  <section name="VERTICAL CONTROL" prefix="V_CTL_">

    <define name="POWER_CTL_BAT_NOMINAL" value="11.1" unit="volt"/>

    <!-- outer loop V_CTL_AUTO_AIRSPEED_THROTTLE_PGAIN' -->
    <define name="ALTITUDE_PGAIN" value="0.055" unit="(m/s)/m"/>
    <define name="ALTITUDE_MAX_CLIMB" value="3." unit="m/s"/>
    <!-- auto throttle inner loop -->
    <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.8" unit="%"/>
    <define name="AUTO_THROTTLE_MIN_CRUISE_THROTTLE" value="0.5" unit="%"/>
    <define name="AUTO_THROTTLE_MAX_CRUISE_THROTTLE" value="1.0" unit="%"/>
    <define name="AUTO_THROTTLE_LOITER_TRIM" value="1500" unit="pprz_t"/>
    <define name="AUTO_THROTTLE_DASH_TRIM" value="-1000" unit="pprz_t"/>
    <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.1" unit="%/(m/s)"/>
    <define name="AUTO_THROTTLE_PGAIN" value="0.02" unit="%/(m/s)"/>
    <define name="AUTO_THROTTLE_IGAIN" value="0.1"/>
    <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.05" unit="rad/(m/s)"/>

    <define name="AUTO_AIRSPEED_THROTTLE_PGAIN" value="0.02" unit="%/(m/s)"/>
    <define name="AUTO_AIRSPEED_THROTTLE_DGAIN" value="0.1"/>
    <define name="AUTO_AIRSPEED_THROTTLE_IGAIN" value="0.0"/>

    <!--auto pitch inner loop-->
    <define name="AUTO_PITCH_PGAIN" value="0.105"/>
    <define name="AUTO_PITCH_IGAIN" value="0.025"/>
    <define name="AUTO_PITCH_DGAIN" value="0.00"/>
    <define name="AUTO_PITCH_CLIMB_THROTTLE_INCREMENT" value="0.1" unit="%/(m/s)"/>
    <define name="AUTO_PITCH_MAX_PITCH" value="RadOfDeg(25)"/>
    <define name="AUTO_PITCH_MIN_PITCH" value="RadOfDeg(-25)"/>

    <define name="AUTO_AIRSPEED_PITCH_PGAIN" value="0.125"/>
    <define name="AUTO_AIRSPEED_PITCH_DGAIN" value="0.0"/>
    <define name="AUTO_AIRSPEED_PITCH_IGAIN" value="0.025"/>

    <!-- auto airspeed and altitude inner loop -->
    <define name="AUTO_AIRSPEED_SETPOINT" value="10.5" unit="m/s"/>
    <define name="AUTO_AIRSPEED_PGAIN" value="0.100"/>
    <define name="AUTO_AIRSPEED_IGAIN" value="0.030"/>
    <define name="AUTO_GROUNDSPEED_SETPOINT" value="6.0" unit="m/s"/>
    <define name="AUTO_GROUNDSPEED_PGAIN" value="0.105"/>
    <define name="AUTO_GROUNDSPEED_IGAIN" value="0.025"/>

    <define name="AIRSPEED_MAX" value="15"/>
    <define name="AIRSPEED_MIN" value="3"/>

    <define name="THROTTLE_SLEW" value="1.0"/>

  </section>

  <section name="HORIZONTAL CONTROL" prefix="H_CTL_">
    <define name="COURSE_PGAIN" value="0.7"/>
    <define name="ROLL_MAX_SETPOINT" value="45" unit="deg"/>
    <define name="PITCH_MAX_SETPOINT" value="30" unit="deg"/>
    <define name="PITCH_MIN_SETPOINT" value="-30" unit="deg"/>
    <define name="PITCH_PGAIN" value="20000."/>
    <define name="PITCH_DGAIN" value="1.5"/>
    <define name="ELEVATOR_OF_ROLL" value="1250"/>
    <define name="ROLL_ATTITUDE_GAIN" value="7500"/>
    <define name="ROLL_RATE_GAIN" value="1500"/>
  </section>

  <section name="NAV">
    <define name="NAV_GLIDE_PITCH_TRIM" value="0"/>
  </section>

  <section name="AGGRESSIVE" prefix="AGR_">
    <define name="BLEND_START" value="20"/><!-- Altitude Error to Initiate Aggressive Climb CANNOT BE ZERO!!-->
    <define name="BLEND_END" value="10"/><!-- Altitude Error to Blend Aggressive to Regular Climb Modes  CANNOT BE ZERO!!-->
    <define name="CLIMB_THROTTLE" value="1.00"/><!-- Gaz for Aggressive Climb -->
    <define name="CLIMB_PITCH" value="0.3"/><!-- Pitch for Aggressive Climb -->
    <define name="DESCENT_THROTTLE" value="0.1"/><!-- Gaz for Aggressive Decent -->
    <define name="DESCENT_PITCH" value="-0.25"/><!-- Pitch for Aggressive Decent -->
    <define name="CLIMB_NAV_RATIO" value="0.8"/><!-- Percent Navigation for Altitude Error Equal to Start Altitude -->
    <define name="DESCENT_NAV_RATIO" value="1.0"/>
   </section>

  <section name="FAILSAFE" prefix="FAILSAFE_">
    <define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
    <define name="DEFAULT_THROTTLE" value="0.4" unit="%"/>
    <define name="DEFAULT_ROLL" value="0.3" unit="rad"/>
    <define name="DEFAULT_PITCH" value="0.5" unit="rad"/>
    <define name="HOME_RADIUS" value="200" unit="m"/>
  </section>
  
</airframe>


the sim result is very bad. VCTL, and HCTL have problem. someone can help me to adjust this PID ? thank you so much
Inline image 1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]