From 547f32c5b020623bbcef9ad69086fd9b5b9c1dae Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 10 Mar 2020 15:51:03 +0100 Subject: [PATCH 1/5] [setting] group power switch in strip --- conf/settings/power_switch.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/settings/power_switch.xml b/conf/settings/power_switch.xml index 4fce8916c0..60b34f163d 100644 --- a/conf/settings/power_switch.xml +++ b/conf/settings/power_switch.xml @@ -4,8 +4,8 @@ - - + + From 91aba94e8fc78198710c0a8f9f279c38274c18c1 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 10 Mar 2020 15:51:48 +0100 Subject: [PATCH 2/5] [apogee] add definition of power switch for Apogee with ChibiOS --- sw/airborne/boards/apogee/chibios/v1.0/board.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sw/airborne/boards/apogee/chibios/v1.0/board.h b/sw/airborne/boards/apogee/chibios/v1.0/board.h index d77b687614..b33270d624 100644 --- a/sw/airborne/boards/apogee/chibios/v1.0/board.h +++ b/sw/airborne/boards/apogee/chibios/v1.0/board.h @@ -149,6 +149,9 @@ #define LED_8_GPIO_ON gpio_set #define LED_8_GPIO_OFF gpio_clear +/* Power Switch, on PB12 */ +#define POWER_SWITCH_GPIO GPIOB,GPIO12 + /* Pint to set Uart2 RX polarity, on PB13, output high inverts, low doesn't */ #define RC_POLARITY_GPIO_PORT GPIOB From 4503016a8e7faaed7c1fb1609626a1959e2fc3cf Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 10 Mar 2020 15:52:40 +0100 Subject: [PATCH 3/5] [chibios] add support for unaligned pprzlink data --- conf/Makefile.chibios | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.chibios b/conf/Makefile.chibios index ac5e72919e..0082fd8bac 100644 --- a/conf/Makefile.chibios +++ b/conf/Makefile.chibios @@ -95,7 +95,7 @@ $(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o) # Paparazzi options here. ifeq ($(PPRZ_DEFINITION),) - PPRZ_DEFINITION = -DUSE_CHIBIOS_RTOS -DUSE_ADC_WATCHDOG + PPRZ_DEFINITION = -DUSE_CHIBIOS_RTOS -DUSE_ADC_WATCHDOG -DPPRZLINK_UNALIGNED_ACCESS=1 endif # Compiler options here. From a067b0a1d9c7cbdf41a92b3887a00243a0c4c68e Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 10 Mar 2020 15:54:11 +0100 Subject: [PATCH 4/5] [gcs] add a tooltip for settings name that are too long even when the "shortname" is used, the settings name is sometimes too long to be visible --- sw/ground_segment/cockpit/page_settings.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/ground_segment/cockpit/page_settings.ml b/sw/ground_segment/cockpit/page_settings.ml index 7b31cc5bee..418c7a96d9 100644 --- a/sw/ground_segment/cockpit/page_settings.ml +++ b/sw/ground_segment/cockpit/page_settings.ml @@ -231,6 +231,7 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) ac_id packing dl_ ignore (commit_but#connect#clicked ~callback); tooltips#set_tip commit_but#coerce ~text:"Commit"; tooltips#set_tip current_value#coerce ~text:"Current value, click to request update."; + tooltips#set_tip _l#coerce ~text:text; (* Undo button *) let undo_but = GButton.button ~packing:hbox#pack () in From 53e1e7913dc02a359a78e3c4d9e9f65bf00d417b Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 10 Mar 2020 15:57:06 +0100 Subject: [PATCH 5/5] [nav] add an estimation of time to home The estimation is taking into account the wind speed if available, the airspeed (or NOMINAL_SPEED param if not available) to compute the time to go back to HOME point in straight line. This can be used in a flight plan exception to deroute a return to home if the expected flight time is too long (and not only the current flight time) --- .../subsystems/navigation/common_nav.c | 35 +++++++++++++++++++ .../subsystems/navigation/common_nav.h | 1 + 2 files changed, 36 insertions(+) diff --git a/sw/airborne/subsystems/navigation/common_nav.c b/sw/airborne/subsystems/navigation/common_nav.c index e50db65c80..96bd24fcc0 100644 --- a/sw/airborne/subsystems/navigation/common_nav.c +++ b/sw/airborne/subsystems/navigation/common_nav.c @@ -59,6 +59,41 @@ void compute_dist2_to_home(void) #endif } +/** Compute time to home + * use wind and airspeed when available + */ +float get_time_to_home(void) +{ + struct FloatVect2 vect_to_home; + vect_to_home.x = waypoints[WP_HOME].x - stateGetPositionEnu_f()->x; + vect_to_home.y = waypoints[WP_HOME].y - stateGetPositionEnu_f()->y; + // get distance to home + float dist_to_home = float_vect2_norm(&vect_to_home); + if (dist_to_home > 1.f) { + // get windspeed or assume no wind + struct FloatVect2 wind = { 0.f, 0.f }; + if (stateIsWindspeedValid()) { + wind = *stateGetHorizontalWindspeed_f(); + } + // compute effective windspeed when flying to home point + float wind_to_home = (wind.x * vect_to_home.x + wind.y * vect_to_home.y) / dist_to_home; + // get airspeed or assume constant nominal airspeed + float airspeed = NOMINAL_AIRSPEED; + if (stateIsAirspeedValid()) { + airspeed = stateGetAirspeed_f(); + } + // get estimated ground speed to home + float gspeed_to_home = wind_to_home + airspeed; + if (gspeed_to_home > 1.) { + return dist_to_home / gspeed_to_home; // estimated time to home in seconds + } + else { + return 999999.f; // this might take a long time to go back home + } + } + return 0.f; // too close to home point +} + static float previous_ground_alt; diff --git a/sw/airborne/subsystems/navigation/common_nav.h b/sw/airborne/subsystems/navigation/common_nav.h index ae76fb095f..63c819bfcc 100644 --- a/sw/airborne/subsystems/navigation/common_nav.h +++ b/sw/airborne/subsystems/navigation/common_nav.h @@ -68,6 +68,7 @@ extern void nav_reset_reference(void) __attribute__((unused)); extern void nav_reset_alt(void) __attribute__((unused)); extern void nav_update_waypoints_alt(void) __attribute__((unused)); extern void common_nav_periodic_task_4Hz(void); +extern float get_time_to_home(void); /* estimated time to home point in seconds */ #define NavSetGroundReferenceHere() ({ nav_reset_reference(); nav_update_waypoints_alt(); false; })