MAV'RIC
|
00001 /******************************************************************************* 00002 * Copyright (c) 2009-2016, MAV'RIC Development Team 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions and the following disclaimer in the documentation 00013 * and/or other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of the copyright holder nor the names of its contributors 00016 * may be used to endorse or promote products derived from this software without 00017 * specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00023 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 * POSSIBILITY OF SUCH DAMAGE. 00030 ******************************************************************************/ 00031 00032 /******************************************************************************* 00033 * \file curvace.h 00034 * 00035 * \author MAV'RIC Team 00036 * \author Julien Lecoeur 00037 * \author Geraud L'Eplattenier 00038 * 00039 * \brief Driver for the cylindrical curvace 00040 * 00041 ******************************************************************************/ 00042 00043 00044 #ifndef CURVACE_H_ 00045 #define CURVACE_H_ 00046 00047 #ifdef __cplusplus 00048 extern "C" { 00049 #endif 00050 00051 #include <stdint.h> 00052 #include "util/quaternions.h" 00053 #include "sensing/ahrs.hpp" 00054 #include "drivers/optic_flow.h" 00055 #include "util/constants.hpp" 00056 00057 #define CURVACE_NB_OF 108 00058 00059 00063 typedef union 00064 { 00065 int16_t data[2 * CURVACE_NB_OF]; 00066 struct 00067 { 00068 raw_of_vector_t left_hemisphere[ CURVACE_NB_OF / 2 ]; 00069 raw_of_vector_t right_hemisphere[ CURVACE_NB_OF / 2 ]; 00070 }; 00071 struct 00072 { 00073 raw_of_vector_t all[ CURVACE_NB_OF ]; 00074 }; 00075 } curvace_raw_data_t; 00076 00077 00081 typedef union 00082 { 00083 float data[ 2 * CURVACE_NB_OF ]; 00084 struct 00085 { 00086 of_vector_t left_hemisphere[ CURVACE_NB_OF / 2 ]; 00087 of_vector_t right_hemisphere[ CURVACE_NB_OF / 2 ]; 00088 }; 00089 struct 00090 { 00091 of_vector_t all[ CURVACE_NB_OF ]; 00092 }; 00093 } curvace_data_t; 00094 00095 00099 typedef struct 00100 { 00101 uint8_t x; 00102 uint8_t y; 00103 } curvace_pixel_coordinates_t; 00104 00105 00109 typedef union 00110 { 00111 float data[ CURVACE_NB_OF * 2 ]; 00112 struct 00113 { 00114 viewing_direction_t left_hemisphere[ CURVACE_NB_OF / 2 ]; 00115 viewing_direction_t right_hemisphere[ CURVACE_NB_OF / 2 ]; 00116 }; 00117 viewing_direction_t all[ CURVACE_NB_OF ]; 00118 } curvace_roi_coord_t; 00119 00120 00124 typedef struct 00125 { 00126 float elevation; 00127 float azimuth; 00128 } curvace_scale_factor_t; 00129 00130 00134 typedef union 00135 { 00136 float data[ 2 * CURVACE_NB_OF ]; 00137 curvace_scale_factor_t scale[ CURVACE_NB_OF ]; 00138 } curvace_calibration_factor_t; 00139 00140 00144 typedef union 00145 { 00146 float data[ CURVACE_NB_OF * 6 ]; 00147 struct 00148 { 00149 derotation_matrix_t left_hemisphere[ CURVACE_NB_OF / 2 ]; 00150 derotation_matrix_t right_hemisphere[ CURVACE_NB_OF / 2 ]; 00151 }; 00152 derotation_matrix_t all[ CURVACE_NB_OF ]; 00153 } curvace_calibration_matrix_t; 00154 00155 00159 typedef struct 00160 { 00161 curvace_data_t of; 00162 curvace_raw_data_t raw_of; 00163 curvace_roi_coord_t roi_coord; 00164 curvace_calibration_matrix_t calib_matrix; 00165 curvace_calibration_factor_t calib_factor; 00166 float scale_factor_simple; 00167 constants_on_off_t do_derotation; 00168 float LPF; 00169 float derot_factor; 00170 quat_t orientation; 00171 const ahrs_t* ahrs; 00172 } curvace_t; 00173 00174 00181 void curvace_init(curvace_t* curvace, const ahrs_t* ahrs); 00182 00183 00189 void curvace_update(curvace_t* curvace); 00190 00191 00192 #ifdef __cplusplus 00193 } 00194 #endif 00195 00196 #endif