Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
guidance_rotorcraft module

Base guidance code for rotorcraft

It provides:

  • horizontal guidance with reference
  • vertical guidance with reference and adaptive control
  • flip mode

Example for airframe file

Add to your firmware section:

<module name="guidance_rotorcraft"/>

Module configuration options

Airframe file section

  • section name: GUIDANCE_H prefix: GUIDANCE_H_
    • name MAX_BANK value: 20
      Description: maximum commanded bank angle
    • name PGAIN value: 79
      Description: feedback horizontal control P gain
    • name DGAIN value: 100
      Description: feedback horizontal control D gain
    • name IGAIN value: 30
      Description: feedback horizontal control I gain
  • section name: GUIDANCE_V prefix: GUIDANCE_V_
    • name HOVER_KP value: 283
      Description: feedback vertical control P gain
    • name HOVER_KD value: 82
      Description: feedback vertical control D gain
    • name HOVER_KI value: 13
      Description: feedback vertical control I gain
    • name NOMINAL_HOVER_THROTTLE value: 0.655
      Description: nominal throttle at hover (between 0 and 1)
    • name ADAPT_THROTTLE_ENABLED value: FALSE|TRUE
      Description: enable adaptive control by default

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/guidance_h.c
  • /guidance/guidance_h_ref.c
  • /guidance/guidance_v.c
  • /guidance/guidance_v_ref.c
  • /guidance/guidance_v_adapt.c
  • /guidance/guidance_flip.c

Raw guidance_rotorcraft.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="guidance_rotorcraft" dir="guidance">
<doc>
<description>
Base guidance code for rotorcraft
It provides:
- horizontal guidance with reference
- vertical guidance with reference and adaptive control
- flip mode
</description>
<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="MAX_BANK" value="20" description="maximum commanded bank angle" unit="deg"/>
<define name="PGAIN" value="79" description="feedback horizontal control P gain"/>
<define name="DGAIN" value="100" description="feedback horizontal control D gain"/>
<define name="IGAIN" value="30" description="feedback horizontal control I gain"/>
</section>
<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
<define name="HOVER_KP" value="283" description="feedback vertical control P gain"/>
<define name="HOVER_KD" value="82" description="feedback vertical control D gain"/>
<define name="HOVER_KI" value="13" description="feedback vertical control I gain"/>
<define name="NOMINAL_HOVER_THROTTLE" value="0.655" description="nominal throttle at hover (between 0 and 1)"/>
<define name="ADAPT_THROTTLE_ENABLED" value="FALSE|TRUE" description="enable adaptive control by default"/>
</section>
</doc>
<settings target="ap|nps">
<dl_settings>
<dl_settings NAME="Vert Loop">
<dl_setting var="guidance_v_kp" min="0" step="1" max="600" shortname="kp" param="GUIDANCE_V_HOVER_KP" persistent="true" module="guidance/guidance_v"/>
<dl_setting var="guidance_v_kd" min="0" step="1" max="600" shortname="kd" param="GUIDANCE_V_HOVER_KD" persistent="true"/>
<dl_setting var="guidance_v_ki" min="0" step="1" max="300" shortname="ki" handler="SetKi" param="GUIDANCE_V_HOVER_KI" persistent="true" module="guidance/guidance_v"/>
<dl_setting var="guidance_v_nominal_throttle" min="0.2" step="0.01" max="0.8" shortname="nominal_throttle" param="GUIDANCE_V_NOMINAL_HOVER_THROTTLE" persistent="true"/>
<dl_setting var="guidance_v_adapt_throttle_enabled" min="0" step="1" max="1" shortname="adapt_throttle" param="GUIDANCE_V_ADAPT_THROTTLE_ENABLED" values="FALSE|TRUE" persistent="true"/>
<dl_setting var="guidance_v_z_sp" min="-5" step="0.5" max="3" shortname="sp" unit="2e-8m" alt_unit="m" alt_unit_coef="0.00390625"/>
</dl_settings>
<dl_settings NAME="Horiz Loop">
<dl_setting var="guidance_h.use_ref" min="0" step="1" max="1" shortname="use_ref" values="FALSE|TRUE" handler="SetUseRef" param="GUIDANCE_H_USE_REF" persistent="true" module="guidance/guidance_h"/>
<dl_setting var="gh_ref.max_speed" min="0.1" step="0.1" max="15.0" shortname="max_speed" handler="SetMaxSpeed" param="GUIDANCE_H_REF_MAX_SPEED" type="float" persistent="true" module="guidance/guidance_h"/>
<dl_setting var="guidance_h.approx_force_by_thrust" min="0" step="1" max="1" shortname="approx_force" values="FALSE|TRUE" param="GUIDANCE_H_APPROX_FORCE_BY_THRUST" type="uint8" persistent="true"/>
<dl_setting var="gh_ref.tau" min="0.1" step="0.1" max="1.0" shortname="tau" handler="SetTau" param="GUIDANCE_H_REF_TAU" type="float" persistent="true" module="guidance/guidance_h"/>
<dl_setting var="gh_ref.omega" min="0.1" step="0.1" max="3.0" shortname="omega" handler="SetOmega" param="GUIDANCE_H_REF_OMEGA" type="float" persistent="true" module="guidance/guidance_h"/>
<dl_setting var="gh_ref.zeta" min="0.7" step="0.05" max="1.0" shortname="zeta" handler="SetZeta" param="GUIDANCE_H_REF_ZETA" type="float" persistent="true" module="guidance/guidance_h"/>
<dl_setting var="guidance_h.gains.p" min="0" step="1" max="400" shortname="kp" param="GUIDANCE_H_PGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_h.gains.d" min="0" step="1" max="400" shortname="kd" param="GUIDANCE_H_DGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_h.gains.i" min="0" step="1" max="400" shortname="ki" handler="set_igain" param="GUIDANCE_H_IGAIN" type="int32" persistent="true" module="guidance/guidance_h"/>
<dl_setting var="guidance_h.gains.v" min="0" step="1" max="400" shortname="kv" param="GUIDANCE_H_VGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_h.gains.a" min="0" step="1" max="400" shortname="ka" param="GUIDANCE_H_AGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_h.sp.pos.x" MIN="-10" MAX="10" STEP="1" shortname="sp_x_ned" unit="1/2^8m" alt_unit="m" alt_unit_coef="0.00390625"/>
<dl_setting var="guidance_h.sp.pos.y" MIN="-10" MAX="10" STEP="1" shortname="sp_y_ned" unit="1/2^8m" alt_unit="m" alt_unit_coef="0.00390625"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="guidance_h.h"/>
<file name="guidance_v.h"/>
</header>
<init fun="guidance_h_init()"/>
<init fun="guidance_v_init()"/>
<makefile target="ap|nps|hitl" firmware="rotorcraft">
<file name="guidance_h.c" dir="$(SRC_FIRMWARE)/guidance"/>
<file name="guidance_h_ref.c" dir="$(SRC_FIRMWARE)/guidance"/>
<file name="guidance_v.c" dir="$(SRC_FIRMWARE)/guidance"/>
<file name="guidance_v_ref.c" dir="$(SRC_FIRMWARE)/guidance"/>
<file name="guidance_v_adapt.c" dir="$(SRC_FIRMWARE)/guidance"/>
<file name="guidance_flip.c" dir="$(SRC_FIRMWARE)/guidance"/>
</makefile>
</module>