Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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
28
#include "
firmwares/rotorcraft/autopilot_utils.h
"
29
#include "
autopilot.h
"
30
#include "
firmwares/rotorcraft/autopilot_rc_helpers.h
"
31
#include "
state.h
"
32
#include "
subsystems/radio_control.h
"
33
35
PRINT_CONFIG_VAR(
FAILSAFE_DESCENT_SPEED
)
36
37
38
// Utility functions
39
#ifndef AUTOPILOT_DISABLE_AHRS_KILL
40
bool
ap_ahrs_is_aligned
(
void
)
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
56
uint8_t
ap_mode_of_3way_switch
(
void
)
57
{
58
if
(
radio_control
.
values
[
RADIO_MODE
] >
THRESHOLD_2_PPRZ
) {
59
return
MODE_AUTO2
;
60
}
else
if
(
radio_control
.
values
[
RADIO_MODE
] >
THRESHOLD_1_PPRZ
) {
61
return
MODE_AUTO1
;
62
}
else
{
63
return
MODE_MANUAL
;
64
}
65
}
66
radio_control.h
MODE_AUTO2
#define MODE_AUTO2
Definition:
autopilot_static.h:66
ap_ahrs_is_aligned
bool ap_ahrs_is_aligned(void)
Display descent speed in failsafe mode if needed.
Definition:
autopilot_utils.c:41
RADIO_MODE
#define RADIO_MODE
Definition:
intermcu_ap.h:44
autopilot_rc_helpers.h
MODE_AUTO1
#define MODE_AUTO1
Definition:
autopilot_static.h:63
autopilot_utils.h
stateIsAttitudeValid
static bool stateIsAttitudeValid(void)
Test if attitudes are valid.
Definition:
state.h:1067
uint8_t
unsigned char uint8_t
Definition:
types.h:14
ap_mode_of_3way_switch
uint8_t ap_mode_of_3way_switch(void)
get autopilot mode as set by RADIO_MODE 3-way switch
Definition:
autopilot_utils.c:90
autopilot.h
PRINT_CONFIG_MSG
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
THRESHOLD_1_PPRZ
#define THRESHOLD_1_PPRZ
Definition:
autopilot_utils.c:52
state.h
FAILSAFE_DESCENT_SPEED
#define FAILSAFE_DESCENT_SPEED
Set descent speed in failsafe mode.
Definition:
autopilot_utils.h:37
MODE_MANUAL
#define MODE_MANUAL
Default RC mode.
Definition:
autopilot_static.h:60
THRESHOLD_2_PPRZ
#define THRESHOLD_2_PPRZ
Definition:
autopilot_utils.c:53
radio_control
struct RadioControl radio_control
Definition:
radio_control.c:30
RadioControl::values
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition:
radio_control.h:69
sw
airborne
firmwares
rover
autopilot_utils.c
Generated on Tue Feb 1 2022 13:51:13 for Paparazzi UAS by
1.8.17