Paparazzi UAS  v5.15_devel-81-gd13dafb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
common_flight_plan.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2011 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 
27 #ifndef COMMON_FLIGHT_PLAN_H
28 #define COMMON_FLIGHT_PLAN_H
29 
30 #include "std.h"
31 
34 
37 
39 void nav_init_stage(void);
40 
41 void nav_init_block(void);
42 void nav_goto_block(uint8_t block_id);
43 
44 #define InitStage() nav_init_stage();
45 
46 #define Block(x) case x: nav_block=x;
47 #define NextBlock() nav_goto_block(nav_block + 1)
48 #define GotoBlock(b) nav_goto_block(b)
49 
50 #define Stage(s) case s: nav_stage=s;
51 #define NextStage() { nav_stage++; InitStage(); } INTENTIONAL_FALLTHRU
52 #define NextStageAndBreak() { nav_stage++; InitStage(); break; }
53 #define NextStageAndBreakFrom(wp) { last_wp = wp; NextStageAndBreak(); }
54 
55 #define Label(x) label_ ## x:
56 #define Goto(x) { goto label_ ## x; }
57 #define Return(x) { nav_block=last_block; if (x==1) {nav_stage=0;} else {nav_stage=last_stage;} block_time=0;}
58 
59 #define And(x, y) ((x) && (y))
60 #define Or(x, y) ((x) || (y))
61 #define Min(x,y) (x < y ? x : y)
62 #define Max(x,y) (x > y ? x : y)
63 #define LessThan(_x, _y) ((_x) < (_y))
64 #define MoreThan(_x, _y) ((_x) > (_y))
65 
67 #define NavBlockTime() (block_time)
68 
69 #endif /* COMMON_FLIGHT_PLAN_H */
unsigned short uint16_t
Definition: types.h:16
uint16_t block_time
uint8_t last_stage
void nav_init_block(void)
void nav_goto_block(uint8_t block_id)
uint8_t last_block
To save the current block/stage to enable return.
uint16_t stage_time
In s.
void nav_init_stage(void)
needs to be implemented by fixedwing and rotorcraft seperately
Definition: nav.c:93
unsigned char uint8_t
Definition: types.h:14
uint8_t nav_stage
uint8_t nav_block