Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Read an attitude setpoint from the RC. More...
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_rc_setpoint.h"
#include "generated/airframe.h"
#include "modules/radio_control/radio_control.h"
#include "state.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude.h"
#include "firmwares/rotorcraft/autopilot_rc_helpers.h"
#include "mcu_periph/sys_time.h"
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... | |
Read an attitude setpoint from the RC.
Definition in file stabilization_attitude_rc_setpoint.c.
#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.
#define STABILIZATION_ATTITUDE_DEADBAND_A 0 |
Definition at line 36 of file stabilization_attitude_rc_setpoint.c.
#define STABILIZATION_ATTITUDE_DEADBAND_E 0 |
Definition at line 40 of file stabilization_attitude_rc_setpoint.c.
#define YAW_DEADBAND_EXCEEDED | ( | _rc | ) |
Definition at line 53 of file stabilization_attitude_rc_setpoint.c.
|
static |
Definition at line 65 of file stabilization_attitude_rc_setpoint.c.
References ANGLE_BFP_OF_REAL, MAX_PPRZ, RADIO_PITCH, STABILIZATION_ATTITUDE_DEADBAND_E, and RadioControl::values.
|
static |
Definition at line 88 of file stabilization_attitude_rc_setpoint.c.
References MAX_PPRZ, RADIO_PITCH, STABILIZATION_ATTITUDE_DEADBAND_E, and RadioControl::values.
Referenced by stabilization_attitude_read_rc_roll_pitch_earth_quat_f(), and stabilization_attitude_read_rc_roll_pitch_quat_f().
|
static |
Definition at line 57 of file stabilization_attitude_rc_setpoint.c.
References ANGLE_BFP_OF_REAL, MAX_PPRZ, RADIO_ROLL, STABILIZATION_ATTITUDE_DEADBAND_A, and RadioControl::values.
|
static |
Definition at line 81 of file stabilization_attitude_rc_setpoint.c.
References MAX_PPRZ, RADIO_ROLL, STABILIZATION_ATTITUDE_DEADBAND_A, and RadioControl::values.
Referenced by stabilization_attitude_read_rc_roll_pitch_earth_quat_f(), and stabilization_attitude_read_rc_roll_pitch_quat_f().
|
static |
Definition at line 73 of file stabilization_attitude_rc_setpoint.c.
References ANGLE_BFP_OF_REAL, MAX_PPRZ, RADIO_YAW, and RadioControl::values.
|
inlinestatic |
Definition at line 95 of file stabilization_attitude_rc_setpoint.c.
References MAX_PPRZ, RADIO_YAW, and RadioControl::values.
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().
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().
void stabilization_attitude_rc_setpoint_init | ( | struct AttitudeRCInput * | rc_sp | ) |
Init rc input.
[out] | rc_sp | pointer 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().
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).
[out] | q | quaternion representing the RC roll/pitch input |
[in] | theta_offset | pitch offset for forward flight |
[in] | rc | pointer 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().
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.
[out] | q | quaternion representing the RC roll/pitch input |
[in] | rc | pointer 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().
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.
[out] | rc_sp | pointer to rc input structure |
[in] | in_flight | true if in flight |
[in] | in_carefree | true if in carefree mode |
[in] | coordinated_turn | true if in horizontal mode forward |
[in] | rc | pointer 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().
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.
[out] | rc_sp | pointer to rc input structure |
[in] | in_flight | true if in flight |
[in] | in_carefree | true if in carefree mode |
[in] | coordinated_turn | true if in horizontal mode forward |
[in] | rc | pointer 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.
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.
[out] | rc_sp | pointer to rc input structure |
[in] | in_flight | true if in flight |
[in] | in_carefree | true if in carefree mode |
[in] | coordinated_turn | true if in horizontal mode forward |
[in] | rc | pointer to radio control structure |
Definition at line 231 of file stabilization_attitude_rc_setpoint.c.
Referenced by guidance_module_enter().
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.
[out] | rc_sp | pointer to rc input structure |
[in] | in_flight | true if in flight |
[in] | in_carefree | true if in carefree mode |
[in] | coordinated_turn | true if in horizontal mode forward |
[in] | rc | pointer to radio control structure |
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().
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().
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().