Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
stabilization_attitude_rc_setpoint.c File Reference

Read an attitude setpoint from the RC. More...

+ Include dependency graph for stabilization_attitude_rc_setpoint.c:

Go to the source code of this file.

Macros

#define STABILIZATION_ATTITUDE_DEADBAND_A   0
 
#define STABILIZATION_ATTITUDE_DEADBAND_E   0
 
#define COORDINATED_TURN_AIRSPEED   12.0
 Airspeed that will be used in the turning speed calculation (m/s). More...
 
#define YAW_DEADBAND_EXCEEDED(_rc)
 

Functions

static int32_t get_rc_roll (struct RadioControl *rc)
 
static int32_t get_rc_pitch (struct RadioControl *rc)
 
static int32_t get_rc_yaw (struct RadioControl *rc)
 
static float get_rc_roll_f (struct RadioControl *rc)
 
static float get_rc_pitch_f (struct RadioControl *rc)
 
static float get_rc_yaw_f (struct RadioControl *rc)
 
void stabilization_attitude_rc_setpoint_init (struct AttitudeRCInput *rc_sp)
 Init rc input. More...
 
void stabilization_attitude_read_rc_setpoint (struct AttitudeRCInput *rc_sp, bool in_flight, bool in_carefree, bool coordinated_turn, struct RadioControl *rc)
 Read attitude setpoint from RC as quaternion Interprets the stick positions as axes. More...
 
void stabilization_attitude_read_rc_setpoint_earth_bound (struct AttitudeRCInput *rc_sp, bool in_flight, bool in_carefree, bool coordinated_turn, struct RadioControl *rc)
 Read attitude setpoint from RC as quaternion in earth bound frame. More...
 
void stabilization_attitude_reset_rc_setpoint (struct AttitudeRCInput *rc_sp)
 reset to current state More...
 
void stabilization_attitude_reset_care_free_heading (struct AttitudeRCInput *rc_sp)
 reset the heading for care-free mode to current heading More...
 
int32_t stabilization_attitude_get_heading_i (void)
 Get attitude heading as int (avoiding jumps) More...
 
float stabilization_attitude_get_heading_f (void)
 Get attitude heading as float (avoiding jumps) More...
 
struct Int32Eulers stabilization_attitude_read_rc_setpoint_eulers (struct AttitudeRCInput *rc_sp, bool in_flight, bool in_carefree, bool coordinated_turn, struct RadioControl *rc)
 Read attitude setpoint from RC as euler angles Only the euler format is updated and returned. More...
 
struct FloatEulers stabilization_attitude_read_rc_setpoint_eulers_f (struct AttitudeRCInput *rc_sp, bool in_flight, bool in_carefree, bool coordinated_turn, struct RadioControl *rc)
 Read attitude setpoint from RC as float euler angles Only the euler format is updated and returned. More...
 
void stabilization_attitude_read_rc_roll_pitch_quat_f (struct FloatQuat *q, struct RadioControl *rc)
 Read roll/pitch command from RC as quaternion. More...
 
void stabilization_attitude_read_rc_roll_pitch_earth_quat_f (struct FloatQuat *q, float theta_offset, struct RadioControl *rc)
 Read roll/pitch command from RC as quaternion. More...
 

Detailed Description

Read an attitude setpoint from the RC.

Definition in file stabilization_attitude_rc_setpoint.c.

Macro Definition Documentation

◆ COORDINATED_TURN_AIRSPEED

#define COORDINATED_TURN_AIRSPEED   12.0

Airspeed that will be used in the turning speed calculation (m/s).

This variable is for calculation of the turn speed, and does not influence the airspeed. With a higher speed, the vehicle will turn less in a turn with the same roll.

Definition at line 50 of file stabilization_attitude_rc_setpoint.c.

◆ STABILIZATION_ATTITUDE_DEADBAND_A

#define STABILIZATION_ATTITUDE_DEADBAND_A   0

Definition at line 36 of file stabilization_attitude_rc_setpoint.c.

◆ STABILIZATION_ATTITUDE_DEADBAND_E

#define STABILIZATION_ATTITUDE_DEADBAND_E   0

Definition at line 40 of file stabilization_attitude_rc_setpoint.c.

◆ YAW_DEADBAND_EXCEEDED

#define YAW_DEADBAND_EXCEEDED (   _rc)
Value:
(rc->values[RADIO_YAW] > STABILIZATION_ATTITUDE_DEADBAND_R || \
rc->values[RADIO_YAW] < -STABILIZATION_ATTITUDE_DEADBAND_R)

Definition at line 53 of file stabilization_attitude_rc_setpoint.c.

Function Documentation

