Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
sys_id_wave.c File Reference
#include "std.h"
#include "math.h"
#include "pprz_wave.h"
#include "sys_id_wave.h"
#include "modules/datalink/telemetry.h"
#include "generated/airframe.h"
#include "mcu_periph/sys_time.h"
#include "filters/low_pass_filter.h"
#include "math/pprz_random.h"
+ Include dependency graph for sys_id_wave.c:

Go to the source code of this file.

Macros

#define WAVE_AXES   {COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW,COMMAND_THRUST}
 
#define WAVE_ENABLED   TRUE
 
#define WAVE_NB_AXES   sizeof ACTIVE_WAVE_AXES / sizeof ACTIVE_WAVE_AXES[0]
 

Functions

static void set_current_wave_values (void)
 
static void send_wave (struct transport_tx *trans, struct link_device *dev)
 
static void start_wave (void)
 
static void stop_wave (void)
 
void sys_id_wave_activate_handler (uint8_t activate)
 
void sys_id_wave_axis_handler (uint8_t axis)
 
uint8_t sys_id_wave_running (void)
 
void sys_id_wave_frequency_hz_set (float frequency_hz_set)
 
void sys_id_wave_lag_rad_set (float lag_rad_set)
 
void sys_id_wave_init (void)
 
void sys_id_wave_run (void)
 
void sys_id_wave_add_values (bool motors_on, bool override_on, pprz_t in_cmd[])
 

Variables

static struct wave_t wave_s
 
uint8_t wave_active = false
 
uint8_t wave_axis = 0
 
pprz_t wave_amplitude = 0
 
float frequency_hz_ = 0.0f
 
float lag_rad_ = 0.0f
 
static const int8_t ACTIVE_WAVE_AXES [] = WAVE_AXES
 
static pprz_t current_wave_values [WAVE_NB_AXES]
 

Detailed Description

Author
Alessandro Collicelli System excitation pure sine wave

This is the module implementation for the a sine wave input. Use sys_id_wave by adding the module to your airframe file and adding the following line to the top of the <command_laws> section of your airframe file:

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

In the GCS you can then start and stop the wave, change wave frequency. Documentation of the specific options can be found in the module xml file.

Definition in file sys_id_wave.c.

Macro Definition Documentation

◆ WAVE_AXES

#define WAVE_AXES   {COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW,COMMAND_THRUST}

Definition at line 47 of file sys_id_wave.c.

◆ WAVE_ENABLED

#define WAVE_ENABLED   TRUE

Definition at line 51 of file sys_id_wave.c.

◆ WAVE_NB_AXES

#define WAVE_NB_AXES   sizeof ACTIVE_WAVE_AXES / sizeof ACTIVE_WAVE_AXES[0]

Definition at line 64 of file sys_id_wave.c.

Function Documentation

◆ send_wave()

static void send_wave ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 81 of file sys_id_wave.c.

References current_wave_values, dev, wave_t::frequency_hz, wave_t::lag_rad, wave_active, wave_amplitude, wave_axis, and wave_s.

Referenced by sys_id_wave_init().

+ Here is the caller graph for this function:

◆ set_current_wave_values()

static void set_current_wave_values ( void  )
static

Definition at line 69 of file sys_id_wave.c.

References wave_t::current_value, current_wave_values, wave_t::is_running, wave_active, wave_amplitude, wave_axis, WAVE_NB_AXES, and wave_s.

Referenced by start_wave(), stop_wave(), sys_id_wave_init(), and sys_id_wave_run().

+ Here is the caller graph for this function:

◆ start_wave()

static void start_wave ( void  )
static

Definition at line 86 of file sys_id_wave.c.

References get_sys_time_float(), set_current_wave_values(), wave_active, wave_reset(), and wave_s.

Referenced by sys_id_wave_activate_handler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop_wave()

static void stop_wave ( void  )
static

Definition at line 93 of file sys_id_wave.c.

References get_sys_time_float(), set_current_wave_values(), wave_active, wave_reset(), and wave_s.

Referenced by sys_id_wave_activate_handler(), and sys_id_wave_run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sys_id_wave_activate_handler()

void sys_id_wave_activate_handler ( uint8_t  activate)

Definition at line 100 of file sys_id_wave.c.

References frequency_hz_, get_sys_time_float(), lag_rad_, start_wave(), stop_wave(), wave_active, wave_init(), and wave_s.

+ Here is the call graph for this function:

◆ sys_id_wave_add_values()

void sys_id_wave_add_values ( bool  motors_on,
bool  override_on,
pprz_t  in_cmd[] 
)

Definition at line 159 of file sys_id_wave.c.

References ACTIVE_WAVE_AXES, current_wave_values, MAX_PPRZ, and WAVE_NB_AXES.

◆ sys_id_wave_axis_handler()

void sys_id_wave_axis_handler ( uint8_t  axis)

Definition at line 110 of file sys_id_wave.c.

References wave_axis, and WAVE_NB_AXES.

◆ sys_id_wave_frequency_hz_set()

void sys_id_wave_frequency_hz_set ( float  frequency_hz_set)

Definition at line 123 of file sys_id_wave.c.

References frequency_hz_, get_sys_time_float(), lag_rad_, wave_init(), and wave_s.

+ Here is the call graph for this function:

◆ sys_id_wave_init()

void sys_id_wave_init ( void  )

Definition at line 136 of file sys_id_wave.c.

References DefaultPeriodic, frequency_hz_, get_sys_time_float(), lag_rad_, register_periodic_telemetry(), send_wave(), set_current_wave_values(), wave_init(), and wave_s.

+ Here is the call graph for this function:

◆ sys_id_wave_lag_rad_set()

void sys_id_wave_lag_rad_set ( float  lag_rad_set)

Definition at line 129 of file sys_id_wave.c.

References frequency_hz_, get_sys_time_float(), lag_rad_, wave_init(), and wave_s.

+ Here is the call graph for this function:

◆ sys_id_wave_run()

void sys_id_wave_run ( void  )

Definition at line 144 of file sys_id_wave.c.

References get_sys_time_float(), set_current_wave_values(), stop_wave(), wave_active, wave_is_running(), wave_s, and wave_update().

+ Here is the call graph for this function:

◆ sys_id_wave_running()

uint8_t sys_id_wave_running ( void  )

Definition at line 118 of file sys_id_wave.c.

References wave_active.

Variable Documentation

◆ ACTIVE_WAVE_AXES

const int8_t ACTIVE_WAVE_AXES[] = WAVE_AXES
static

Definition at line 63 of file sys_id_wave.c.

Referenced by sys_id_wave_add_values().

◆ current_wave_values

pprz_t current_wave_values[WAVE_NB_AXES]
static

Definition at line 67 of file sys_id_wave.c.

Referenced by send_wave(), set_current_wave_values(), and sys_id_wave_add_values().

◆ frequency_hz_

float frequency_hz_ = 0.0f

◆ lag_rad_

float lag_rad_ = 0.0f

◆ wave_active

◆ wave_amplitude

pprz_t wave_amplitude = 0

Definition at line 59 of file sys_id_wave.c.

Referenced by send_wave(), and set_current_wave_values().

◆ wave_axis

uint8_t wave_axis = 0

Definition at line 58 of file sys_id_wave.c.

Referenced by send_wave(), set_current_wave_values(), and sys_id_wave_axis_handler().

◆ wave_s