Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
eff_scheduling_rotwing_rpm_ctrl.c File Reference
Include dependency graph for eff_scheduling_rotwing_rpm_ctrl.c:

Go to the source code of this file.

Macros

#define ROTWING_PITCH_MOTOR_TILT_ANGLE_DEG   10.0
#define WING_ROTATION_CAN_ROTWING_ID   ABI_BROADCAST
 ABI binding wing position data.
#define AIRSPEED_IMPORTANCE_IN_FORWARD_WEIGHT   16

Functions

float bound_or_zero (float value, float low_lim, float up_lim)
void eff_scheduling_rotwing_update_wing_angle (void)
void eff_scheduling_rotwing_update_MMOI (void)
void eff_scheduling_rotwing_update_cmd (void)
void eff_scheduling_rotwing_update_airspeed (void)
void eff_scheduling_rotwing_update_hover_motor_effectiveness (void)
void eff_scheduling_rotwing_update_elevator_effectiveness (void)
void eff_scheduling_rotwing_update_rudder_effectiveness (void)
void eff_scheduling_rotwing_update_aileron_effectiveness (void)
void eff_scheduling_rotwing_update_flaperon_effectiveness (void)
void eff_scheduling_rotwing_update_pusher_effectiveness (void)
void eff_scheduling_rotwing_schedule_liftd (void)
float guidance_indi_get_liftd (float pitch UNUSED, float theta UNUSED)
void stabilization_indi_set_wls_settings (void)
 Function that sets the u_min, u_max and u_pref if function not elsewhere defined.
void guidance_indi_hybrid_set_wls_settings (float body_v[3], float roll_angle, float pitch_angle)
static void wing_position_cb (uint8_t sender_id UNUSED, struct act_feedback_t *pos_msg, uint8_t num_act)
void eff_scheduling_rotwing_init (void)
void eff_scheduling_rotwing_periodic (void)
static float u_squared_to_pprz_cmd (float u_squared, float max, float neutral, float travel_up)
 Convert u^2 to PPRZ command.
static float pprz_cmd_to_u_squared (float pprz_cmd, float max, float neutral, float travel_up)
 Convert PPRZ command back to u^2.
void stabilization_indi_get_actuator_state (void)
 Function that tries to get actuator feedback.
void stabilization_indi_commit_actuator_cmd (int32_t *cmd)

Variables

struct rotwing_eff_sched_param_t eff_sched_p
int32_t rw_flap_offset = 0
float eff_scheduling_rotwing_lift_d = 0.0f
float eff_sched_pusher_time = 0.002
float roll_eff_slider = 12.f
static const float Wu_gih_original [GUIDANCE_INDI_HYBRID_U] = GUIDANCE_INDI_WLS_WU
struct rotwing_eff_sched_var_t eff_sched_var
static abi_event wing_position_ev

Macro Definition Documentation

◆ AIRSPEED_IMPORTANCE_IN_FORWARD_WEIGHT

#define AIRSPEED_IMPORTANCE_IN_FORWARD_WEIGHT   16

◆ ROTWING_PITCH_MOTOR_TILT_ANGLE_DEG

#define ROTWING_PITCH_MOTOR_TILT_ANGLE_DEG   10.0

◆ WING_ROTATION_CAN_ROTWING_ID

#define WING_ROTATION_CAN_ROTWING_ID   ABI_BROADCAST

ABI binding wing position data.

Definition at line 217 of file eff_scheduling_rotwing_rpm_ctrl.c.

Function Documentation

◆ bound_or_zero()

float bound_or_zero ( float value,
float low_lim,
float up_lim )
inline

◆ eff_scheduling_rotwing_init()

void eff_scheduling_rotwing_init ( void )

Definition at line 236 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, eff_sched_var, wing_position_cb(), wing_position_ev, and WING_ROTATION_CAN_ROTWING_ID.

Here is the call graph for this function:

◆ eff_scheduling_rotwing_periodic()

◆ eff_scheduling_rotwing_schedule_liftd()

void eff_scheduling_rotwing_schedule_liftd ( void )
inline

Definition at line 440 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, eff_sched_var, and eff_scheduling_rotwing_lift_d.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_aileron_effectiveness()

void eff_scheduling_rotwing_update_aileron_effectiveness ( void )
inline

Definition at line 406 of file eff_scheduling_rotwing_rpm_ctrl.c.

