From c35054a6e610fe28f1a4d5ad604bc0c7eb0c168d Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 1 Apr 2008 12:28:22 +0000 Subject: [PATCH] declaration of variables for control from an external system --- sw/airborne/external.c | 22 ++++++++++++++++++++++ sw/airborne/external.h | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 sw/airborne/external.c create mode 100644 sw/airborne/external.h diff --git a/sw/airborne/external.c b/sw/airborne/external.c new file mode 100644 index 0000000000..41ef60762c --- /dev/null +++ b/sw/airborne/external.c @@ -0,0 +1,22 @@ +#define EXTERNAL_C + +#include "external.h" +#include "flight_plan.h" + +float nav_roll = 0.; +float nav_throttle = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE; +float nav_cruise = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE; +float nav_alt = SECURITY_ALT; + +int setNavCruise( void ) { + v_ctl_auto_throttle_cruise_throttle = nav_cruise; + return FALSE; +} + +/* +int nav_throttle_loop( void ) { + nav_throttle_setpoint = TRIM_UPPRZ(nav_throttle * MAX_PPRZ); + return FALSE; +} +*/ + diff --git a/sw/airborne/external.h b/sw/airborne/external.h new file mode 100644 index 0000000000..0e8f6c772f --- /dev/null +++ b/sw/airborne/external.h @@ -0,0 +1,22 @@ +#ifndef EXTERNAL_H +#define EXTERNAL_H + +#include "nav.h" + +extern float nav_roll; /* degrees, >0 on the right */ +/* int nav_ground_speed_loop(void); */ + +extern float nav_throttle; +/* int nav_throttle_loop(void); */ + +extern float nav_cruise; +int setNavCruise(void); + +extern float nav_alt; + +#define external_SetNavThrottle(_v) { \ + nav_throttle = (_v ? _v : nav_throttle); \ + Bound(nav_throttle, V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE, V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE); \ +} + +#endif