![]() |
Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/rot_wing_drone/rotwing_state_V2.h"
#include "firmwares/rotorcraft/autopilot_firmware.h"
#include "modules/core/commands.h"
#include "modules/actuators/actuators.h"
#include "modules/core/abi.h"
#include "modules/datalink/telemetry.h"
Go to the source code of this file.
Macros | |
#define | ROTWING_MIN_SKEW_ANGLE_DEG_QUAD 10.0 |
#define | ROTWING_MIN_SKEW_ANGLE_COUNTER 10 |
#define | ROTWING_SKEWING_COUNTER 10 |
#define | ROTWING_MAX_QUAD_AIRSPEED 20.0 |
#define | ROTWING_HALF_SKEW_ANGLE_DEG 55.0 |
#define | ROTWING_HALF_SKEW_ANGLE_HALF_RANGE 10.0 |
#define | ROTWING_HALF_SKEW_COUNTER 10 |
#define | ROTWING_MIN_FW_SKEW_ANGLE_DEG 80.0 |
#define | ROTWING_MIN_FW_COUNTER 10 |
#define | ROTWING_MIN_THRUST_IDLE 100 |
#define | ROTWING_MIN_THRUST_IDLE_COUNTER 10 |
#define | ROTWING_HOV_MOT_RUN_RPM_TH 800 |
#define | ROTWING_HOV_MOT_OFF_RPM_TH 50 |
#define | ROTWING_HOV_MOT_OFF_COUNTER 10 |
#define | ROTWING_STATE_USE_ROTATION_REF_MODEL FALSE |
#define | ROTWING_STATE_HOVER_PREF_PITCH 0.0 |
#define | ROTWING_STATE_TRANSITION_PREF_PITCH 3.0 |
#define | ROTWING_STATE_FW_PREF_PITCH 8.0 |
#define | USE_ROTMECH_VIRTUAL FALSE |
#define | ADC_WING_ROTATION FALSE |
#define | ROTWING_STATE_ACT_FEEDBACK_ID ABI_BROADCAST |
ABI binding feedback data. More... | |
#define | ROTWING_STATE_NUM_HOVER_RPM 4 |
Variables | |
abi_event | rotwing_state_feedback_ev |
int32_t | rotwing_state_hover_rpm [ROTWING_STATE_NUM_HOVER_RPM] = {0, 0, 0, 0} |
struct RotwingState | rotwing_state |
struct RotWingStateSettings | rotwing_state_settings |
struct RotWingStateSkewing | rotwing_state_skewing |
uint8_t | rotwing_state_hover_counter = 0 |
uint8_t | rotwing_state_skewing_counter = 0 |
uint8_t | rotwing_state_fw_counter = 0 |
uint8_t | rotwing_state_fw_idle_counter = 0 |
uint8_t | rotwing_state_fw_m_off_counter = 0 |
float | rotwing_state_max_hover_speed = 7 |
float | rotwing_state_max_fw_speed = 20 |
bool | hover_motors_active = true |
bool | bool_disable_hover_motors = false |
#define ADC_WING_ROTATION FALSE |
Definition at line 126 of file rotwing_state_V2.c.
#define ROTWING_HALF_SKEW_ANGLE_DEG 55.0 |
Definition at line 53 of file rotwing_state_V2.c.
#define ROTWING_HALF_SKEW_ANGLE_HALF_RANGE 10.0 |
Definition at line 57 of file rotwing_state_V2.c.
#define ROTWING_HALF_SKEW_COUNTER 10 |
Definition at line 61 of file rotwing_state_V2.c.
#define ROTWING_HOV_MOT_OFF_COUNTER 10 |
Definition at line 91 of file rotwing_state_V2.c.
#define ROTWING_HOV_MOT_OFF_RPM_TH 50 |
Definition at line 87 of file rotwing_state_V2.c.
#define ROTWING_HOV_MOT_RUN_RPM_TH 800 |
Definition at line 84 of file rotwing_state_V2.c.
#define ROTWING_MAX_QUAD_AIRSPEED 20.0 |
Definition at line 48 of file rotwing_state_V2.c.
#define ROTWING_MIN_FW_COUNTER 10 |
Definition at line 70 of file rotwing_state_V2.c.
#define ROTWING_MIN_FW_SKEW_ANGLE_DEG 80.0 |
Definition at line 66 of file rotwing_state_V2.c.
#define ROTWING_MIN_SKEW_ANGLE_COUNTER 10 |
Definition at line 38 of file rotwing_state_V2.c.
#define ROTWING_MIN_SKEW_ANGLE_DEG_QUAD 10.0 |
Definition at line 34 of file rotwing_state_V2.c.
#define ROTWING_MIN_THRUST_IDLE 100 |
Definition at line 75 of file rotwing_state_V2.c.
#define ROTWING_MIN_THRUST_IDLE_COUNTER 10 |
Definition at line 79 of file rotwing_state_V2.c.
#define ROTWING_SKEWING_COUNTER 10 |
Definition at line 43 of file rotwing_state_V2.c.
#define ROTWING_STATE_ACT_FEEDBACK_ID ABI_BROADCAST |
ABI binding feedback data.
Definition at line 134 of file rotwing_state_V2.c.
#define ROTWING_STATE_FW_PREF_PITCH 8.0 |
Definition at line 110 of file rotwing_state_V2.c.
#define ROTWING_STATE_HOVER_PREF_PITCH 0.0 |
Definition at line 100 of file rotwing_state_V2.c.
#define ROTWING_STATE_NUM_HOVER_RPM 4 |
Definition at line 138 of file rotwing_state_V2.c.
#define ROTWING_STATE_TRANSITION_PREF_PITCH 3.0 |
Definition at line 105 of file rotwing_state_V2.c.
#define ROTWING_STATE_USE_ROTATION_REF_MODEL FALSE |
Definition at line 95 of file rotwing_state_V2.c.
#define USE_ROTMECH_VIRTUAL FALSE |
Definition at line 115 of file rotwing_state_V2.c.
void init_rotwing_state | ( | void | ) |
Definition at line 195 of file rotwing_state_V2.c.
References RotWingStateSkewing::airspeed_scheduling, RotwingState::current_state, DefaultPeriodic, RotwingState::desired_state, RotWingStateSkewing::force_rotation_angle, MAX_PPRZ, RotWingStateSettings::preferred_pitch_value, register_periodic_telemetry(), RotwingState::requested_config, ROTWING_CONFIGURATION_HOVER, rotwing_state, ROTWING_STATE_ACT_FEEDBACK_ID, rotwing_state_feedback_cb(), rotwing_state_feedback_ev, ROTWING_STATE_HOVER, rotwing_state_settings, rotwing_state_skewing, send_rotating_wing_state(), RotWingStateSkewing::servo_pprz_cmd, RotWingStateSkewing::wing_angle_deg, and RotWingStateSkewing::wing_angle_deg_sp.
void periodic_rotwing_state | ( | void | ) |
Definition at line 218 of file rotwing_state_V2.c.
References Stabilization::att_submode, bool_disable_hover_motors, eulers_zxy, float_eulers_of_quat_zxy(), guidance_h, GUIDANCE_H_MODE_NAV, GUIDANCE_H_MODE_NONE, hover_motors_active, HorizontalGuidance::mode, Stabilization::mode, RotWingStateSettings::preferred_pitch_setting, RotWingStateSettings::preferred_pitch_value, RotwingState::requested_config, rotwing_check_set_current_state(), ROTWING_CONFIGURATION_FREE, ROTWING_HALF_SKEW_ANGLE_DEG, rotwing_state, rotwing_state_free_processor(), ROTWING_STATE_FW_PREF_PITCH, ROTWING_STATE_HOVER_PREF_PITCH, ROTWING_STATE_PITCH_FW_SETTING, ROTWING_STATE_PITCH_QUAD_SETTING, ROTWING_STATE_PITCH_TRANSITION_SETTING, rotwing_state_set_fw_settings(), rotwing_state_set_hover_settings(), rotwing_state_settings, rotwing_state_skewer(), rotwing_state_skewing, ROTWING_STATE_TRANSITION_PREF_PITCH, rotwing_switch_state(), stabilization, STABILIZATION_ATT_SUBMODE_FORWARD, STABILIZATION_MODE_ATTITUDE, stateGetAirspeed_f(), stateGetNedToBodyQuat_f(), FloatEulers::theta, and RotWingStateSkewing::wing_angle_deg.
void request_rotwing_state | ( | uint8_t | state | ) |
Definition at line 282 of file rotwing_state_V2.c.
References RotwingState::desired_state, rotwing_state, ROTWING_STATE_FW_HOV_MOT_OFF, and state.
Referenced by rotwing_request_configuration(), and rotwing_state_free_processor().
|
inline |
Definition at line 311 of file rotwing_state_V2.c.
References autopilot, commands, RotwingState::current_state, RotwingState::desired_state, pprz_autopilot::in_flight, ROTWING_HOV_MOT_OFF_COUNTER, ROTWING_HOV_MOT_OFF_RPM_TH, ROTWING_MIN_FW_COUNTER, ROTWING_MIN_FW_SKEW_ANGLE_DEG, ROTWING_MIN_SKEW_ANGLE_COUNTER, ROTWING_MIN_SKEW_ANGLE_DEG_QUAD, ROTWING_MIN_THRUST_IDLE, ROTWING_MIN_THRUST_IDLE_COUNTER, rotwing_state, ROTWING_STATE_FW, rotwing_state_fw_counter, ROTWING_STATE_FW_HOV_MOT_IDLE, ROTWING_STATE_FW_HOV_MOT_OFF, rotwing_state_fw_idle_counter, rotwing_state_fw_m_off_counter, ROTWING_STATE_HOVER, rotwing_state_hover_counter, rotwing_state_hover_rpm, ROTWING_STATE_SKEWING, rotwing_state_skewing, rotwing_state_skewing_counter, and RotWingStateSkewing::wing_angle_deg.
Referenced by periodic_rotwing_state().
void rotwing_request_configuration | ( | uint8_t | configuration | ) |
Definition at line 290 of file rotwing_state_V2.c.
References request_rotwing_state(), RotwingState::requested_config, ROTWING_CONFIGURATION_EFFICIENT, ROTWING_CONFIGURATION_FREE, ROTWING_CONFIGURATION_HOVER, ROTWING_CONFIGURATION_HYBRID, rotwing_state, ROTWING_STATE_FW_HOV_MOT_OFF, ROTWING_STATE_HOVER, and ROTWING_STATE_SKEWING.
|
static |
|
static |
Definition at line 741 of file rotwing_state_V2.c.
References idx, rotwing_state_hover_rpm, rotwing_state_skewing, and RotWingStateSkewing::wing_angle_deg.
void rotwing_state_force_skew_off | ( | void | ) |
Definition at line 190 of file rotwing_state_V2.c.
References RotWingStateSkewing::force_rotation_angle, and rotwing_state_skewing.
|
inline |
Definition at line 635 of file rotwing_state_V2.c.
References desired_airspeed, NavGoto_t::dist2_to_wp, eulers_zxy, float_eulers_of_quat_zxy(), FLOAT_VECT2_NORM, float_vect2_normalize(), NavBase_t::goto_wp, nav_hybrid_pos_gain, nav_max_deceleration_sp, nav_rotorcraft_base, FloatEulers::psi, request_rotwing_state(), ROTWING_STATE_FW_HOV_MOT_OFF, rotwing_state_max_fw_speed, ROTWING_STATE_SKEWING, stateGetAirspeed_f(), stateGetNedToBodyQuat_f(), stateGetPositionEnu_f(), stateGetSpeedEnu_f(), NavGoto_t::to, VECT2_ADD, VECT2_COPY, VECT2_DIFF, FloatVect2::x, and FloatVect2::y.
Referenced by periodic_rotwing_state().
|
inline |
Definition at line 552 of file rotwing_state_V2.c.
References RotWingStateSettings::force_forward, RotWingStateSettings::hover_motors_active, RotWingStateSettings::hover_motors_disable, RotWingStateSettings::max_v_climb, RotWingStateSettings::max_v_descend, RotWingStateSettings::nav_max_speed, RotWingStateSettings::preferred_pitch_setting, rotwing_state_max_fw_speed, ROTWING_STATE_PITCH_FW_SETTING, rotwing_state_set_state_settings(), rotwing_state_settings, ROTWING_STATE_WING_FW_SETTING, RotWingStateSettings::stall_protection, and RotWingStateSettings::wing_scheduler.
Referenced by rotwing_switch_state().
|
inline |
Definition at line 566 of file rotwing_state_V2.c.
References RotWingStateSettings::force_forward, RotWingStateSettings::hover_motors_active, RotWingStateSettings::hover_motors_disable, RotWingStateSettings::max_v_climb, RotWingStateSettings::max_v_descend, RotWingStateSettings::nav_max_speed, RotWingStateSettings::preferred_pitch_setting, rotwing_state_max_fw_speed, ROTWING_STATE_PITCH_FW_SETTING, rotwing_state_set_state_settings(), rotwing_state_settings, ROTWING_STATE_WING_FW_SETTING, RotWingStateSettings::stall_protection, and RotWingStateSettings::wing_scheduler.
Referenced by rotwing_switch_state().
|
inline |
Definition at line 537 of file rotwing_state_V2.c.
References RotWingStateSettings::force_forward, RotWingStateSettings::hover_motors_active, RotWingStateSettings::hover_motors_disable, RotWingStateSettings::max_v_climb, RotWingStateSettings::max_v_descend, RotWingStateSettings::nav_max_speed, RotWingStateSettings::preferred_pitch_setting, rotwing_state_max_fw_speed, ROTWING_STATE_PITCH_FW_SETTING, rotwing_state_set_state_settings(), rotwing_state_settings, ROTWING_STATE_WING_FW_SETTING, RotWingStateSettings::stall_protection, and RotWingStateSettings::wing_scheduler.
Referenced by periodic_rotwing_state(), and rotwing_switch_state().
|
inline |
Definition at line 504 of file rotwing_state_V2.c.
References RotWingStateSettings::force_forward, RotWingStateSettings::hover_motors_active, RotWingStateSettings::hover_motors_disable, RotWingStateSettings::max_v_climb, RotWingStateSettings::max_v_descend, RotWingStateSettings::nav_max_speed, RotWingStateSettings::preferred_pitch_setting, rotwing_state_max_hover_speed, ROTWING_STATE_PITCH_QUAD_SETTING, rotwing_state_set_state_settings(), rotwing_state_settings, ROTWING_STATE_WING_QUAD_SETTING, RotWingStateSettings::stall_protection, and RotWingStateSettings::wing_scheduler.
Referenced by periodic_rotwing_state(), and rotwing_switch_state().
|
inline |
Definition at line 518 of file rotwing_state_V2.c.
References RotwingState::desired_state, RotWingStateSettings::force_forward, RotWingStateSettings::hover_motors_active, RotWingStateSettings::hover_motors_disable, RotWingStateSettings::max_v_climb, RotWingStateSettings::max_v_descend, RotWingStateSettings::nav_max_speed, RotWingStateSettings::preferred_pitch_setting, rotwing_state, ROTWING_STATE_HOVER, rotwing_state_max_fw_speed, ROTWING_STATE_PITCH_TRANSITION_SETTING, rotwing_state_set_state_settings(), rotwing_state_settings, ROTWING_STATE_WING_QUAD_SETTING, ROTWING_STATE_WING_SCHEDULING_SETTING, RotWingStateSettings::stall_protection, and RotWingStateSettings::wing_scheduler.
Referenced by rotwing_switch_state().
|
inline |
Definition at line 580 of file rotwing_state_V2.c.
References RotWingStateSkewing::airspeed_scheduling, bool_disable_hover_motors, force_forward, RotWingStateSettings::force_forward, RotWingStateSkewing::force_rotation_angle, RotWingStateSettings::hover_motors_active, hover_motors_active, RotWingStateSettings::hover_motors_disable, nav_goto_max_speed, nav_max_speed, RotWingStateSettings::nav_max_speed, rotwing_state_settings, rotwing_state_skewing, ROTWING_STATE_WING_FW_SETTING, ROTWING_STATE_WING_QUAD_SETTING, ROTWING_STATE_WING_SCHEDULING_SETTING, RotWingStateSkewing::wing_angle_deg_sp, and RotWingStateSettings::wing_scheduler.
Referenced by rotwing_state_set_fw_hov_mot_idle_settings(), rotwing_state_set_fw_hov_mot_off_settings(), rotwing_state_set_fw_settings(), rotwing_state_set_hover_settings(), and rotwing_state_set_skewing_settings().
void rotwing_state_skew_actuator_periodic | ( | void | ) |
Definition at line 690 of file rotwing_state_V2.c.
References ACT_FEEDBACK_UAVCAN_ID, commands, act_feedback_t::idx, MAX_PPRZ, rotwing_state_skewing, RotWingStateSkewing::servo_pprz_cmd, speed_sp, RotWingStateSkewing::wing_angle_deg, and RotWingStateSkewing::wing_angle_deg_sp.
|
inline |
Definition at line 615 of file rotwing_state_V2.c.
References RotWingStateSkewing::airspeed_scheduling, RotwingState::desired_state, ROTWING_HALF_SKEW_ANGLE_DEG, rotwing_state, ROTWING_STATE_HOVER, rotwing_state_skewing, stateGetAirspeed_f(), and RotWingStateSkewing::wing_angle_deg_sp.
Referenced by periodic_rotwing_state().
|
inline |
Definition at line 455 of file rotwing_state_V2.c.
References RotwingState::current_state, RotwingState::desired_state, ROTWING_MAX_QUAD_AIRSPEED, rotwing_state, ROTWING_STATE_FW, ROTWING_STATE_FW_HOV_MOT_IDLE, ROTWING_STATE_FW_HOV_MOT_OFF, ROTWING_STATE_HOVER, rotwing_state_set_fw_hov_mot_idle_settings(), rotwing_state_set_fw_hov_mot_off_settings(), rotwing_state_set_fw_settings(), rotwing_state_set_hover_settings(), rotwing_state_set_skewing_settings(), ROTWING_STATE_SKEWING, and stateGetAirspeed_f().
Referenced by periodic_rotwing_state().
|
static |
Definition at line 176 of file rotwing_state_V2.c.
References RotwingState::current_state, RotwingState::desired_state, dev, rotwing_state, rotwing_state_skewing, RotWingStateSkewing::servo_pprz_cmd, RotWingStateSkewing::wing_angle_deg, and RotWingStateSkewing::wing_angle_deg_sp.
Referenced by init_rotwing_state().
bool bool_disable_hover_motors = false |
Definition at line 159 of file rotwing_state_V2.c.
Referenced by periodic_rotwing_state(), and rotwing_state_set_state_settings().
bool hover_motors_active = true |
Definition at line 158 of file rotwing_state_V2.c.
Referenced by periodic_rotwing_state(), and rotwing_state_set_state_settings().
struct RotwingState rotwing_state |
Definition at line 139 of file rotwing_state_V2.c.
Referenced by init_rotwing_state(), periodic_rotwing_state(), request_rotwing_state(), rotwing_check_set_current_state(), rotwing_request_configuration(), rotwing_state_set_skewing_settings(), rotwing_state_skewer(), rotwing_switch_state(), and send_rotating_wing_state().
abi_event rotwing_state_feedback_ev |
Definition at line 136 of file rotwing_state_V2.c.
Referenced by init_rotwing_state().
uint8_t rotwing_state_fw_counter = 0 |
Definition at line 147 of file rotwing_state_V2.c.
Referenced by rotwing_check_set_current_state().
uint8_t rotwing_state_fw_idle_counter = 0 |
Definition at line 148 of file rotwing_state_V2.c.
Referenced by rotwing_check_set_current_state().
uint8_t rotwing_state_fw_m_off_counter = 0 |
Definition at line 149 of file rotwing_state_V2.c.
Referenced by rotwing_check_set_current_state().
uint8_t rotwing_state_hover_counter = 0 |
Definition at line 145 of file rotwing_state_V2.c.
Referenced by rotwing_check_set_current_state().
int32_t rotwing_state_hover_rpm[ROTWING_STATE_NUM_HOVER_RPM] = {0, 0, 0, 0} |
Definition at line 139 of file rotwing_state_V2.c.
Referenced by rotwing_check_set_current_state(), and rotwing_state_feedback_cb().
float rotwing_state_max_fw_speed = 20 |
Definition at line 155 of file rotwing_state_V2.c.
Referenced by rotwing_state_free_processor(), rotwing_state_set_fw_hov_mot_idle_settings(), rotwing_state_set_fw_hov_mot_off_settings(), rotwing_state_set_fw_settings(), and rotwing_state_set_skewing_settings().
float rotwing_state_max_hover_speed = 7 |
Definition at line 151 of file rotwing_state_V2.c.
Referenced by rotwing_state_set_hover_settings().
struct RotWingStateSettings rotwing_state_settings |
Definition at line 139 of file rotwing_state_V2.c.
Referenced by init_rotwing_state(), periodic_rotwing_state(), rotwing_state_set_fw_hov_mot_idle_settings(), rotwing_state_set_fw_hov_mot_off_settings(), rotwing_state_set_fw_settings(), rotwing_state_set_hover_settings(), rotwing_state_set_skewing_settings(), and rotwing_state_set_state_settings().
struct RotWingStateSkewing rotwing_state_skewing |
Definition at line 139 of file rotwing_state_V2.c.
Referenced by init_rotwing_state(), periodic_rotwing_state(), rotwing_check_set_current_state(), rotwing_state_feedback_cb(), rotwing_state_force_skew_off(), rotwing_state_set_state_settings(), rotwing_state_skew_actuator_periodic(), rotwing_state_skewer(), and send_rotating_wing_state().
uint8_t rotwing_state_skewing_counter = 0 |
Definition at line 146 of file rotwing_state_V2.c.
Referenced by rotwing_check_set_current_state().