Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
auto1_commands.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 OpenUAS
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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
23 #include "auto1_commands.h"
24 #include "generated/airframe.h"
26 #include "inter_mcu.h"
27 
29 {
30  // Copy Radio commands in AUTO1
31  if (pprz_mode == PPRZ_MODE_AUTO1) {
32 #ifdef COMMAND_HATCH
33 #ifndef RADIO_HATCH
34 #error auto1_commands COMMAND_HATCH needs RADIO_HATCH channel
35 #endif
36  ap_state->commands[COMMAND_HATCH] = fbw_state->channels[RADIO_HATCH];
37 #endif
38 #ifdef COMMAND_BRAKE
39 #ifndef RADIO_BRAKE
40 #error auto1_commands COMMAND_BRAKE needs RADIO_BRAKE channel
41 #endif
42  ap_state->commands[COMMAND_BRAKE] = fbw_state->channels[RADIO_BRAKE];
43 #endif
44 #ifdef COMMAND_FLAPS
45 #ifndef RADIO_FLAPS
46 #error auto1_commands COMMAND_FLAPS needs RADIO_FLAPS channel
47 #endif
48  ap_state->commands[COMMAND_FLAPS] = fbw_state->channels[RADIO_FLAPS];
49 #endif
50  }
51 }
Enable AUTO1 commands flaps and hatch from RC.
Communication between fbw and ap processes.
uint8_t pprz_mode
Definition: autopilot.c:41
void periodic_auto1_commands(void)
struct fbw_state * fbw_state
Definition: inter_mcu.c:36
struct ap_state * ap_state
Definition: inter_mcu.c:37
#define PPRZ_MODE_AUTO1
Definition: autopilot.h:51
Fixedwing autopilot modes.