◆ get_rc_pitch()

static int32_t get_rc_pitch ( struct RadioControl rc)
static

◆ get_rc_pitch_f()

static float get_rc_pitch_f ( struct RadioControl rc)
static

◆ get_rc_roll()

static int32_t get_rc_roll ( struct RadioControl rc)
static

◆ get_rc_roll_f()

static float get_rc_roll_f ( struct RadioControl rc)
static

◆ get_rc_yaw()

static int32_t get_rc_yaw ( struct RadioControl rc)
static

◆ get_rc_yaw_f()

static float get_rc_yaw_f ( struct RadioControl rc)
inlinestatic

Definition at line 95 of file stabilization_attitude_rc_setpoint.c.

References MAX_PPRZ, RADIO_YAW, and RadioControl::values.

◆ stabilization_attitude_get_heading_f()

float stabilization_attitude_get_heading_f ( void  )

Get attitude heading as float (avoiding jumps)

Definition at line 231 of file stabilization_attitude_rc_setpoint.c.

References heading, FloatEulers::phi, FloatEulers::psi, stateGetNedToBodyEulers_f(), and FloatEulers::theta.

Referenced by stabilization_attitude_enter().

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

◆ stabilization_attitude_get_heading_i()

int32_t stabilization_attitude_get_heading_i ( void  )

Get attitude heading as int (avoiding jumps)

Definition at line 215 of file stabilization_attitude_rc_setpoint.c.

References ANGLE_FLOAT_OF_BFP, heading, INT32_ANGLE_PI_2, INT32_TRIG_FRAC, INT_MULT_RSHIFT, Int32Eulers::phi, PPRZ_ITRIG_SIN, Int32Eulers::psi, stateGetNedToBodyEulers_i(), and Int32Eulers::theta.

Referenced by guidance_flip_enter(), and stabilization_indi_enter().

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

◆ stabilization_attitude_rc_setpoint_init()

void stabilization_attitude_rc_setpoint_init ( struct AttitudeRCInput rc_sp)

Init rc input.

Parameters
[out]rc_sppointer to rc input structure

Definition at line 102 of file stabilization_attitude_rc_setpoint.c.

References AttitudeRCInput::care_free_heading, FLOAT_EULERS_ZERO, float_quat_identity(), AttitudeRCInput::last_ts, AttitudeRCInput::rc_eulers, AttitudeRCInput::rc_quat, and AttitudeRCInput::transition_theta_offset.

Referenced by ctrl_module_init(), and stabilization_init().

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

◆ stabilization_attitude_read_rc_roll_pitch_earth_quat_f()

void stabilization_attitude_read_rc_roll_pitch_earth_quat_f ( struct FloatQuat q,
float  theta_offset,
struct RadioControl rc 
)

Read roll/pitch command from RC as quaternion.

Read RC roll and pitch only, in earth bounded frame.

Both angles are are interpreted relative to to the horizontal plane (earth bound).

Parameters
[out]qquaternion representing the RC roll/pitch input
[in]theta_offsetpitch offset for forward flight
[in]rcpointer to radio control structure

Definition at line 441 of file stabilization_attitude_rc_setpoint.c.

References get_rc_pitch_f(), get_rc_roll_f(), FloatQuat::qi, FloatQuat::qx, FloatQuat::qy, and FloatQuat::qz.

Referenced by stabilization_attitude_read_rc_setpoint_earth_bound().

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

◆ stabilization_attitude_read_rc_roll_pitch_quat_f()

void stabilization_attitude_read_rc_roll_pitch_quat_f ( struct FloatQuat q,
struct RadioControl rc 
)

Read roll/pitch command from RC as quaternion.

Read RC roll and pitch only.

Interprets the stick positions as axes.

Parameters
[out]qquaternion representing the RC roll/pitch input
[in]rcpointer to radio control structure

Definition at line 423 of file stabilization_attitude_rc_setpoint.c.

References float_quat_of_orientation_vect(), get_rc_pitch_f(), get_rc_roll_f(), FloatVect3::x, FloatVect3::y, and FloatVect3::z.

Referenced by stabilization_attitude_read_rc_setpoint().

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

◆ stabilization_attitude_read_rc_setpoint()

void stabilization_attitude_read_rc_setpoint ( struct AttitudeRCInput rc_sp,
bool  in_flight,
bool  in_carefree,
bool  coordinated_turn,
struct RadioControl rc 
)

Read attitude setpoint from RC as quaternion Interprets the stick positions as axes.

Parameters
[out]rc_sppointer to rc input structure
[in]in_flighttrue if in flight
[in]in_carefreetrue if in carefree mode
[in]coordinated_turntrue if in horizontal mode forward
[in]rcpointer to radio control structure

