Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
stabilization_attitude_quat_int.c File Reference

Rotorcraft quaternion attitude stabilization. More...

#include "firmwares/rotorcraft/stabilization.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_rc_setpoint.h"
#include <stdio.h>
#include "math/pprz_algebra_float.h"
#include "math/pprz_algebra_int.h"
#include "state.h"
#include "generated/airframe.h"
+ Include dependency graph for stabilization_attitude_quat_int.c:

Go to the source code of this file.

Macros

#define IERROR_SCALE   1024
 
#define GAIN_PRESCALER_FF   48
 
#define GAIN_PRESCALER_P   48
 
#define GAIN_PRESCALER_D   48
 
#define GAIN_PRESCALER_I   48
 
#define OFFSET_AND_ROUND(_a, _b)   (((_a)+(1<<((_b)-1)))>>(_b))
 
#define OFFSET_AND_ROUND2(_a, _b)   (((_a)+(1<<((_b)-1))-((_a)<0?1:0))>>(_b))
 

Functions

void stabilization_attitude_init (void)
 
void stabilization_attitude_enter (void)
 
void stabilization_attitude_set_failsafe_setpoint (void)
 
void stabilization_attitude_set_from_eulers_i (struct Int32Eulers *sp_euler)
 
static void attitude_run_ff (int32_t ff_commands[], struct Int32AttitudeGains *gains, struct Int32Rates *ref_accel)
 
static void attitude_run_fb (int32_t fb_commands[], struct Int32AttitudeGains *gains, struct Int32Quat *att_err, struct Int32Rates *rate_err, struct Int32Quat *sum_err)
 
void stabilization_attitude_run (bool_t enable_integrator)
 
void stabilization_attitude_read_rc (bool_t in_flight)
 

Variables

struct Int32AttitudeGains stabilization_gains
 
struct Int32Quat stabilization_att_sum_err_quat
 
struct Int32Eulers stabilization_att_sum_err
 
int32_t stabilization_att_fb_cmd [COMMANDS_NB]
 
int32_t stabilization_att_ff_cmd [COMMANDS_NB]
 

Detailed Description

Rotorcraft quaternion attitude stabilization.

Definition in file stabilization_attitude_quat_int.c.

Macro Definition Documentation

#define GAIN_PRESCALER_D   48

Definition at line 64 of file stabilization_attitude_quat_int.c.

Referenced by attitude_run_fb().

#define GAIN_PRESCALER_FF   48

Definition at line 62 of file stabilization_attitude_quat_int.c.

Referenced by attitude_run_ff().

#define GAIN_PRESCALER_I   48

Definition at line 65 of file stabilization_attitude_quat_int.c.

Referenced by attitude_run_fb().

#define GAIN_PRESCALER_P   48

Definition at line 63 of file stabilization_attitude_quat_int.c.

Referenced by attitude_run_fb().

#define IERROR_SCALE   1024

Definition at line 61 of file stabilization_attitude_quat_int.c.

Referenced by stabilization_attitude_run().

#define OFFSET_AND_ROUND (   _a,
  _b 
)    (((_a)+(1<<((_b)-1)))>>(_b))

Definition at line 102 of file stabilization_attitude_quat_int.c.

#define OFFSET_AND_ROUND2 (   _a,
  _b 
)    (((_a)+(1<<((_b)-1))-((_a)<0?1:0))>>(_b))

Definition at line 103 of file stabilization_attitude_quat_int.c.

Function Documentation

static void attitude_run_fb ( int32_t  fb_commands[],
struct Int32AttitudeGains gains,
struct Int32Quat att_err,
struct Int32Rates rate_err,
struct Int32Quat sum_err 
)
static
static void attitude_run_ff ( int32_t  ff_commands[],
struct Int32AttitudeGains gains,
struct Int32Rates ref_accel 
)
static
void stabilization_attitude_enter ( void  )
void stabilization_attitude_init ( void  )

Definition at line 67 of file stabilization_attitude_quat_int.c.

References INT32_QUAT_ZERO, INT_EULERS_ZERO, stabilization_att_sum_err, stabilization_att_sum_err_quat, and stabilization_attitude_ref_init().

Referenced by stabilization_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stabilization_attitude_read_rc ( bool_t  in_flight)

Definition at line 194 of file stabilization_attitude_quat_int.c.

References QUAT_BFP_OF_REAL, stab_att_sp_quat, stabilization_attitude_read_rc_setpoint_quat_earth_bound_f(), and stabilization_attitude_read_rc_setpoint_quat_f().

Referenced by guidance_h_read_rc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stabilization_attitude_set_failsafe_setpoint ( void  )

Definition at line 86 of file stabilization_attitude_quat_int.c.

References PPRZ_ITRIG_COS, PPRZ_ITRIG_SIN, Int32Quat::qi, Int32Quat::qx, Int32Quat::qy, Int32Quat::qz, stab_att_sp_quat, and stabilization_attitude_get_heading_i().

Referenced by autopilot_set_mode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stabilization_attitude_set_from_eulers_i ( struct Int32Eulers sp_euler)

Definition at line 95 of file stabilization_attitude_quat_int.c.

References INT32_QUAT_OF_EULERS, INT32_QUAT_WRAP_SHORTEST, stab_att_sp_euler, and stab_att_sp_quat.

Referenced by guidance_h_run(), and guidance_h_traj_run().

+ Here is the caller graph for this function:

Variable Documentation

int32_t stabilization_att_fb_cmd[COMMANDS_NB]

Definition at line 58 of file stabilization_attitude_quat_int.c.

Referenced by stabilization_attitude_run().

int32_t stabilization_att_ff_cmd[COMMANDS_NB]

Definition at line 59 of file stabilization_attitude_quat_int.c.

Referenced by stabilization_attitude_run().

struct Int32Eulers stabilization_att_sum_err
struct Int32Quat stabilization_att_sum_err_quat
struct Int32AttitudeGains stabilization_gains
Initial value:
= {
{STABILIZATION_ATTITUDE_PHI_PGAIN, STABILIZATION_ATTITUDE_THETA_PGAIN, STABILIZATION_ATTITUDE_PSI_PGAIN },
{STABILIZATION_ATTITUDE_PHI_DGAIN, STABILIZATION_ATTITUDE_THETA_DGAIN, STABILIZATION_ATTITUDE_PSI_DGAIN },
{STABILIZATION_ATTITUDE_PHI_DDGAIN, STABILIZATION_ATTITUDE_THETA_DDGAIN, STABILIZATION_ATTITUDE_PSI_DDGAIN },
{STABILIZATION_ATTITUDE_PHI_IGAIN, STABILIZATION_ATTITUDE_THETA_IGAIN, STABILIZATION_ATTITUDE_PSI_IGAIN }
}

Definition at line 35 of file stabilization_attitude_quat_int.c.

Referenced by gain_scheduling_init(), gain_scheduling_periodic(), and set_gainset().