Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ INT32_MAX

#define INT32_MAX   (2147483647)

Definition at line 37 of file motor_mixing.c.

◆ INT32_MIN

#define INT32_MIN   (-2147483647-1)

Definition at line 33 of file motor_mixing.c.

◆ MOTOR_MIXING_MAX_MOTOR

#define MOTOR_MIXING_MAX_MOTOR   MAX_PPRZ

Definition at line 44 of file motor_mixing.c.

◆ MOTOR_MIXING_MAX_SATURATION_OFFSET

#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.

◆ MOTOR_MIXING_MIN_MOTOR

#define MOTOR_MIXING_MIN_MOTOR   0

Definition at line 43 of file motor_mixing.c.

◆ MOTOR_MIXING_MIN_MOTOR_STARTUP

#define MOTOR_MIXING_MIN_MOTOR_STARTUP   MOTOR_MIXING_MIN_MOTOR

Definition at line 73 of file motor_mixing.c.

◆ MOTOR_MIXING_STOP_MOTOR

#define MOTOR_MIXING_STOP_MOTOR   -MAX_PPRZ

Definition at line 47 of file motor_mixing.c.

◆ MOTOR_MIXING_TRIM_PITCH

#define MOTOR_MIXING_TRIM_PITCH   0

Definition at line 55 of file motor_mixing.c.

◆ MOTOR_MIXING_TRIM_ROLL

#define MOTOR_MIXING_TRIM_ROLL   0

Definition at line 51 of file motor_mixing.c.

◆ MOTOR_MIXING_TRIM_YAW

#define MOTOR_MIXING_TRIM_YAW   0

Definition at line 59 of file motor_mixing.c.

Function Documentation

◆ bound_commands()

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:

◆ bound_commands_step()

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:

◆ motor_mixing_init()

◆ motor_mixing_run()

◆ motor_mixing_run_spinup()

void motor_mixing_run_spinup ( uint32_t  counter,
uint32_t  max_counter 
)

◆ offset_commands()

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:

◆ send_motor_mixing()

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, dev, and motor_mixing.

Referenced by motor_mixing_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ motor_mixing

◆ pitch_coef

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().

◆ roll_coef

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().

◆ thrust_coef

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().

◆ yaw_coef

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 init_gazebo(), motor_mixing_init(), and motor_mixing_run().