Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
navdata.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 /* Thanks to TU Delft by assigning students Dino Hensen, Vincent van Hoek */
22 
33 #ifndef NAVDATA_H_
34 #define NAVDATA_H_
35 
36 #include "std.h"
37 #include <unistd.h>
38 
46 
50 
56 
58 
63 
67 
69 
70  uint32_t sum_echo; //unsigned long
72 
74 
77 
81 
83 
84 } __attribute__((packed));
85 
86 /* The baro calibration received from the navboard */
99 
100  // These values are calculated
102 };
103 
104 /* Navdata board defines */
105 #define NAVDATA_PACKET_SIZE 60
106 #define NAVDATA_START_BYTE 0x3A
107 #define NAVDATA_CMD_START 0x01
108 #define NAVDATA_CMD_STOP 0x02
109 #define NAVDATA_CMD_BARO_CALIB 0x17
110 
111 #define ARDRONE_GPIO_PORT 0x32524
112 #define ARDRONE_GPIO_PIN_NAVDATA 177
113 
114 /* Main navdata structure */
115 struct navdata_t {
117  int fd;
118 
124 
125  struct navdata_measure_t measure;
127 
130  bool imu_lost;
131 };
132 extern struct navdata_t navdata;
133 
134 
135 bool navdata_init(void);
136 void navdata_update(void);
138 
139 /* FIXME: This should be moved to the uart handling part! */
140 ssize_t full_write(int fd, const uint8_t *buf, size_t count);
141 ssize_t full_read(int fd, uint8_t *buf, size_t count);
142 
143 #endif /* NAVDATA_H_ */
int32_t pressure
Definition: navdata.h:75
uint16_t nb_echo
Definition: navdata.h:68
struct bmp180_calib_t bmp180_calib
BMP180 calibration receieved from navboard.
Definition: navdata.h:126
int16_t ac2
Definition: navdata.h:89
uint16_t ac4
Definition: navdata.h:91
uint32_t totalBytesRead
Definition: navdata.h:119
int16_t gradient
Definition: navdata.h:71
uint16_t temperature_gyro
Definition: navdata.h:55
int16_t ac3
Definition: navdata.h:90
uint16_t ay
Definition: navdata.h:48
int16_t mc
Definition: navdata.h:97
int16_t mx
Definition: navdata.h:79
uint16_t us_debut_echo
Definition: navdata.h:59
ssize_t full_write(int fd, const uint8_t *buf, size_t count)
Write to fd even while being interrupted.
Definition: navdata.c:119
struct navdata_measure_t measure
Main navdata packet receieved from navboard.
Definition: navdata.h:125
bool imu_lost
Whenever the imu is lost.
Definition: navdata.h:130
int16_t ac1
Definition: navdata.h:88
uint16_t flag_echo_ini
Definition: navdata.h:73
int16_t vy
Definition: navdata.h:52
uint16_t ac6
Definition: navdata.h:93
int16_t navdata_height(void)
uint32_t lost_imu_frames
Definition: navdata.h:122
bool baro_calibrated
Whenever the baro is calibrated.
Definition: navdata.h:128
uint32_t packetsRead
Definition: navdata.h:120
uint16_t chksum
Definition: navdata.h:82
struct navdata_t navdata
Definition: navdata.c:59
bool navdata_init(void)
Initialize the navdata board.
Definition: navdata.c:202
uint16_t ultrasound
Definition: navdata.h:57
uint16_t us_curve_ref
Definition: navdata.h:66
int16_t vz
Definition: navdata.h:53
uint16_t nu_trame
Definition: navdata.h:45
uint16_t taille
Definition: navdata.h:44
int16_t b1
Definition: navdata.h:94
int fd
The navdata file pointer.
Definition: navdata.h:117
uint16_t temperature_acc
Definition: navdata.h:54
bool baro_available
Whenever the baro is available.
Definition: navdata.h:129
int16_t md
Definition: navdata.h:98
uint16_t us_distance_echo
Definition: navdata.h:62
int32_t b5
Definition: navdata.h:101
int16_t vx
Definition: navdata.h:51
uint16_t us_curve_value
Definition: navdata.h:65
int16_t my
Definition: navdata.h:78
uint32_t checksum_errors
Definition: navdata.h:121
int16_t b2
Definition: navdata.h:95
void navdata_update(void)
Update the navdata (event loop)
Definition: navdata.c:390
uint16_t us_fin_echo
Definition: navdata.h:60
uint16_t last_packet_number
Definition: navdata.h:123
ssize_t full_read(int fd, uint8_t *buf, size_t count)
Read from fd even while being interrupted.
Definition: navdata.c:139
uint16_t ac5
Definition: navdata.h:92
uint32_t sum_echo
Definition: navdata.h:70
bool is_initialized
Check if the navdata board is initialized.
Definition: navdata.h:116
uint16_t us_association_echo
Definition: navdata.h:61
uint16_t az
Definition: navdata.h:49
uint16_t us_curve_time
Definition: navdata.h:64
int16_t mb
Definition: navdata.h:96
uint16_t temperature_pressure
Definition: navdata.h:76
int16_t mz
Definition: navdata.h:80
uint16_t ax
Definition: navdata.h:47
Main navdata structure from the navdata board This is received from the navdata board at ~200Hz.
Definition: navdata.h:43
int fd
Definition: serial.c:26
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98