References bound_or_zero(), eff_sched_p, eff_sched_var, g1g2, RW_ap, and RW_aq.

Referenced by eff_scheduling_rotwing_periodic().

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

◆ eff_scheduling_rotwing_update_airspeed()

void eff_scheduling_rotwing_update_airspeed ( void )
inline

Definition at line 314 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_var, and stateGetAirspeed_f().

Referenced by eff_scheduling_rotwing_periodic().

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

◆ eff_scheduling_rotwing_update_cmd()

void eff_scheduling_rotwing_update_cmd ( void )
inline

Definition at line 305 of file eff_scheduling_rotwing_rpm_ctrl.c.

References actuator_state_filt_vect, and eff_sched_var.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_elevator_effectiveness()

void eff_scheduling_rotwing_update_elevator_effectiveness ( void )
inline

Definition at line 366 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, eff_sched_var, g1g2, and RW_aq.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_flaperon_effectiveness()

void eff_scheduling_rotwing_update_flaperon_effectiveness ( void )
inline

Definition at line 419 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, eff_sched_var, g1g2, and RW_ap.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_hover_motor_effectiveness()

void eff_scheduling_rotwing_update_hover_motor_effectiveness ( void )
inline

Definition at line 322 of file eff_scheduling_rotwing_rpm_ctrl.c.

References bound_or_zero(), eff_sched_p, eff_sched_var, g1g2, MAX_PPRZ, ROTWING_PITCH_MOTOR_TILT_ANGLE_DEG, RW_ap, and RW_aq.

Referenced by eff_scheduling_rotwing_periodic().

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

◆ eff_scheduling_rotwing_update_MMOI()

void eff_scheduling_rotwing_update_MMOI ( void )
inline

Definition at line 295 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, and eff_sched_var.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_pusher_effectiveness()

void eff_scheduling_rotwing_update_pusher_effectiveness ( void )
inline

Definition at line 427 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, g1g2, MAX_PPRZ, and RW_aX.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_rudder_effectiveness()

void eff_scheduling_rotwing_update_rudder_effectiveness ( void )
inline

Definition at line 388 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_p, eff_sched_var, g1g2, and RW_ar.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ eff_scheduling_rotwing_update_wing_angle()

void eff_scheduling_rotwing_update_wing_angle ( void )
inline

Definition at line 280 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_var.

Referenced by eff_scheduling_rotwing_periodic().

Here is the caller graph for this function:

◆ guidance_indi_get_liftd()

float guidance_indi_get_liftd ( float pitch UNUSED,
float theta UNUSED )
inline

Definition at line 455 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_scheduling_rotwing_lift_d, and UNUSED.

◆ guidance_indi_hybrid_set_wls_settings()

◆ pprz_cmd_to_u_squared()

float pprz_cmd_to_u_squared ( float pprz_cmd,
float max,
float neutral,
float travel_up )
static

Convert PPRZ command back to u^2.

Parameters
pprz_cmdPPRZ command
maxMotor max value (e.g., SERVO_MOTOR_FRONT_MAX)
neutralMotor neutral value
travel_upMotor travel up value
Returns
u^2

Definition at line 631 of file eff_scheduling_rotwing_rpm_ctrl.c.

References MAX_PPRZ.

Referenced by stabilization_indi_get_actuator_state().

Here is the caller graph for this function:

◆ stabilization_indi_commit_actuator_cmd()

◆ stabilization_indi_get_actuator_state()

void stabilization_indi_get_actuator_state ( void )

Function that tries to get actuator feedback.

If this is not available it will use a first order filter to approximate the actuator state. It is also possible to model rate limits (unit: PPRZ/loop cycle)

Definition at line 637 of file eff_scheduling_rotwing_rpm_ctrl.c.

References act_dyn_discrete, actuator_state, indi_u, pprz_cmd_to_u_squared(), stabilization_indi_get_act_dyn(), stabilization_indi_get_act_state(), stabilization_indi_get_indi_u(), and u_squared_to_pprz_cmd().

Here is the call graph for this function:

◆ stabilization_indi_set_wls_settings()

void stabilization_indi_set_wls_settings ( void )

Function that sets the u_min, u_max and u_pref if function not elsewhere defined.

Definition at line 459 of file eff_scheduling_rotwing_rpm_ctrl.c.

