Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
common_flight_plan.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2009 ENAC, Pascal Brisset, Antoine Drouin
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 
28 
29 #include "generated/flight_plan.h"
30 
33 
35 
39 
42 
45  nav_stage = 0;
47  nav_block = 0;
49  last_stage = 0;
51  last_block = 0;
52  stage_time = 0;
53  block_time = 0;
54 }
55 
56 void nav_init_block(void)
57 {
58  if (private_nav_block >= NB_BLOCK) {
59  private_nav_block = NB_BLOCK - 1;
61  }
64  block_time = 0;
65  InitStage();
66  nav_on_enter_block(private_nav_block); // generated by flight plan
67 }
68 
70 {
71  if (b != private_nav_block) {
72  /* To avoid a loop in a the current block */
77  }
78  nav_on_exit_block(private_nav_block); // generated by flight plan
82 }
83 
84 void nav_goto_next_block(void) {
85  if (private_nav_block < NB_BLOCK - 1) {
87  } else {
89  }
90 }
91 
92 void nav_goto_next_stage(void) {
95  InitStage();
96 }
97 
99  nav_on_exit_block(private_nav_block); // generated by flight plan
102  if (reset == 1) {
103  private_nav_stage = 0;
104  } else {
106  }
108  block_time = 0;
109  InitStage();
110  nav_on_enter_block(private_nav_block); // generated by flight plan
111 }
112 
114  return private_nav_block;
115 }
117  return private_nav_stage;
118 }
120  return private_last_block;
121 }
123  return private_last_stage;
124 }
125 
127  if (b >= NB_BLOCK) {
128  private_nav_block = NB_BLOCK - 1;
129  }
130  else {
132  }
134 }
135 
138  nav_stage = s;
139 }
140 
static uint8_t reset[3]
Definition: baro_MS5534A.c:83
static uint8_t private_last_block
uint8_t nav_stage
static uint8_t private_nav_stage
static uint8_t private_nav_block
void nav_goto_next_stage(void)
void nav_return(uint8_t reset)
uint8_t get_last_stage()
uint8_t get_nav_stage()
static uint8_t private_last_stage
uint8_t get_last_block()
void set_nav_block(uint8_t b)
uint8_t last_block
To save the current block/stage to enable return.
void set_nav_stage(uint8_t s)
uint8_t last_stage
uint8_t last_wp UNUSED
uint8_t nav_block
void nav_init_block(void)
uint8_t get_nav_block()
void common_flight_plan_init(void)
uint16_t stage_time
In s.
void nav_goto_block(uint8_t b)
void nav_goto_next_block(void)
uint16_t block_time
Common flight_plan functions shared between fixedwing and rotorcraft.
uint8_t last_wp
void nav_on_exit_block(uint8_t block_id)
void nav_on_enter_block(uint8_t block_id)
Functions generated by the flight plan.
#define InitStage()
static uint32_t s
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
float b
Definition: wedgebug.c:202