Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot_generated.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 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
27#define AUTOPILOT_CORE_AP_C
28
30#include "autopilot.h"
31#include "autopilot_arming.h"
32
38
39#include "generated/settings.h"
40
41
43{
44 // call generated init
46 // copy generated mode to public mode (set at startup)
48
49 // init arming
51}
52
53
55{
56
58
59 // copy generated mode to public mode (may be changed on internal exceptions)
61
62 /* Reset ground detection _after_ running flight plan
63 */
64 if (!autopilot_in_flight()) {
67 }
68
69}
70
79
80
87
88
90{
91 if (motors_on
94#endif
95 ) {
96 autopilot.motors_on = true;
97 } else {
98 autopilot.motors_on = false;
99 }
101}
102
103
105{
106
107 // FIXME what to do here ?
108
109 /* an arming sequence is used to start/stop motors.
110 */
113
114 /* if not in FAILSAFE or HOME mode, read RC and set commands accordingly */
115// if (autopilot.mode != AP_MODE_FAILSAFE && autopilot.mode != AP_MODE_HOME) {
116//
117// /* if there are some commands that should always be set from RC, do it */
118//#ifdef SetAutoCommandsFromRC
119// SetAutoCommandsFromRC(commands, radio_control.values);
120//#endif
121//
122// /* if not in NAV_MODE set commands from the rc */
123//#ifdef SetCommandsFromRC
124// if (autopilot.mode != AP_MODE_NAV) {
125// SetCommandsFromRC(commands, radio_control.values);
126// }
127//#endif
128// }
129
130}
struct pprz_autopilot autopilot
Global autopilot structure.
Definition autopilot.c:49
bool autopilot_in_flight(void)
get in_flight flag
Definition autopilot.c:340
Core autopilot interface common to all firmwares.
bool motors_on
motor status
Definition autopilot.h:68
bool ground_detected
automatic detection of landing
Definition autopilot.h:73
bool detect_ground_once
enable automatic detection of ground (one shot)
Definition autopilot.h:74
bool kill_throttle
allow autopilot to use throttle
Definition autopilot.h:69
uint8_t mode
current autopilot mode
Definition autopilot.h:63
Arming procedure for rotorcraft Several options can be selected:
static void autopilot_arming_set(bool motors_on)
static void autopilot_arming_check_motors_on(void)
State machine to check if motors should be turned ON or OFF using the kill switch.
static void autopilot_arming_init(void)
Hardware independent code for commands handling.
void autopilot_generated_SetModeHandler(float mode)
AP mode setting handler.
void autopilot_generated_periodic(void)
void autopilot_generated_set_mode(uint8_t new_autopilot_mode)
void autopilot_generated_init(void)
void autopilot_generated_on_rc_frame(void)
void autopilot_generated_set_motors_on(bool motors_on)
uint16_t foo
Definition main_demo5.c:58
Hardware independent API for actuators (servos, motor controllers).
Generic interface for radio control modules.
Autopilot generated implementation Calls the code generated from autopilot XML file.
#define AP_MODE_KILL
Static autopilot modes.
Persistent settings interface.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition sonar_bebop.c:65
#define FALSE
Definition std.h:5
Periodic telemetry system header (includes downlink utility and generated code).
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.