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
autopilot_arming_yaw.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 The Paparazzi Team
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 
29 #ifndef AUTOPILOT_ARMING_YAW_H
30 #define AUTOPILOT_ARMING_YAW_H
31 
32 #include "autopilot_rc_helpers.h"
33 
38 #ifndef MOTOR_ARMING_DELAY
39 #define MOTOR_ARMING_DELAY 40
40 #endif
41 
53 };
54 
57 
58 
59 static inline void autopilot_arming_init(void)
60 {
63 }
64 
65 
68 static inline void autopilot_arming_set(bool_t motors_on)
69 {
70  if (motors_on) {
72  } else {
74  }
75 }
76 
83 static inline void autopilot_arming_check_motors_on(void)
84 {
85  /* only allow switching motor if not in KILL mode */
87 
89  case STATUS_INITIALISE_RC: // Wait until RC is initialised (it being centered is a good pointer to this)
92  }
93  break;
94  case STATUS_MOTORS_AUTOMATICALLY_OFF: // Motors were disarmed externally
95  //(possibly due to crash)
96  //wait extra delay before enabling the normal arming state machine
99  if (THROTTLE_STICK_DOWN() && YAW_STICK_CENTERED()) { // stick released
101  }
102  break;
107  }
108  break;
109  case STATUS_MOTORS_OFF:
112  if (THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED()) { // stick pushed
114  }
115  break;
121  } else if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) { // stick released too soon
123  }
124  break;
125  case STATUS_START_MOTORS:
128  if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) { // wait until stick released
130  }
131  break;
132  case STATUS_MOTORS_ON:
135  if (THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED()) { // stick pushed
137  }
138  break;
142  if (autopilot_motors_on_counter == 0) {
144  } else if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) { // stick released too soon
146  }
147  break;
148  case STATUS_STOP_MOTORS:
151  if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) { // wait until stick released
153  }
154  break;
155  default:
156  break;
157  }
158  }
159 }
160 
161 #endif /* AUTOPILOT_ARMING_YAW_H */
uint32_t autopilot_motors_on_counter
#define AP_MODE_KILL
Definition: autopilot.h:36
uint8_t autopilot_mode
Definition: autopilot.c:65
#define ROLL_STICK_CENTERED()
bool_t autopilot_motors_on
Definition: autopilot.c:72
static void autopilot_arming_set(bool_t motors_on)
Update the status of the check_motors state machine.
enum arming_state autopilot_check_motor_status
#define THROTTLE_STICK_DOWN()
#define MOTOR_ARMING_DELAY
Delay until motors are armed/disarmed.
#define PITCH_STICK_CENTERED()
#define FALSE
Definition: std.h:5
#define YAW_STICK_PUSHED()
#define TRUE
Definition: std.h:4
unsigned long uint32_t
Definition: types.h:18
static void autopilot_arming_check_motors_on(void)
State machine to check if motors should be turned ON or OFF.
Some helper functions to check RC sticks.
#define YAW_STICK_CENTERED()
static void autopilot_arming_init(void)