References act_is_servo, act_pref, actuator_state_filt_vect, actuators_pprz, eff_sched_p, eff_sched_pusher_time, electrical, MAX_PPRZ, Min, rw_flap_offset, and wls_stab_p.

◆ u_squared_to_pprz_cmd()

float u_squared_to_pprz_cmd ( float u_squared,
float max,
float neutral,
float travel_up )
static

Convert u^2 to PPRZ command.

Parameters
u_squaredValue in squared domain
maxMotor max value (e.g., SERVO_MOTOR_FRONT_MAX)
neutralMotor neutral value
travel_upMotor travel up value
Returns
PPRZ cmd

Definition at line 616 of file eff_scheduling_rotwing_rpm_ctrl.c.

References MAX_PPRZ.

Referenced by stabilization_indi_commit_actuator_cmd(), and stabilization_indi_get_actuator_state().

Here is the caller graph for this function:

◆ wing_position_cb()

void wing_position_cb ( uint8_t sender_id UNUSED,
struct act_feedback_t * pos_msg,
uint8_t num_act )
static

Definition at line 222 of file eff_scheduling_rotwing_rpm_ctrl.c.

References eff_sched_var, UNUSED, and wing_position_cb().

Here is the call graph for this function:

Variable Documentation

◆ eff_sched_p

struct rotwing_eff_sched_param_t eff_sched_p
Initial value:
= {
.Ixx_body = ROTWING_EFF_SCHED_IXX_BODY,
.Iyy_body = ROTWING_EFF_SCHED_IYY_BODY,
.Izz = ROTWING_EFF_SCHED_IZZ,
.Ixx_wing = ROTWING_EFF_SCHED_IXX_WING,
.Iyy_wing = ROTWING_EFF_SCHED_IYY_WING,
.m = ROTWING_EFF_SCHED_M,
.CT_hover = ROTWING_EFF_SCHED_CT_HOVER,
.CT_pusher = ROTWING_EFF_SCHED_CT_PUSHER,
.hover_max_rpm_squared = ROTWING_EFF_SCHED_HOVER_MAX_RPM * ROTWING_EFF_SCHED_HOVER_MAX_RPM,
.pusher_max_rpm_squared = ROTWING_EFF_SCHED_PUSHER_MAX_RPM * ROTWING_EFF_SCHED_PUSHER_MAX_RPM,
.k_elevator = ROTWING_EFF_SCHED_K_ELEVATOR,
.k_rudder = ROTWING_EFF_SCHED_K_RUDDER,
.k_aileron = ROTWING_EFF_SCHED_K_AILERON,
.k_flaperon = ROTWING_EFF_SCHED_K_FLAPERON,
.k_elevator_deflection = ROTWING_EFF_SCHED_K_ELEVATOR_DEFLECTION,
.d_rudder_d_pprz = ROTWING_EFF_SCHED_D_RUDDER_D_PPRZ,
.k_lift_wing = ROTWING_EFF_SCHED_K_LIFT_WING,
.k_lift_fuselage = ROTWING_EFF_SCHED_K_LIFT_FUSELAGE,
.k_lift_tail = ROTWING_EFF_SCHED_K_LIFT_TAIL,
.hover_rpm_lim_coef = ROTWING_EFF_SCHED_RPM_CTRL_HOVER_LIM_COEF,
.pusher_rpm_lim_coef = ROTWING_EFF_SCHED_RPM_CTRL_PUSH_LIM_COEF
}

Definition at line 144 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ eff_sched_pusher_time

float eff_sched_pusher_time = 0.002

Definition at line 190 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ eff_sched_var

struct rotwing_eff_sched_var_t eff_sched_var

Definition at line 195 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ eff_scheduling_rotwing_lift_d

float eff_scheduling_rotwing_lift_d = 0.0f

Definition at line 169 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ roll_eff_slider

float roll_eff_slider = 12.f

Definition at line 191 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ rw_flap_offset

int32_t rw_flap_offset = 0

Definition at line 168 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ wing_position_ev

abi_event wing_position_ev
static

Definition at line 220 of file eff_scheduling_rotwing_rpm_ctrl.c.

◆ Wu_gih_original

const float Wu_gih_original[GUIDANCE_INDI_HYBRID_U] = GUIDANCE_INDI_WLS_WU
static

Definition at line 193 of file eff_scheduling_rotwing_rpm_ctrl.c.