Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
autopilot.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 Pascal Brisset, Antoine Drouin
3  * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
4  * Copyright (C) 2016-2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, see
20  * <http://www.gnu.org/licenses/>.
21  */
22 
32 #ifndef AUTOPILOT_H
33 #define AUTOPILOT_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include "std.h"
40 #include "paparazzi.h"
41 #include "generated/airframe.h"
42 #include "state.h"
43 #include "autopilot_utils.h"
44 
45 // include firmware specific header
46 #include "autopilot_firmware.h"
47 
48 // include static or generated autopilot
49 // static version by default
50 #ifndef USE_GENERATED_AUTOPILOT
51 #define USE_GENERATED_AUTOPILOT FALSE
52 #endif
53 
54 #if USE_GENERATED_AUTOPILOT
55 #include "autopilot_generated.h"
56 #else
57 #include "autopilot_static.h"
58 #endif
59 
68  bool motors_on;
70  bool in_flight;
71  bool launch;
72  bool use_rc;
75 };
76 
77 
80 extern struct pprz_autopilot autopilot;
81 
84 extern void autopilot_init(void);
85 
88 extern void autopilot_periodic(void);
89 
92 extern void autopilot_event(void);
93 
96 extern void autopilot_on_rc_frame(void);
97 
100 extern void autopilot_failsafe_checks(void);
101 
107 extern bool autopilot_set_mode(uint8_t new_autopilot_mode);
108 
111 extern void autopilot_SetModeHandler(float new_autopilot_mode);
112 
117 extern uint8_t autopilot_get_mode(void);
118 
122 extern void autopilot_reset_flight_time(void);
123 #define autopilot_ResetFlightTimeAndLaunch(_) autopilot_reset_flight_time()
124 
130 extern void autopilot_set_motors_on(bool motors_on);
131 
136 extern bool autopilot_get_motors_on(void);
137 
143 extern void autopilot_set_kill_throttle(bool kill);
144 #define autopilot_KillThrottle(_kill) autopilot_set_kill_throttle(_kill)
145 
150 extern bool autopilot_throttle_killed(void);
151 
156 extern void autopilot_check_in_flight(bool motors_on);
157 
162 extern void autopilot_set_in_flight(bool in_flight);
163 
168 extern bool autopilot_in_flight(void);
169 
173 extern void autopilot_reset_in_flight_counter(void);
174 
179 extern void autopilot_store_settings(void);
180 #define autopilot_StoreSettings(_) autopilot_store_settings()
181 
186 extern void autopilot_clear_settings(void);
187 #define autopilot_ClearSettings(_) autopilot_clear_settings()
188 
191 extern void autopilot_send_version(void);
192 
195 extern void autopilot_send_mode(void);
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif /* AUTOPILOT_H */
202 
autopilot_send_mode
void autopilot_send_mode(void)
Report autopilot mode on default downlink channel.
Definition: autopilot.c:324
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
autopilot_reset_flight_time
void autopilot_reset_flight_time(void)
Reset flight time and launch status Also provide macro for dl_setting backward compatibility.
Definition: autopilot.c:223
autopilot_in_flight
bool autopilot_in_flight(void)
Get in flight status.
Definition: autopilot.c:289
autopilot_set_in_flight
void autopilot_set_in_flight(bool in_flight)
Set in flight status.
Definition: autopilot.c:279
pprz_autopilot::flight_time
uint16_t flight_time
flight time in seconds
Definition: autopilot.h:65
pprz_autopilot::mode
uint8_t mode
current autopilot mode
Definition: autopilot.h:63
pprz_autopilot::use_rc
bool use_rc
enable/disable RC input
Definition: autopilot.h:72
pprz_autopilot
PPRZ Autopilot structure definition.
Definition: autopilot.h:62
autopilot_reset_in_flight_counter
void autopilot_reset_in_flight_counter(void)
reset in_flight counter actual implementation is firmware dependent
Definition: autopilot.c:275
autopilot_throttle_killed
bool autopilot_throttle_killed(void)
Get kill status.
Definition: autopilot.c:262
paparazzi.h
autopilot_init
void autopilot_init(void)
Autopilot initialization function.
Definition: autopilot.c:106
autopilot
struct pprz_autopilot autopilot
Global autopilot structure.
Definition: autopilot.c:48
autopilot_SetModeHandler
void autopilot_SetModeHandler(float new_autopilot_mode)
Handler for setter function with dl_setting.
Definition: autopilot.c:205
std.h
pprz_t
int16_t pprz_t
Definition: paparazzi.h:6
autopilot_clear_settings
void autopilot_clear_settings(void)
Clear marked settings in flash try to make sure that we don't write to flash while flying Also provid...
Definition: autopilot.c:306
pprz_autopilot::motors_on
bool motors_on
motor status
Definition: autopilot.h:68
pprz_autopilot::in_flight
bool in_flight
in flight status
Definition: autopilot.h:70
autopilot_send_version
void autopilot_send_version(void)
Report autopilot version on default downlink channel.
Definition: autopilot.c:316
pprz_autopilot::throttle
pprz_t throttle
throttle level as will be displayed in GCS
Definition: autopilot.h:66
autopilot_failsafe_checks
void autopilot_failsafe_checks(void)
Autopilot periodic failsafe checks.
Definition: autopilot.c:188
autopilot_store_settings
void autopilot_store_settings(void)
Store marked settings in flash Try to make sure that we don't write to flash while flying Also provid...
Definition: autopilot.c:296
pprz_autopilot::ground_detected
bool ground_detected
automatic detection of landing
Definition: autopilot.h:73
autopilot_set_motors_on
void autopilot_set_motors_on(bool motors_on)
Start or stop motors May have no effect if motors has auto-start based on throttle setpoint.
Definition: autopilot.c:232
autopilot_get_mode
uint8_t autopilot_get_mode(void)
Get autopilot mode.
Definition: autopilot.c:216
autopilot_set_kill_throttle
void autopilot_set_kill_throttle(bool kill)
Enable or disable motor control from autopilot Also provide macro for dl_setting backward compatibili...
Definition: autopilot.c:251
pprz_autopilot::mode_auto2
uint8_t mode_auto2
FIXME hide this in a private part ?
Definition: autopilot.h:64
autopilot_set_mode
bool autopilot_set_mode(uint8_t new_autopilot_mode)
Set new autopilot mode.
Definition: autopilot.c:192
autopilot_periodic
void autopilot_periodic(void)
Autopilot periodic call at PERIODIC_FREQUENCY.
Definition: autopilot.c:145
autopilot_on_rc_frame
void autopilot_on_rc_frame(void)
Autopilot RC input event hadler.
Definition: autopilot.c:177
state.h
autopilot_get_motors_on
bool autopilot_get_motors_on(void)
Get motor status.
Definition: autopilot.c:244
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
pprz_autopilot::kill_throttle
bool kill_throttle
allow autopilot to use throttle
Definition: autopilot.h:69
autopilot_check_in_flight
void autopilot_check_in_flight(bool motors_on)
Check if airframe is in flight.
Definition: autopilot.c:270
autopilot_event
void autopilot_event(void)
Autopilot event check function.
Definition: autopilot.c:173
pprz_autopilot::launch
bool launch
request launch
Definition: autopilot.h:71
pprz_autopilot::arming_status
uint8_t arming_status
arming status
Definition: autopilot.h:67
pprz_autopilot::detect_ground_once
bool detect_ground_once
enable automatic detection of ground (one shot)
Definition: autopilot.h:74