Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot_utils.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
29 #include "autopilot.h"
31 #include "state.h"
33 
35 PRINT_CONFIG_VAR(FAILSAFE_DESCENT_SPEED)
36 
37 
38 // Utility functions
39 #ifndef AUTOPILOT_DISABLE_AHRS_KILL
41 {
42  return stateIsAttitudeValid();
43 }
44 #else
45 PRINT_CONFIG_MSG("Using AUTOPILOT_DISABLE_AHRS_KILL")
46 bool ap_ahrs_is_aligned(void)
47 {
48  return true;
49 }
50 #endif
51 
52 #define THRESHOLD_1_PPRZ (MIN_PPRZ / 2)
53 #define THRESHOLD_2_PPRZ (MAX_PPRZ / 2)
54 
57 {
59  return MODE_AUTO2;
61  return MODE_AUTO1;
62  } else {
63  return MODE_MANUAL;
64  }
65 }
66 
uint8_t ap_mode_of_3way_switch(void)
get autopilot mode as set by RADIO_MODE 3-way switch
#define FAILSAFE_DESCENT_SPEED
Set descent speed in failsafe mode.
Utility functions and includes for autopilots.
#define THRESHOLD_1_PPRZ
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69
bool ap_ahrs_is_aligned(void)
Display descent speed in failsafe mode if needed.
#define MODE_MANUAL
Default RC mode.
Some helper functions to check RC sticks.
#define RADIO_MODE
Definition: intermcu_ap.h:43
static bool stateIsAttitudeValid(void)
Test if attitudes are valid.
Definition: state.h:1067
#define MODE_AUTO1
#define MODE_AUTO2
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
struct RadioControl radio_control
Definition: radio_control.c:30
Core autopilot interface common to all firmwares.
unsigned char uint8_t
Definition: types.h:14
API to get/set the generic vehicle states.
#define THRESHOLD_2_PPRZ