Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Airborne status optimized. #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion NAV_Algorithms/NAV_tuning_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
#define DISABLE_CIRCLING_STATE 0 //!< for tests only: never use circling AHRS algorithm
#define INDUCTION_STD_DEVIATION_LIMIT 0.03 //!< results outperforming this number will be used further on

#define AIRBORNE_TRIGGER_SPEED 0.5f //!< speed-compensator vario value m/s
#define AIRBORNE_TRIGGER_SPEED_COMP 0.5f //!< speed-compensator vario value m/s
#define AIRBORNE_TRIGGER_SPEED 15.0f //!< ground speed / m/s

#define MAG_SCALE 10000.0f //!< scale factor for high-precision integer statistics
#define FAST_SAMPLING_REQUENCY 100.0f
Expand Down
6 changes: 4 additions & 2 deletions NAV_Algorithms/airborne_detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ class airborne_detector_t
{
if( yes)
{
if( airborne_counter < LEVEL)
if( airborne_counter == 0)
airborne_counter = 100; // create hysteresis
else if( airborne_counter < LEVEL)
++ airborne_counter;
}
else
{
if( airborne_counter > 0)
if( airborne_counter > 0)
{
--airborne_counter;
if( airborne_counter == 0)
Expand Down
13 changes: 12 additions & 1 deletion NAV_Algorithms/navigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,18 @@ bool navigator_t::update_at_10Hz ()
ahrs.get_euler ().y,
ahrs.get_circling_state ());

airborne_detector.report_to_be_airborne( abs( flight_observer.get_speed_compensation_GNSS()) > AIRBORNE_TRIGGER_SPEED);
unsigned airborne_criteria_fulfilled = 0;
if( abs( flight_observer.get_speed_compensation_GNSS()) > AIRBORNE_TRIGGER_SPEED_COMP)
++ airborne_criteria_fulfilled;

if( GNSS_velocity.abs() > AIRBORNE_TRIGGER_SPEED)
++ airborne_criteria_fulfilled;

if( IAS > AIRBORNE_TRIGGER_SPEED)
++ airborne_criteria_fulfilled;

// if at least 2 of 3 criteria apply, we believe to be airborne
airborne_detector.report_to_be_airborne( airborne_criteria_fulfilled > 1);
if( airborne_detector.detect_just_landed())
{
ahrs.write_calibration_into_EEPROM();
Expand Down