Definition at line 119 of file stabilization_attitude_rc_setpoint.c.

References AttitudeRCInput::care_free_heading, float_quat_comp(), float_quat_comp_inv(), float_quat_comp_norm_shortest(), float_quat_normalize(), float_quat_of_axis_angle(), FloatEulers::psi, QUAT_COPY, AttitudeRCInput::rc_eulers, AttitudeRCInput::rc_quat, stabilization_attitude_read_rc_roll_pitch_quat_f(), stabilization_attitude_read_rc_setpoint_eulers_f(), and stateGetNedToBodyEulers_f().

+ Here is the call graph for this function:

◆ stabilization_attitude_read_rc_setpoint_earth_bound()

void stabilization_attitude_read_rc_setpoint_earth_bound ( struct AttitudeRCInput rc_sp,
bool  in_flight,
bool  in_carefree,
bool  coordinated_turn,
struct RadioControl rc 
)

Read attitude setpoint from RC as quaternion in earth bound frame.

Read attitude setpoint from RC as quaternion in earth bound frame Interprets the stick positions as axes.

Parameters
[out]rc_sppointer to rc input structure
[in]in_flighttrue if in flight
[in]in_carefreetrue if in carefree mode
[in]coordinated_turntrue if in horizontal mode forward
[in]rcpointer to radio control structure

Definition at line 169 of file stabilization_attitude_rc_setpoint.c.

References float_quat_comp(), float_quat_normalize(), float_quat_of_axis_angle(), FloatEulers::psi, QUAT_COPY, AttitudeRCInput::rc_eulers, AttitudeRCInput::rc_quat, stabilization_attitude_read_rc_roll_pitch_earth_quat_f(), stabilization_attitude_read_rc_setpoint_eulers_f(), stateGetNedToBodyEulers_f(), and AttitudeRCInput::transition_theta_offset.

+ Here is the call graph for this function:

◆ stabilization_attitude_read_rc_setpoint_eulers()

struct Int32Eulers stabilization_attitude_read_rc_setpoint_eulers ( struct AttitudeRCInput rc_sp,
bool  in_flight,
bool  in_carefree,
bool  coordinated_turn,
struct RadioControl rc 
)

Read attitude setpoint from RC as euler angles Only the euler format is updated and returned.

Parameters
[out]rc_sppointer to rc input structure
[in]in_flighttrue if in flight
[in]in_carefreetrue if in carefree mode
[in]coordinated_turntrue if in horizontal mode forward
[in]rcpointer to radio control structure
Returns
attitude setpoint in eulers (int)

Definition at line 231 of file stabilization_attitude_rc_setpoint.c.

Referenced by guidance_module_enter().

+ Here is the caller graph for this function:

◆ stabilization_attitude_read_rc_setpoint_eulers_f()

struct FloatEulers stabilization_attitude_read_rc_setpoint_eulers_f ( struct AttitudeRCInput rc_sp,
bool  in_flight,
bool  in_carefree,
bool  coordinated_turn,
struct RadioControl rc 
)

Read attitude setpoint from RC as float euler angles Only the euler format is updated and returned.

Parameters
[out]rc_sppointer to rc input structure
[in]in_flighttrue if in flight
[in]in_carefreetrue if in carefree mode
[in]coordinated_turntrue if in horizontal mode forward
[in]rcpointer to radio control structure
Returns
attitude setpoint in eulers (float)

Definition at line 231 of file stabilization_attitude_rc_setpoint.c.

Referenced by stabilization_attitude_read_rc_setpoint(), and stabilization_attitude_read_rc_setpoint_earth_bound().

+ Here is the caller graph for this function:

◆ stabilization_attitude_reset_care_free_heading()

void stabilization_attitude_reset_care_free_heading ( struct AttitudeRCInput rc_sp)

reset the heading for care-free mode to current heading

Reset care free heading to current heading.

Definition at line 207 of file stabilization_attitude_rc_setpoint.c.

References AttitudeRCInput::care_free_heading, FloatEulers::psi, and stateGetNedToBodyEulers_f().

Referenced by stabilization_attitude_read_rc().

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

◆ stabilization_attitude_reset_rc_setpoint()

void stabilization_attitude_reset_rc_setpoint ( struct AttitudeRCInput rc_sp)

reset to current state

Reset rc input to current state.

Definition at line 200 of file stabilization_attitude_rc_setpoint.c.

References AttitudeRCInput::rc_eulers, AttitudeRCInput::rc_quat, stateGetNedToBodyEulers_f(), and stateGetNedToBodyQuat_f().

Referenced by stabilization_attitude_reset_rc().

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