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

Doublet input for system identification.

The doublet is a multi step maneuver for system identification. Two modes are implemented, the 0,1,-1,0 maneuver (which correspond to one period of a squared sine wave oscillation, and the "so-called" 3-2-1-1 maneuver.

The module is used by including the module in the airframe file and adding the following line to the <command_laws> section:

<call fun="sys_id_doublet_add_values(autopilot_get_motors_on(),FALSE,values)">

You can pick the axes to apply doublets to by setting the SYS_ID_DOUBLET_AXES variable with the COMMAND_XXX variables where XXX are the actuators defined in the <commands> section of your airframe.

Remeber to deactivate the control input when the system identification input is running using (can be checked using the sys_id_wave_running() function)

Then, the GCS exposes the settings for the doublet.

  • 3-2-1-1 setting is to execute the 3-2-1-1 doublet maneuver when active. Otherwise, the normal 1-1 doublet maneuver will be executed.
  • The Doublet axis settings is the index (0-based) of the axis to choose within the SYS_ID_DOUBLET_AXES variable specified. In the default, this means i.e. 0 means roll doublet.
  • Amplitude is the amplitude of the doublet
  • Length_s is the length in seconds of the doublet. The lenght of each doublet step depends on the active mode and on the doublet lenght.
  • Extra_waiting_time_s is the length in second of the waiting time with zero input after the doublet maneuver is over.

Start the doublet by checking the Active box in the "Activate doublet". Stop the doublet by checking the Inactive box in the same input setting.

Example for airframe file

Add to your firmware section:

<module name="sys_id_doublet"/>

Module configuration options

Airframe file section

  • section name: SYS_ID prefix: SYS_ID_
    • name DOUBLET_AXES value: {COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW}
      Description: Which axes the doublet is applied to (specify as array with {})
    • name DOUBLET_ENABLED value: TRUE|FALSE
      Description: If false, the doublet does not run and values are not added
    • name DOUBLET_MOD value: 0
      Description: 0= normal, 1=half, 2=the 3-2-1-1 doublet

Module functions

Init Functions

These initialization functions are called once on startup.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • sys_id_doublet_run()
    • Frequency in Hz: 60
    • Autorun: TRUE
      Periodic function automatically starts after init.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw sys_id_doublet.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="sys_id_doublet" dir="system_identification">
<doc>
<description>Doublet input for system identification.
The doublet is a multi step maneuver for system identification. Two modes are implemented, the 0,1,-1,0 maneuver (which correspond to
one period of a squared sine wave oscillation, and the "so-called" 3-2-1-1 maneuver.
The module is used by including the module in the airframe file and adding the following line to the &lt;command_laws&gt; section:
&lt;call fun="sys_id_doublet_add_values(autopilot_get_motors_on(),FALSE,values)"/&gt;
You can pick the axes to apply doublets to by setting the SYS_ID_DOUBLET_AXES variable with the COMMAND_XXX variables where XXX are the actuators defined in
the &lt;commands&gt; section of your airframe.
Remeber to deactivate the control input when the system identification input is running using (can be checked using the sys_id_wave_running() function)
Then, the GCS exposes the settings for the doublet.
- 3-2-1-1 setting is to execute the 3-2-1-1 doublet maneuver when active. Otherwise, the normal 1-1 doublet maneuver will be executed.
- The Doublet axis settings is the index (0-based) of the axis to choose within the SYS_ID_DOUBLET_AXES variable specified. In the default, this means i.e. 0 means roll doublet.
- Amplitude is the amplitude of the doublet
- Length_s is the length in seconds of the doublet. The lenght of each doublet step depends on the active mode and on the doublet lenght.
- Extra_waiting_time_s is the length in second of the waiting time with zero input after the doublet maneuver is over.
Start the doublet by checking the Active box in the "Activate doublet". Stop the doublet by checking the Inactive box in the same input setting.
</description>
<section name="SYS_ID" prefix="SYS_ID_">
<define name="DOUBLET_AXES" value="{COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW}" description="Which axes the doublet is applied to (specify as array with {})"/>
<define name="DOUBLET_ENABLED" value="TRUE|FALSE" description="If false, the doublet does not run and values are not added"/>
<define name="DOUBLET_MOD" value="0" description="0= normal, 1=half, 2=the 3-2-1-1 doublet"/>
</section>
</doc>
<settings>
<dl_settings name="System identification">
<dl_settings name="Doublet input">
<dl_setting min="0" max="1" step="1" values="Inactive|Active" shortname="Doublet" var="doublet_active" type="uint8_t" module="system_identification/sys_id_doublet" handler="activate_handler"/>
<dl_setting min="0" max="2" step="1" values="Normal|Half|3211" shortname="mode" var="doublet_mode" type="uint8_t" module="system_identification/sys_id_doublet" handler="mod_handler" param="SYS_ID_DOUBLET_MOD"/>
<dl_setting min="-9600" max="9600" step="100" shortname="Amplitude" var="doublet_amplitude" type="int32_t" module="system_identification/sys_id_doublet"/>
<dl_setting min="0" max="8" step="1" shortname="Doublet axis" var="doublet_axis" type="uint8_t" module="system_identification/sys_id_doublet" handler="axis_handler"/>
<dl_setting min="0" max="100" step="0.5" shortname="Length_s" var="doublet_length_s" type="float" module="system_identification/sys_id_doublet"/>
<dl_setting min="0" max="100" step="0.5" shortname="Extra_waiting_s" var="doublet_extra_waiting_time_s" type="float" module="system_identification/sys_id_doublet"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="sys_id_doublet.h"/>
</header>
<init fun="sys_id_doublet_init()"/>
<periodic fun="sys_id_doublet_run()" freq="60" autorun="TRUE"/>
<makefile>
<file name="pprz_doublet.c"/>
<file name="sys_id_doublet.c"/>
</makefile>
</module>