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

Chirp maneuver for system identification.

The chirp is a sine wave with frequency increasing constantly in time. It's a good candidate as input for system identification since it covers a broad frequency spectrum. This module automates performance of the chirp and exposes an easy interface for tailoring the maneuver to your specific aircraft.

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_chirp_add_values(autopilot_get_motors_on(),FALSE,values)">

You can pick the axes to apply chirps to by setting the CHIRP_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 chirp.

  • The Chirp axis settings is the index (0-based) of the axis to choose within the CHIRP_AXES variable specified. In the default, this means i.e. 0 means roll chirp.
  • Amplitude is the amplitude of the chirp
  • On-axis noise is the fraction of the chirp amplitude to add as noise to the chirp axis (see pprz_chirp.h for more details)
  • On-axis noise is the absolute value for off-axis noise (see pprz_chirp.h for more details)
  • Fstart_hz and Fend_hz are the frequencies in hertz at the start and end of the chirp. Make sure to cover all relevant dynamics frequencies
  • Length_s is the length in seconds of the chirp

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

Add the message "CHIRP" to your telemetry to see chirp progress, and to your logger to automatically filter chirps in post-processing.

Example for airframe file

Add to your firmware section:

<module name="sys_id_chirp"/>

Module configuration options

Airframe file section

  • section name: SYS_ID prefix: SYS_ID_
    • name CHIRP_AXES value: {COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW,COMMAND_THRUST}
      Description: Which axes the chirp is applied to (specify as array with {})
    • name CHIRP_ENABLED value: TRUE|FALSE
      Description: If false, the chirp does not run and values are not added
    • name CHIRP_USE_NOISE value: TRUE|FALSE
      Description: If true, add noise to all axes (also the axes where no chirp is active)
    • name CHIRP_EXPONENTIAL value: TRUE|FALSE
      Description: If true, exponential-time chirp. Else, linear-time chirp
    • name CHIRP_FADEIN value: TRUE|FALSE
      Description: If true, start the chirp with two wavelengths of the lowest frequency

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_chirp_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_chirp.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="sys_id_chirp" dir="system_identification">
<doc>
<description>Chirp maneuver for system identification.
The chirp is a sine wave with frequency increasing constantly in time. It's a good candidate as input for system identification
since it covers a broad frequency spectrum. This module automates performance of the chirp and exposes an easy interface
for tailoring the maneuver to your specific aircraft.
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_chirp_add_values(autopilot_get_motors_on(),FALSE,values)"/&gt;
You can pick the axes to apply chirps to by setting the CHIRP_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 chirp.
- The Chirp axis settings is the index (0-based) of the axis to choose within the CHIRP_AXES variable specified. In the default, this means i.e. 0 means roll chirp.
- Amplitude is the amplitude of the chirp
- On-axis noise is the fraction of the chirp amplitude to add as noise to the chirp axis (see pprz_chirp.h for more details)
- On-axis noise is the absolute value for off-axis noise (see pprz_chirp.h for more details)
- Fstart_hz and Fend_hz are the frequencies in hertz at the start and end of the chirp. Make sure to cover all relevant dynamics frequencies
- Length_s is the length in seconds of the chirp
Start the chirp by checking the Active box in the "Activate chirp". Stop the chirp by checking the Inactive box in the same input setting.
Add the message "CHIRP" to your telemetry to see chirp progress, and to your logger to automatically filter chirps in post-processing.
</description>
<section name="SYS_ID" prefix="SYS_ID_">
<define name="CHIRP_AXES" value="{COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW,COMMAND_THRUST}" description="Which axes the chirp is applied to (specify as array with {})"/>
<define name="CHIRP_ENABLED" value="TRUE|FALSE" description="If false, the chirp does not run and values are not added"/>
<define name="CHIRP_USE_NOISE" value="TRUE|FALSE" description="If true, add noise to all axes (also the axes where no chirp is active)"/>
<define name="CHIRP_EXPONENTIAL" value="TRUE|FALSE" description="If true, exponential-time chirp. Else, linear-time chirp"/>
<define name="CHIRP_FADEIN" value="TRUE|FALSE" description="If true, start the chirp with two wavelengths of the lowest frequency"/>
</section>
</doc>
<settings>
<dl_settings name="System identification">
<dl_settings name="Chirp input">
<dl_setting min="0" max="1" step="1" values="Inactive|Active" shortname="Chirp" var="chirp_active" type="uint8_t" module="system_identification/sys_id_chirp" handler="activate_handler"/>
<dl_setting min="0" max="1" step="1" values="Inactive|Active" shortname="Fade in" var="chirp_fade_in" type="uint8_t" module="system_identification/sys_id_chirp" handler="fade_in_activate_handler" param="SYS_ID_CHIRP_FADEIN"/>
<dl_setting min="0" max="1" step="1" values="Inactive|Active" shortname="Exponential" var="chirp_exponential" type="uint8_t" module="system_identification/sys_id_chirp" handler="exponential_activate_handler" param="SYS_ID_CHIRP_EXPONENTIAL"/>
<dl_setting min="0" max="7" step="1" shortname="Chirp axis" var="chirp_axis" type="uint8_t" module="system_identification/sys_id_chirp" handler="axis_handler"/>
<dl_setting min="0" max="9600" step="100" shortname="Amplitude" var="chirp_amplitude" type="int32_t" module="system_identification/sys_id_chirp"/>
<dl_setting min="0" max="0.5" step="0.01" shortname="on-axis noise" var="chirp_noise_stdv_onaxis_ratio" type="float" module="system_identification/sys_id_chirp"/>
<dl_setting min="0" max="9600" step="50" shortname="off-axis noise" var="chirp_noise_stdv_offaxis" type="float" module="system_identification/sys_id_chirp"/>
<dl_setting min="0.05" max="20" step="0.05" shortname="Fstart_hz" var="chirp_fstart_hz" type="float" module="system_identification/sys_id_chirp" handler="fstart_handler"/>
<dl_setting min="0.1" max="20" step="0.1" shortname="Fend_hz" var="chirp_fstop_hz" type="float" module="system_identification/sys_id_chirp" handler="fstop_handler"/>
<dl_setting min="0" max="100" step="0.5" shortname="Length_s" var="chirp_length_s" type="float" module="system_identification/sys_id_chirp"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="sys_id_chirp.h"/>
</header>
<init fun="sys_id_chirp_init()"/>
<periodic fun="sys_id_chirp_run()" freq="60" autorun="TRUE"/>
<makefile>
<file name="pprz_random.c" dir="math"/>
<file name="pprz_chirp.c"/>
<file name="sys_id_chirp.c"/>
</makefile>
</module>