MAV'RIC
curvace.h
1 /*******************************************************************************
2  * Copyright (c) 2009-2014, MAV'RIC Development Team
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  ******************************************************************************/
31 
32 /*******************************************************************************
33  * \file curvace.h
34  *
35  * \author MAV'RIC Team
36  * \author Julien Lecoeur
37  *
38  * \brief Driver for the cylindrical curvace
39  *
40  ******************************************************************************/
41 
42 
43 #ifndef CURVACE_H_
44 #define CURVACE_H_
45 
46 #ifdef __cplusplus
47  extern "C" {
48 #endif
49 
50 #include <stdint.h>
51 #include "quaternions.h"
52 #include "ahrs.h"
53 #include "mavlink_stream.h"
54 
55 #define CURVACE_NB_OF 108
56 
57 
58 typedef struct
59 {
60  int16_t x;
61  int16_t y;
63 
64 
65 typedef union
66 {
67  int16_t data[2 * CURVACE_NB_OF];
68  struct
69  {
70  curvace_raw_of_vector_t left_hemisphere[ CURVACE_NB_OF / 2 ];
71  curvace_raw_of_vector_t right_hemisphere[ CURVACE_NB_OF / 2 ];
72  };
73  struct
74  {
75  curvace_raw_of_vector_t all[ CURVACE_NB_OF ];
76  };
78 
79 
80 typedef struct
81 {
82  float x;
83  float y;
85 
86 
87 typedef union
88 {
89  float data[ 2 * CURVACE_NB_OF ];
90  struct
91  {
92  curvace_of_vector_t left_hemisphere[ CURVACE_NB_OF / 2 ];
93  curvace_of_vector_t right_hemisphere[ CURVACE_NB_OF / 2 ];
94  };
95  struct
96  {
97  curvace_of_vector_t all[ CURVACE_NB_OF ];
98  };
100 
101 
105 typedef struct
106 {
107  uint8_t x;
108  uint8_t y;
110 
111 
115 typedef struct
116 {
117  float azimuth;
118  float elevation;
120 
121 
125  typedef union
126  {
127  float data[ CURVACE_NB_OF * 2 ];
128  struct
129  {
130  curvace_viewing_direction_t left_hemisphere[ CURVACE_NB_OF / 2 ];
131  curvace_viewing_direction_t right_hemisphere[ CURVACE_NB_OF / 2 ];
132  };
133  curvace_viewing_direction_t all[ CURVACE_NB_OF ];
135 
136 
146 typedef struct
147 {
148  float Arx;
149  float Apx;
150  float Ayx;
151  float Ary;
152  float Apy;
153  float Ayy;
155 
156 
157 typedef struct
158 {
159  float elevation;
160  float azimuth;
162 
163 typedef union
164 {
165  float data[ 2 * CURVACE_NB_OF ];
166  curvace_scale_factor_t scale[ CURVACE_NB_OF ];
168 
169 
170 typedef union
171 {
172  float data[ CURVACE_NB_OF * 6 ];
173  struct
174  {
175  derotation_matrix_t left_hemisphere[ CURVACE_NB_OF / 2 ];
176  derotation_matrix_t right_hemisphere[ CURVACE_NB_OF / 2 ];
177  };
178  derotation_matrix_t all[ CURVACE_NB_OF ];
180 
181 
182 typedef struct
183 {
184  curvace_data_t of;
185  curvace_raw_data_t raw_of;
186  curvace_roi_coord_t roi_coord;
187  curvace_calibration_matrix_t calib_matrix;
188  curvace_calibration_factor_t calib_factor;
190  const ahrs_t* ahrs;
191  const mavlink_stream_t* mavlink_stream;
192 } curvace_t;
193 
194 
195 
196 void curvace_init(curvace_t* curvace, const ahrs_t* ahrs, const mavlink_stream_t* mavlink_stream);
197 
198 
199 void curvace_update(curvace_t* curvace);
200 
201 
202 void curvace_send_telemetry(const curvace_t* curvace);
203 
204 #ifdef __cplusplus
205  }
206 #endif
207 
208 #endif
Definition: curvace.h:182
Definition: curvace.h:87
Structure containing the Attitude and Heading Reference System.
Definition: ahrs.h:58
float azimuth
azimuth in radians
Definition: curvace.h:117
Direction at which a ROI is pointed.
Definition: curvace.h:115
uint8_t y
y coordinate
Definition: curvace.h:108
Definition: curvace.h:157
Definition: curvace.h:170
Definition: curvace.h:65
uint8_t x
x coordinate
Definition: curvace.h:107
Unit quaternion.
Definition: quaternions.h:62
List of viewing direction for each Region of interest (ROI)
Definition: curvace.h:125
Pixels coordinates top left is (0, 0), bottom right is (41, 14)
Definition: curvace.h:105
float elevation
elevation in radians
Definition: curvace.h:118
Definition: curvace.h:58
quat_t orientation
unused
Definition: curvace.h:189
Link between gyro rates and rotational optic flow.
Definition: curvace.h:146
Definition: curvace.h:163
Definition: curvace.h:80