Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
traffic_info.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2005 Pascal Brisset, Antoine Drouin
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
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 north
Definition: traffic_info.h:38
float east
Definition: traffic_info.h:37
uint32_t itow
Definition: traffic_info.h:43
float alt
Definition: traffic_info.h:40
uint8_t the_acs_id[NB_ACS_ID]
Definition: traffic_info.c:34
unsigned long uint32_t
Definition: types.h:18
float course
Definition: traffic_info.h:39
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:44
float gspeed
Definition: traffic_info.h:41
uint8_t acs_idx
Definition: traffic_info.c:33