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
traffic_info.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005 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 
29 #ifndef TI_H
30 #define TI_H
31 
32 #define NB_ACS_ID 256
33 #define NB_ACS 24
34 
35 struct ac_info_ {
37  float east; /* m relative to nav_utm_east0 */
38  float north; /* m relative to nav_utm_north0 */
39  float course; /* rad (CW) */
40  float alt; /* m */
41  float gspeed; /* m/s */
42  float climb; /* m/s */
43  uint32_t itow; /* ms */
44 };
45 
46 extern uint8_t acs_idx;
48 extern struct ac_info_ the_acs[NB_ACS];
49 
50 // 0 is reserved for ground station (id=0)
51 // 1 is reserved for this AC (id=AC_ID)
52 #define SetAcInfo(_id, _utm_x /*m*/, _utm_y /*m*/, _course/*rad(CW)*/, _alt/*m*/,_gspeed/*m/s*/,_climb, _itow) { \
53  if (acs_idx < NB_ACS) { \
54  if (_id > 0 && the_acs_id[_id] == 0) { \
55  the_acs_id[_id] = acs_idx++; \
56  the_acs[the_acs_id[_id]].ac_id = (uint8_t)_id; \
57  } \
58  the_acs[the_acs_id[_id]].east = _utm_x - nav_utm_east0; \
59  the_acs[the_acs_id[_id]].north = _utm_y - nav_utm_north0; \
60  the_acs[the_acs_id[_id]].course = _course; \
61  the_acs[the_acs_id[_id]].alt = _alt; \
62  the_acs[the_acs_id[_id]].gspeed = _gspeed; \
63  the_acs[the_acs_id[_id]].climb = _climb; \
64  the_acs[the_acs_id[_id]].itow = (uint32_t)_itow; \
65  } \
66  }
67 
68 extern void traffic_info_init(void);
69 
70 struct ac_info_ *get_ac_info(uint8_t id);
71 
72 #endif
struct ac_info_ the_acs[NB_ACS]
Definition: traffic_info.c:35
uint8_t ac_id
Definition: traffic_info.h:36
float gspeed
Definition: traffic_info.h:41
float course
Definition: traffic_info.h:39
float north
Definition: traffic_info.h:38
float alt
Definition: traffic_info.h:40
float east
Definition: traffic_info.h:37
uint32_t itow
Definition: traffic_info.h:43
uint8_t the_acs_id[NB_ACS_ID]
Definition: traffic_info.c:34
unsigned long uint32_t
Definition: types.h:18
void traffic_info_init(void)
Definition: traffic_info.c:37
#define NB_ACS
Definition: traffic_info.h:33
unsigned char uint8_t
Definition: types.h:14
float climb
Definition: traffic_info.h:42
#define NB_ACS_ID
Definition: traffic_info.h:32
struct ac_info_ * get_ac_info(uint8_t id)
Definition: traffic_info.c:45
uint8_t acs_idx
Definition: traffic_info.c:33