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

Basic guidance code for rotorcraft with PID control

No detailed description...

Example for airframe file

Add to your firmware section:

<module name="guidance_pid_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_pid.c

Raw guidance_pid_rotorcraft.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="guidance_pid_rotorcraft" dir="guidance" task="control">
<doc>
<description>
Basic guidance code for rotorcraft with PID control
</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 PID">
<dl_setting var="guidance_pid.v_kp" min="0" step="1" max="600" shortname="kp" param="GUIDANCE_V_HOVER_KP" persistent="true" module="guidance/guidance_pid"/>
<dl_setting var="guidance_pid.v_kd" min="0" step="1" max="600" shortname="kd" param="GUIDANCE_V_HOVER_KD" persistent="true"/>
<dl_setting var="guidance_pid.v_ki" min="0" step="1" max="300" shortname="ki" handler="set_v_igain" param="GUIDANCE_V_HOVER_KI" persistent="true" module="guidance/guidance_pid"/>
<dl_setting var="guidance_pid.adapt_throttle_enabled" min="0" step="1" max="1" shortname="adapt_throttle" param="GUIDANCE_V_ADAPT_THROTTLE_ENABLED" values="FALSE|TRUE" persistent="true"/>
</dl_settings>
<dl_settings NAME="Horiz PID">
<dl_setting var="guidance_pid.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="guidance_pid.kp" min="0" step="1" max="400" shortname="kp" param="GUIDANCE_H_PGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_pid.kd" min="0" step="1" max="400" shortname="kd" param="GUIDANCE_H_DGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_pid.ki" min="0" step="1" max="400" shortname="ki" handler="set_h_igain" param="GUIDANCE_H_IGAIN" type="int32" persistent="true" module="guidance/guidance_pid"/>
<dl_setting var="guidance_pid.kv" min="0" step="1" max="400" shortname="kv" param="GUIDANCE_H_VGAIN" type="int32" persistent="true"/>
<dl_setting var="guidance_pid.ka" min="0" step="1" max="400" shortname="ka" param="GUIDANCE_H_AGAIN" type="int32" persistent="true"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>@stabilization,guidance_rotorcraft</depends>
<provides>guidance,attitude_command</provides>
</dep>
<header>
<file name="guidance_pid.h"/>
</header>
<init fun="guidance_pid_init()"/>
<makefile target="ap|nps" firmware="rotorcraft">
<file name="guidance_pid.c" dir="$(SRC_FIRMWARE)/guidance"/>
</makefile>
</module>