6 #if CONFIG_HAL_BOARD == HAL_BOARD_SITL 8 # define Debug(fmt, args ...) do {printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args); hal.scheduler->delay(1); } while(0) 10 # define Debug(fmt, args ...) 310 float integ2_input =
_height_filter.dd_height + hgt_ddot_mea + hgt_err * omega2 * 3.0f;
314 float integ3_input =
_climb_rate + hgt_err * _hgtCompFiltOmega * 3.0f;
384 integDTAS_input =
MAX(integDTAS_input , 0.0
f);
598 SPE_err_max = SPE_err_min = 0;
624 float ff_throttle = 0;
630 float cosPhi = sqrtf((rotMat.
a.
y*rotMat.
a.
y) + (rotMat.
b.
y*rotMat.
b.
y));
660 float maxAmp = 0.5f*(
_THRmaxf - THRminf_clipped_to_zero);
736 float cosPhi = sqrtf((rotMat.
a.
y*rotMat.
a.
y) + (rotMat.
b.
y*rotMat.
b.
y));
781 SKE_weighting = 0.0f;
787 SKE_weighting = 0.0f;
789 SKE_weighting = 2.0f;
823 float integSEB_delta = integSEB_input *
_DT;
827 ::printf(
"_hgt_rate_dem=%.1f _hgt_dem_adj=%.1f climb=%.1f _flare_counter=%u _pitch_dem=%.1f SEB_dem=%.2f SEBdot_dem=%.2f SEB_error=%.2f SEBdot_error=%.2f\n",
829 SEB_dem, SEBdot_dem, SEB_error, SEBdot_error);
850 temp += SEBdot_error * pitch_damp;
855 float integSEB_min = (gainInv * (
_PITCHminf - 0.0783f)) - temp;
856 float integSEB_max = (gainInv * (
_PITCHmaxf + 0.0783f)) - temp;
857 float integSEB_range = integSEB_max - integSEB_min;
859 logging.SEB_delta = integSEB_delta;
864 integSEB_delta =
constrain_float(integSEB_delta, -integSEB_range*0.1
f, integSEB_range*0.1f);
945 float distance_beyond_land_wp,
946 int32_t ptchMinCO_cd,
947 int16_t throttle_nudge,
1014 if (time_to_flare < 0) {
1023 ::printf(
"ttf=%.1f hgt_afe=%.1f _PITCHminf=%.1f pitch_limit=%.1f climb=%.1f\n",
1081 "TimeUS,h,dh,hdem,dhdem,spdem,sp,dsp,ith,iph,th,ph,dspdem,w,f",
1098 (
double)
logging.SKE_weighting,
1105 (
double)load_factor);
uint32_t _underspeed_start_ms
int printf(const char *fmt,...)
virtual bool get_velocity_NED(Vector3f &vec) const
int16_t get_pitch_cd(void) const
float timeConstant(void) const
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
AP_Float _land_sink_rate_change
uint64_t _update_pitch_throttle_last_usec
AP_Float _land_throttle_damp
float _distance_beyond_land_wp
Combined Total Energy Speed & Height Control. This is a instance of an AP_SpdHgtControl class...
void _detect_underspeed(void)
AP_Float _land_pitch_damp
AP_Float _maxSinkRate_approach
void _update_throttle_with_airspeed(void)
#define AP_GROUPINFO(name, idx, clazz, element, def)
void _update_STE_rate_lim(void)
virtual T apply(T sample)
virtual bool airspeed_estimate(float *airspeed_ret) const
uint64_t _update_50hz_last_usec
const AP_Landing & _landing
AP_Float _hgtCompFiltOmega
virtual const Matrix3f & get_rotation_body_to_ned(void) const =0
void _update_speed(float load_factor)
enum AP_Vehicle::FixedWing::FlightStage _flight_stage
AP_Float _integGain_takeoff
static auto MAX(const A &one, const B &two) -> decltype(one > two ? one :two)
void _update_height_demand(void)
AP_Int16 pitch_limit_min_cd
uint64_t _update_speed_last_usec
const Vector3f & get_accel(uint8_t i) const
AP_Int8 takeoff_throttle_max
bool _use_synthetic_airspeed_once
void Log_Write(const char *name, const char *labels, const char *fmt,...)
void _initialise_states(int32_t ptchMinCO_cd, float hgt_afe)
bool is_zero(const T fVal1)
virtual const Vector3f & get_accel_ef(uint8_t i) const
AP_Int8 throttle_slewrate
bool get_throttle_suppressed() const
bool reached_speed_takeoff
struct AP_TECS::@186 _height_filter
static DataFlash_Class * instance(void)
AP_Float _spdCompFiltOmega
AP_Int8 _use_synthetic_airspeed
struct AP_TECS::@189 logging
void update_pitch_throttle(int32_t hgt_dem_cm, int32_t EAS_dem_cm, enum AP_Vehicle::FixedWing::FlightStage flight_stage, float distance_beyond_land_wp, int32_t ptchMinCO_cd, int16_t throttle_nudge, float hgt_afe, float load_factor)
void _update_energies(void)
void _update_throttle_without_airspeed(int16_t throttle_nudge)
float constrain_float(const float amt, const float low, const float high)
float get_altitude(void) const
static constexpr float radians(float deg)
bool is_flaring(void) const
float get_flare_sec(void) const
AverageFilterFloat_Size5 _vdot_filter
float hgt_dem_lag_filter_slew
AP_InertialSensor & ins()
const AP_Vehicle::FixedWing & aparm
bool airspeed_sensor_enabled(void) const
float get_EAS2TAS(void) const
static const struct AP_Param::GroupInfo var_info[]
const SoaringController & _soaring_controller
virtual void get_relative_position_D_home(float &posD) const =0
AP_Int16 pitch_limit_max_cd
bool is_on_approach(void) const
void _detect_bad_descent(void)
void _update_speed_demand(void)