5 #if FRAME_CONFIG == HELI_FRAME 7 #ifndef HELI_DYNAMIC_FLIGHT_SPEED_MIN 8 #define HELI_DYNAMIC_FLIGHT_SPEED_MIN 500 // we are in "dynamic flight" when the speed is over 5m/s for 2 seconds 12 static int8_t heli_dynamic_flight_counter;
18 input_manager.set_use_stab_col(
true);
19 input_manager.set_stab_col_ramp(1.0);
26 if (!
motors->armed() || !
motors->rotor_runup_complete() ||
28 heli_dynamic_flight_counter = 0;
29 heli_flags.dynamic_flight =
false;
39 moving = (velocity >= HELI_DYNAMIC_FLIGHT_SPEED_MIN);
53 if (!heli_flags.dynamic_flight) {
54 heli_dynamic_flight_counter++;
55 if (heli_dynamic_flight_counter >= 100) {
56 heli_flags.dynamic_flight =
true;
57 heli_dynamic_flight_counter = 100;
62 if (heli_flags.dynamic_flight) {
63 if (heli_dynamic_flight_counter > 0) {
64 heli_dynamic_flight_counter--;
66 heli_flags.dynamic_flight =
false;
81 hover_roll_trim_scalar_slew--;
84 hover_roll_trim_scalar_slew++;
102 motors->set_collective_for_landing(
false);
107 motors->set_collective_for_landing(
true);
113 motors->set_collective_for_landing(
true);
115 motors->set_collective_for_landing(!heli_flags.dynamic_flight ||
ap.land_complete || !
ap.auto_armed);
121 motors->set_collective_for_landing(
true);
123 motors->set_collective_for_landing(!heli_flags.dynamic_flight ||
ap.land_complete || !
ap.auto_armed);
129 motors->set_collective_for_landing(!heli_flags.dynamic_flight ||
ap.land_complete || !
ap.auto_armed);
138 static bool rotor_runup_complete_last =
false;
141 uint8_t rsc_control_mode =
motors->get_rsc_mode();
143 float rsc_control_deglitched = rotor_speed_deglitch_filter.apply((
float)
RC_Channels::rc_channel(CH_8)->get_control_in()) * 0.001f;
145 switch (rsc_control_mode) {
148 if (rsc_control_deglitched > 0.01f) {
149 ap.motor_interlock_switch =
true;
150 motors->set_desired_rotor_speed(rsc_control_deglitched);
152 ap.motor_interlock_switch =
false;
153 motors->set_desired_rotor_speed(0.0f);
161 if (rsc_control_deglitched > 0.0f) {
162 ap.motor_interlock_switch =
true;
163 motors->set_desired_rotor_speed(
motors->get_rsc_setpoint());
165 ap.motor_interlock_switch =
false;
166 motors->set_desired_rotor_speed(0.0f);
172 if (!rotor_runup_complete_last &&
motors->rotor_runup_complete()){
174 }
else if (rotor_runup_complete_last && !
motors->rotor_runup_complete()){
177 rotor_runup_complete_last =
motors->rotor_runup_complete();
180 #endif // FRAME_CONFIG == HELI_FRAME #define DATA_ROTOR_SPEED_BELOW_CRITICAL
AC_AttitudeControl_t * attitude_control
int16_t constrain_int16(const int16_t amt, const int16_t low, const int16_t high)
static RC_Channel * rc_channel(uint8_t chan)
uint16_t get_loop_rate_hz(void)
#define DATA_ROTOR_RUNUP_COMPLETE
struct Copter::@0 rangefinder_state
ROTOR_CONTROL_MODE_SPEED_SETPOINT
void check_dynamic_flight(void)
void heli_update_landing_swash()
AP_InertialNav_NavEKF inertial_nav
ROTOR_CONTROL_MODE_CLOSED_LOOP_POWER_OUTPUT
bool is_zero(const T fVal1)
void Log_Write_Event(uint8_t id)
uint16_t distance_cm_orient(enum Rotation orientation) const
RangeFinder_Status status_orient(enum Rotation orientation) const
void update_heli_control_dynamics(void)
void heli_update_rotor_speed_targets()
ROTOR_CONTROL_MODE_SPEED_PASSTHROUGH
float get_velocity_xy() const
control_mode_t control_mode
ROTOR_CONTROL_MODE_OPEN_LOOP_POWER_OUTPUT