Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
motor_mixing.c File Reference

Motor Mixing. More...

+ Include dependency graph for motor_mixing.c:

Go to the source code of this file.

Macros

#define INT32_MIN   (-2147483647-1)
 
#define INT32_MAX   (2147483647)
 
#define MOTOR_MIXING_MIN_MOTOR   0
 
#define MOTOR_MIXING_MAX_MOTOR   MAX_PPRZ
 
#define MOTOR_MIXING_STOP_MOTOR   -MAX_PPRZ
 
#define MOTOR_MIXING_TRIM_ROLL   0
 
#define MOTOR_MIXING_TRIM_PITCH   0
 
#define MOTOR_MIXING_TRIM_YAW   0
 
#define MOTOR_MIXING_MAX_SATURATION_OFFSET   MAX_PPRZ/10
 Maximum offset in case of saturation. More...
 
#define MOTOR_MIXING_MIN_MOTOR_STARTUP   MOTOR_MIXING_MIN_MOTOR
 

Functions

static void send_motor_mixing (struct transport_tx *trans, struct link_device *dev)
 
void motor_mixing_init (void)
 
static void offset_commands (int32_t offset)
 
static void bound_commands (void)
 
static void bound_commands_step (void)
 
void motor_mixing_run_spinup (uint32_t counter, uint32_t max_counter)
 
void motor_mixing_run (bool motors_on, bool override_on, pprz_t in_cmd[])
 

Variables

static const int32_t roll_coef [MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_ROLL_COEF
 
static const int32_t pitch_coef [MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_PITCH_COEF
 
static const int32_t yaw_coef [MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_YAW_COEF
 
static const int32_t thrust_coef [MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_THRUST_COEF
 
struct MotorMixing motor_mixing
 

Detailed Description

Motor Mixing.

Handles the mapping of roll/pitch/yaw commands to actual motor commands.

Definition in file motor_mixing.c.

Macro Definition Documentation

#define INT32_MAX   (2147483647)

Definition at line 37 of file motor_mixing.c.

Referenced by motor_mixing_run().

#define INT32_MIN   (-2147483647-1)

Definition at line 33 of file motor_mixing.c.

Referenced by motor_mixing_run().

#define MOTOR_MIXING_MAX_MOTOR   MAX_PPRZ

Definition at line 44 of file motor_mixing.c.

Referenced by bound_commands(), and motor_mixing_run().

#define MOTOR_MIXING_MAX_SATURATION_OFFSET   MAX_PPRZ/10

Maximum offset in case of saturation.

If a saturation is reached (desired motor command outside of possible MIN_MOTOR/MAX_MOTOR range), this saturation_offset is applied to all motors in order to give attitude commands a higher priority than thrust. This setting limits the saturation_offset. Default is 10% of maximum command.

Definition at line 69 of file motor_mixing.c.

Referenced by motor_mixing_run().

#define MOTOR_MIXING_MIN_MOTOR   0

Definition at line 43 of file motor_mixing.c.

Referenced by bound_commands(), motor_mixing_run(), and motor_mixing_run_spinup().

#define MOTOR_MIXING_MIN_MOTOR_STARTUP   MOTOR_MIXING_MIN_MOTOR

Definition at line 73 of file motor_mixing.c.

Referenced by motor_mixing_run_spinup().

#define MOTOR_MIXING_STOP_MOTOR   -MAX_PPRZ

Definition at line 47 of file motor_mixing.c.

Referenced by motor_mixing_init(), and motor_mixing_run().

#define MOTOR_MIXING_TRIM_PITCH   0

Definition at line 55 of file motor_mixing.c.

Referenced by motor_mixing_init().

#define MOTOR_MIXING_TRIM_ROLL   0

Definition at line 51 of file motor_mixing.c.

Referenced by motor_mixing_init().

#define MOTOR_MIXING_TRIM_YAW   0

Definition at line 59 of file motor_mixing.c.

Referenced by motor_mixing_init().

Function Documentation

static void bound_commands ( void  )
static

Definition at line 136 of file motor_mixing.c.

References MotorMixing::commands, motor_mixing, MOTOR_MIXING_MAX_MOTOR, and MOTOR_MIXING_MIN_MOTOR.

Referenced by motor_mixing_run().

+ Here is the caller graph for this function:

static void bound_commands_step ( void  )
static

Definition at line 144 of file motor_mixing.c.

References MotorMixing::commands, and motor_mixing.

Referenced by motor_mixing_run().

+ Here is the caller graph for this function:

void motor_mixing_run_spinup ( uint32_t  counter,
uint32_t  max_counter 
)
static void offset_commands ( int32_t  offset)
static

Definition at line 128 of file motor_mixing.c.

References MotorMixing::commands, motor_mixing, and offset.

Referenced by motor_mixing_run().

+ Here is the caller graph for this function:

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

Definition at line 98 of file motor_mixing.c.

References MotorMixing::commands, and motor_mixing.

Referenced by motor_mixing_init().

+ Here is the caller graph for this function:

Variable Documentation

const int32_t pitch_coef[MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_PITCH_COEF
static

Definition at line 90 of file motor_mixing.c.

Referenced by motor_mixing_init(), and motor_mixing_run().

const int32_t roll_coef[MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_ROLL_COEF
static

Definition at line 89 of file motor_mixing.c.

Referenced by motor_mixing_init(), and motor_mixing_run().

const int32_t thrust_coef[MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_THRUST_COEF
static

Definition at line 92 of file motor_mixing.c.

Referenced by motor_mixing_run().

const int32_t yaw_coef[MOTOR_MIXING_NB_MOTOR] = MOTOR_MIXING_YAW_COEF
static

Definition at line 91 of file motor_mixing.c.

Referenced by motor_mixing_init(), and motor_mixing_run().