Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_energy module

Energy based vertical control for fixedwing aircraft.

Airspeed sensor is mandatory for this controller.

Example for airframe file

Add to your firmware section:

<module name="guidance_energy"/>

Module configuration options

Airframe file section

  • section name: VERTICAL CONTROL prefix: V_CTL_
    • name POWER_CTL_BAT_NOMINAL value: 11.1
      Description: nominal battery voltage in cruise flight
    • name ALTITUDE_PGAIN value: 0.1
      Description: altitude loop P gain
    • name ALTITUDE_MAX_CLIMB value: 5.
      Description: max climb rate
    • name AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE value: 0.3
      Description: nominal throttle for cruise flight
    • name AUTO_THROTTLE_NOMINAL_CRUISE_PITCH value: 0.
      Description: nominal pitch angle for cruise flight
    • name AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT value: 0.1
      Description: feedforward throttle gain
    • name AUTO_THROTTLE_PITCH_OF_VZ_PGAIN value: 0.15
      Description: feedforward pitch gain
    • name AIRSPEED_PGAIN value: 0.
      Description: airspeed P gain
    • name AUTO_THROTTLE_OF_AIRSPEED_PGAIN value: 0.069
      Description: throttle P gain
    • name AUTO_THROTTLE_OF_AIRSPEED_IGAIN value: 0.01
      Description: throttle I gain
    • name AUTO_PITCH_OF_AIRSPEED_PGAIN value: 0.01
      Description: pitch P gain
    • name AUTO_PITCH_OF_AIRSPEED_IGAIN value: 0.003
      Description: pitch I gain
    • name AUTO_PITCH_OF_AIRSPEED_DGAIN value: 0.03
      Description: pitch D gain
    • name ENERGY_TOT_PGAIN value: 0.
      Description: total energy P gain
    • name ENERGY_TOT_IGAIN value: 0.
      Description: total energy I gain
    • name ENERGY_DIFF_PGAIN value: 0.
      Description: differential energy P gain
    • name ENERGY_DIFF_IGAIN value: 0.
      Description: differential energy I gain
    • name AUTO_GROUNDSPEED_SETPOINT value: 6.0
      Description: default ground speed setpoint
    • name AUTO_GROUNDSPEED_PGAIN value: 0.75
      Description: ground speed P gain
    • name AUTO_GROUNDSPEED_IGAIN value: 0.25
      Description: ground speed I gain
    • name THROTTLE_SLEW_LIMITER value: 1
      Description: throttle slew rate limiter

Module functions

Init Functions

These initialization functions are called once on startup.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

  • /guidance/energy_ctrl.c

Raw guidance_energy.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="guidance_energy" dir="guidance" task="control">
<doc>
<description>
Energy based vertical control for fixedwing aircraft.
Airspeed sensor is mandatory for this controller.
</description>
<section name="VERTICAL CONTROL" prefix="V_CTL_">
<define name="POWER_CTL_BAT_NOMINAL" value="11.1" description="nominal battery voltage in cruise flight" unit="volt"/>
<define name="ALTITUDE_PGAIN" value="0.1" description="altitude loop P gain"/>
<define name="ALTITUDE_MAX_CLIMB" value="5." description="max climb rate" unit="m/s"/>
<define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.3" description="nominal throttle for cruise flight"/>
<define name="AUTO_THROTTLE_NOMINAL_CRUISE_PITCH" value="0." description="nominal pitch angle for cruise flight"/>
<define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.1" description="feedforward throttle gain" unit="%/(m/s)"/>
<define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.15" description="feedforward pitch gain"/>
<define name="AIRSPEED_PGAIN" value="0." description="airspeed P gain"/>
<define name="AUTO_THROTTLE_OF_AIRSPEED_PGAIN" value="0.069" description="throttle P gain"/>
<define name="AUTO_THROTTLE_OF_AIRSPEED_IGAIN" value="0.01" description="throttle I gain"/>
<define name="AUTO_PITCH_OF_AIRSPEED_PGAIN" value="0.01" description="pitch P gain"/>
<define name="AUTO_PITCH_OF_AIRSPEED_IGAIN" value="0.003" description="pitch I gain"/>
<define name="AUTO_PITCH_OF_AIRSPEED_DGAIN" value="0.03" description="pitch D gain"/>
<define name="ENERGY_TOT_PGAIN" value="0." description="total energy P gain"/>
<define name="ENERGY_TOT_IGAIN" value="0." description="total energy I gain"/>
<define name="ENERGY_DIFF_PGAIN" value="0." description="differential energy P gain"/>
<define name="ENERGY_DIFF_IGAIN" value="0." description="differential energy I gain"/>
<define name="AUTO_GROUNDSPEED_SETPOINT" value="6.0" description="default ground speed setpoint" unit="m/s"/>
<define name="AUTO_GROUNDSPEED_PGAIN" value="0.75" description="ground speed P gain"/>
<define name="AUTO_GROUNDSPEED_IGAIN" value="0.25" description="ground speed I gain"/>
<define name="THROTTLE_SLEW_LIMITER" value="1" description="throttle slew rate limiter" unit="s"/>
</section>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="control vert">
<dl_settings NAME="energy loop">
<dl_setting MAX="45" MIN="8.0" STEP="0.5" VAR="v_ctl_auto_airspeed_setpoint" shortname="airspeed sp" />
<dl_setting MAX="1" MIN="0.0" STEP="0.05" VAR="v_ctl_auto_throttle_nominal_cruise_throttle" shortname="cruise throttle" />
<dl_setting MAX="1" MIN="0.0" STEP="0.05" VAR="v_ctl_auto_throttle_nominal_cruise_pitch" shortname="cruise pitch" />
<dl_setting MAX="1.0" MIN="0" STEP="0.01" VAR="v_ctl_desired_acceleration" shortname="acc_cmd" />
<dl_setting MAX="1" MIN="0" STEP="0.01" VAR="v_ctl_auto_throttle_climb_throttle_increment" shortname="throttle_incr" param="V_CTL_AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT"/>
<dl_setting MAX="1" MIN="0" STEP="0.01" VAR="v_ctl_auto_throttle_pitch_of_vz_pgain" shortname="pitch_of_vz" param="V_CTL_AUTO_THROTTLE_PITCH_OF_VZ_PGAIN"/>
<dl_setting MAX="1." MIN="0" STEP="0.01" VAR="v_ctl_auto_throttle_of_airspeed_pgain" shortname="P_th_air"/>
<dl_setting MAX="0.1" MIN="0" STEP="0.001" VAR="v_ctl_auto_throttle_of_airspeed_igain" shortname="I_th_air" />
<dl_setting MAX="1." MIN="0" STEP="0.001" VAR="v_ctl_auto_pitch_of_airspeed_pgain" shortname="P_pitch_air" />
<dl_setting MAX="0.1" MIN="0" STEP="0.001" VAR="v_ctl_auto_pitch_of_airspeed_igain" shortname="I_pitch_air" />
<dl_setting MAX="5." MIN="0" STEP="0.01" VAR="v_ctl_auto_pitch_of_airspeed_dgain" shortname="D_pitch_air" />
<dl_setting MAX="1." MIN="0" STEP="0.01" VAR="v_ctl_energy_total_pgain" shortname="P_en_tot" param="V_CTL_ENERGY_TOT_PGAIN"/>
<dl_setting MAX="1." MIN="0" STEP="0.01" VAR="v_ctl_energy_total_igain" shortname="I_en_tot" param="V_CTL_ENERGY_TOT_IGAIN"/>
<dl_setting MAX="1." MIN="0" STEP="0.01" VAR="v_ctl_energy_diff_pgain" shortname="P_en_dis" param="V_CTL_ENERGY_DIFF_PGAIN"/>
<dl_setting MAX="1." MIN="0" STEP="0.01" VAR="v_ctl_energy_diff_igain" shortname="I_en_dis" param="V_CTL_ENERGY_DIFF_IGAIN"/>
</dl_settings>
<dl_settings name="groundspeed">
<dl_setting max="40" min="5" step="0.1" var="v_ctl_auto_groundspeed_setpoint" shortname="gs_sp" module="guidance/energy_ctrl" param="V_CTL_AUTO_GROUNDSPEED_SETPOINT"/>
<dl_setting max="2" min="0" step="0.01" var="v_ctl_auto_groundspeed_pgain" shortname="gs_pgain" param="V_CTL_AUTO_GROUNDSPEED_PGAIN"/>
<dl_setting max="2" min="0" step="0.01" var="v_ctl_auto_groundspeed_igain" shortname="gs_igain" param="V_CTL_AUTO_GROUNDSPEED_IGAIN"/>
</dl_settings>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>@navigation</depends>
<provides>guidance,attitude_command</provides>
</dep>
<header>
<file name="energy_ctrl.h"/>
</header>
<init fun="v_ctl_init()"/>
<makefile target="ap|sim|nps" firmware="fixedwing">
<file name="energy_ctrl.c" dir="$(SRC_FIRMWARE)/guidance"/>
<define name="CTRL_TYPE_H" value="firmwares/fixedwing/guidance/energy_ctrl.h" type="string"/>
</makefile>
</module>