Colour sensors calibrated

Dependencies:   mbed-rtos mbed Servo QEI

Fork of ICRSEurobot13 by Thomas Branch

Committer:
xiaxia686
Date:
Fri Apr 12 20:59:18 2013 +0000
Revision:
46:adcd57a5e402
Parent:
15:9c5aaeda36dc
Colours Sensors fixed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
madcowswe 15:9c5aaeda36dc 1 /*
madcowswe 15:9c5aaeda36dc 2 * Tiny Vector Matrix Library
madcowswe 15:9c5aaeda36dc 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
madcowswe 15:9c5aaeda36dc 4 *
madcowswe 15:9c5aaeda36dc 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
madcowswe 15:9c5aaeda36dc 6 *
madcowswe 15:9c5aaeda36dc 7 * This library is free software; you can redistribute it and/or
madcowswe 15:9c5aaeda36dc 8 * modify it under the terms of the GNU lesser General Public
madcowswe 15:9c5aaeda36dc 9 * License as published by the Free Software Foundation; either
madcowswe 15:9c5aaeda36dc 10 * version 2.1 of the License, or (at your option) any later version.
madcowswe 15:9c5aaeda36dc 11 *
madcowswe 15:9c5aaeda36dc 12 * This library is distributed in the hope that it will be useful,
madcowswe 15:9c5aaeda36dc 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
madcowswe 15:9c5aaeda36dc 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
madcowswe 15:9c5aaeda36dc 15 * lesser General Public License for more details.
madcowswe 15:9c5aaeda36dc 16 *
madcowswe 15:9c5aaeda36dc 17 * You should have received a copy of the GNU lesser General Public
madcowswe 15:9c5aaeda36dc 18 * License along with this library; if not, write to the Free Software
madcowswe 15:9c5aaeda36dc 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
madcowswe 15:9c5aaeda36dc 20 *
madcowswe 15:9c5aaeda36dc 21 * $Id: MatrixUnaryFunctions.h,v 1.13 2007-06-23 15:58:58 opetzold Exp $
madcowswe 15:9c5aaeda36dc 22 */
madcowswe 15:9c5aaeda36dc 23
madcowswe 15:9c5aaeda36dc 24 #ifndef TVMET_MATRIX_UNARY_FUNCTIONS_H
madcowswe 15:9c5aaeda36dc 25 #define TVMET_MATRIX_UNARY_FUNCTIONS_H
madcowswe 15:9c5aaeda36dc 26
madcowswe 15:9c5aaeda36dc 27 namespace tvmet {
madcowswe 15:9c5aaeda36dc 28
madcowswe 15:9c5aaeda36dc 29
madcowswe 15:9c5aaeda36dc 30 /*********************************************************
madcowswe 15:9c5aaeda36dc 31 * PART I: DECLARATION
madcowswe 15:9c5aaeda36dc 32 *********************************************************/
madcowswe 15:9c5aaeda36dc 33
madcowswe 15:9c5aaeda36dc 34 /*
madcowswe 15:9c5aaeda36dc 35 * unary_function(Matrix<T, Rows, Cols>)
madcowswe 15:9c5aaeda36dc 36 */
madcowswe 15:9c5aaeda36dc 37 #define TVMET_DECLARE_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 38 template<class T, std::size_t Rows, std::size_t Cols> \
madcowswe 15:9c5aaeda36dc 39 inline \
madcowswe 15:9c5aaeda36dc 40 XprMatrix< \
madcowswe 15:9c5aaeda36dc 41 XprUnOp< \
madcowswe 15:9c5aaeda36dc 42 Fcnl_##NAME<T>, \
madcowswe 15:9c5aaeda36dc 43 MatrixConstReference<T, Rows, Cols> \
madcowswe 15:9c5aaeda36dc 44 >, \
madcowswe 15:9c5aaeda36dc 45 Rows, Cols \
madcowswe 15:9c5aaeda36dc 46 > \
madcowswe 15:9c5aaeda36dc 47 NAME(const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
madcowswe 15:9c5aaeda36dc 48
madcowswe 15:9c5aaeda36dc 49 TVMET_DECLARE_MACRO(abs)
madcowswe 15:9c5aaeda36dc 50 TVMET_DECLARE_MACRO(cbrt)
madcowswe 15:9c5aaeda36dc 51 TVMET_DECLARE_MACRO(ceil)
madcowswe 15:9c5aaeda36dc 52 TVMET_DECLARE_MACRO(floor)
madcowswe 15:9c5aaeda36dc 53 TVMET_DECLARE_MACRO(rint)
madcowswe 15:9c5aaeda36dc 54 TVMET_DECLARE_MACRO(sin)
madcowswe 15:9c5aaeda36dc 55 TVMET_DECLARE_MACRO(cos)
madcowswe 15:9c5aaeda36dc 56 TVMET_DECLARE_MACRO(tan)
madcowswe 15:9c5aaeda36dc 57 TVMET_DECLARE_MACRO(sinh)
madcowswe 15:9c5aaeda36dc 58 TVMET_DECLARE_MACRO(cosh)
madcowswe 15:9c5aaeda36dc 59 TVMET_DECLARE_MACRO(tanh)
madcowswe 15:9c5aaeda36dc 60 TVMET_DECLARE_MACRO(asin)
madcowswe 15:9c5aaeda36dc 61 TVMET_DECLARE_MACRO(acos)
madcowswe 15:9c5aaeda36dc 62 TVMET_DECLARE_MACRO(atan)
madcowswe 15:9c5aaeda36dc 63 TVMET_DECLARE_MACRO(exp)
madcowswe 15:9c5aaeda36dc 64 TVMET_DECLARE_MACRO(log)
madcowswe 15:9c5aaeda36dc 65 TVMET_DECLARE_MACRO(log10)
madcowswe 15:9c5aaeda36dc 66 TVMET_DECLARE_MACRO(sqrt)
madcowswe 15:9c5aaeda36dc 67
madcowswe 15:9c5aaeda36dc 68 #if defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 69 TVMET_DECLARE_MACRO(asinh)
madcowswe 15:9c5aaeda36dc 70 TVMET_DECLARE_MACRO(acosh)
madcowswe 15:9c5aaeda36dc 71 TVMET_DECLARE_MACRO(atanh)
madcowswe 15:9c5aaeda36dc 72 TVMET_DECLARE_MACRO(expm1)
madcowswe 15:9c5aaeda36dc 73 TVMET_DECLARE_MACRO(log1p)
madcowswe 15:9c5aaeda36dc 74 TVMET_DECLARE_MACRO(erf)
madcowswe 15:9c5aaeda36dc 75 TVMET_DECLARE_MACRO(erfc)
madcowswe 15:9c5aaeda36dc 76 TVMET_DECLARE_MACRO(j0)
madcowswe 15:9c5aaeda36dc 77 TVMET_DECLARE_MACRO(j1)
madcowswe 15:9c5aaeda36dc 78 TVMET_DECLARE_MACRO(y0)
madcowswe 15:9c5aaeda36dc 79 TVMET_DECLARE_MACRO(y1)
madcowswe 15:9c5aaeda36dc 80 TVMET_DECLARE_MACRO(lgamma)
madcowswe 15:9c5aaeda36dc 81 /** \todo isnan etc. - default return is only an int! */
madcowswe 15:9c5aaeda36dc 82
madcowswe 15:9c5aaeda36dc 83 TVMET_DECLARE_MACRO(finite)
madcowswe 15:9c5aaeda36dc 84 #endif // defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 85
madcowswe 15:9c5aaeda36dc 86 #undef TVMET_DECLARE_MACRO
madcowswe 15:9c5aaeda36dc 87
madcowswe 15:9c5aaeda36dc 88
madcowswe 15:9c5aaeda36dc 89 /*
madcowswe 15:9c5aaeda36dc 90 * unary_function(Matrix<std::complex<T>, Rows, Cols>)
madcowswe 15:9c5aaeda36dc 91 */
madcowswe 15:9c5aaeda36dc 92 #if defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 93 #define TVMET_DECLARE_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 94 template<class T, std::size_t Rows, std::size_t Cols> \
madcowswe 15:9c5aaeda36dc 95 inline \
madcowswe 15:9c5aaeda36dc 96 XprMatrix< \
madcowswe 15:9c5aaeda36dc 97 XprUnOp< \
madcowswe 15:9c5aaeda36dc 98 Fcnl_##NAME< std::complex<T> >, \
madcowswe 15:9c5aaeda36dc 99 MatrixConstReference<std::complex<T>, Rows, Cols> \
madcowswe 15:9c5aaeda36dc 100 >, \
madcowswe 15:9c5aaeda36dc 101 Rows, Cols \
madcowswe 15:9c5aaeda36dc 102 > \
madcowswe 15:9c5aaeda36dc 103 NAME(const Matrix<std::complex<T>, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
madcowswe 15:9c5aaeda36dc 104
madcowswe 15:9c5aaeda36dc 105 TVMET_DECLARE_MACRO(real)
madcowswe 15:9c5aaeda36dc 106 TVMET_DECLARE_MACRO(imag)
madcowswe 15:9c5aaeda36dc 107 TVMET_DECLARE_MACRO(arg)
madcowswe 15:9c5aaeda36dc 108 TVMET_DECLARE_MACRO(norm)
madcowswe 15:9c5aaeda36dc 109 TVMET_DECLARE_MACRO(conj)
madcowswe 15:9c5aaeda36dc 110
madcowswe 15:9c5aaeda36dc 111 #undef TVMET_DECLARE_MACRO
madcowswe 15:9c5aaeda36dc 112
madcowswe 15:9c5aaeda36dc 113 #endif // defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 114
madcowswe 15:9c5aaeda36dc 115
madcowswe 15:9c5aaeda36dc 116 /*********************************************************
madcowswe 15:9c5aaeda36dc 117 * PART II: IMPLEMENTATION
madcowswe 15:9c5aaeda36dc 118 *********************************************************/
madcowswe 15:9c5aaeda36dc 119
madcowswe 15:9c5aaeda36dc 120
madcowswe 15:9c5aaeda36dc 121 /*
madcowswe 15:9c5aaeda36dc 122 * unary_function(Matrix<T, Rows, Cols>)
madcowswe 15:9c5aaeda36dc 123 */
madcowswe 15:9c5aaeda36dc 124 #define TVMET_IMPLEMENT_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 125 template<class T, std::size_t Rows, std::size_t Cols> \
madcowswe 15:9c5aaeda36dc 126 inline \
madcowswe 15:9c5aaeda36dc 127 XprMatrix< \
madcowswe 15:9c5aaeda36dc 128 XprUnOp< \
madcowswe 15:9c5aaeda36dc 129 Fcnl_##NAME<T>, \
madcowswe 15:9c5aaeda36dc 130 MatrixConstReference<T, Rows, Cols> \
madcowswe 15:9c5aaeda36dc 131 >, \
madcowswe 15:9c5aaeda36dc 132 Rows, Cols \
madcowswe 15:9c5aaeda36dc 133 > \
madcowswe 15:9c5aaeda36dc 134 NAME(const Matrix<T, Rows, Cols>& rhs) { \
madcowswe 15:9c5aaeda36dc 135 typedef XprUnOp< \
madcowswe 15:9c5aaeda36dc 136 Fcnl_##NAME<T>, \
madcowswe 15:9c5aaeda36dc 137 MatrixConstReference<T, Rows, Cols> \
madcowswe 15:9c5aaeda36dc 138 > expr_type; \
madcowswe 15:9c5aaeda36dc 139 return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs.const_ref())); \
madcowswe 15:9c5aaeda36dc 140 }
madcowswe 15:9c5aaeda36dc 141
madcowswe 15:9c5aaeda36dc 142 TVMET_IMPLEMENT_MACRO(abs)
madcowswe 15:9c5aaeda36dc 143 TVMET_IMPLEMENT_MACRO(cbrt)
madcowswe 15:9c5aaeda36dc 144 TVMET_IMPLEMENT_MACRO(ceil)
madcowswe 15:9c5aaeda36dc 145 TVMET_IMPLEMENT_MACRO(floor)
madcowswe 15:9c5aaeda36dc 146 TVMET_IMPLEMENT_MACRO(rint)
madcowswe 15:9c5aaeda36dc 147 TVMET_IMPLEMENT_MACRO(sin)
madcowswe 15:9c5aaeda36dc 148 TVMET_IMPLEMENT_MACRO(cos)
madcowswe 15:9c5aaeda36dc 149 TVMET_IMPLEMENT_MACRO(tan)
madcowswe 15:9c5aaeda36dc 150 TVMET_IMPLEMENT_MACRO(sinh)
madcowswe 15:9c5aaeda36dc 151 TVMET_IMPLEMENT_MACRO(cosh)
madcowswe 15:9c5aaeda36dc 152 TVMET_IMPLEMENT_MACRO(tanh)
madcowswe 15:9c5aaeda36dc 153 TVMET_IMPLEMENT_MACRO(asin)
madcowswe 15:9c5aaeda36dc 154 TVMET_IMPLEMENT_MACRO(acos)
madcowswe 15:9c5aaeda36dc 155 TVMET_IMPLEMENT_MACRO(atan)
madcowswe 15:9c5aaeda36dc 156 TVMET_IMPLEMENT_MACRO(exp)
madcowswe 15:9c5aaeda36dc 157 TVMET_IMPLEMENT_MACRO(log)
madcowswe 15:9c5aaeda36dc 158 TVMET_IMPLEMENT_MACRO(log10)
madcowswe 15:9c5aaeda36dc 159 TVMET_IMPLEMENT_MACRO(sqrt)
madcowswe 15:9c5aaeda36dc 160
madcowswe 15:9c5aaeda36dc 161 #if defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 162 TVMET_IMPLEMENT_MACRO(asinh)
madcowswe 15:9c5aaeda36dc 163 TVMET_IMPLEMENT_MACRO(acosh)
madcowswe 15:9c5aaeda36dc 164 TVMET_IMPLEMENT_MACRO(atanh)
madcowswe 15:9c5aaeda36dc 165 TVMET_IMPLEMENT_MACRO(expm1)
madcowswe 15:9c5aaeda36dc 166 TVMET_IMPLEMENT_MACRO(log1p)
madcowswe 15:9c5aaeda36dc 167 TVMET_IMPLEMENT_MACRO(erf)
madcowswe 15:9c5aaeda36dc 168 TVMET_IMPLEMENT_MACRO(erfc)
madcowswe 15:9c5aaeda36dc 169 TVMET_IMPLEMENT_MACRO(j0)
madcowswe 15:9c5aaeda36dc 170 TVMET_IMPLEMENT_MACRO(j1)
madcowswe 15:9c5aaeda36dc 171 TVMET_IMPLEMENT_MACRO(y0)
madcowswe 15:9c5aaeda36dc 172 TVMET_IMPLEMENT_MACRO(y1)
madcowswe 15:9c5aaeda36dc 173 TVMET_IMPLEMENT_MACRO(lgamma)
madcowswe 15:9c5aaeda36dc 174 /** \todo isnan etc. - default return is only an int! */
madcowswe 15:9c5aaeda36dc 175
madcowswe 15:9c5aaeda36dc 176 TVMET_IMPLEMENT_MACRO(finite)
madcowswe 15:9c5aaeda36dc 177 #endif // defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 178
madcowswe 15:9c5aaeda36dc 179 #undef TVMET_IMPLEMENT_MACRO
madcowswe 15:9c5aaeda36dc 180
madcowswe 15:9c5aaeda36dc 181
madcowswe 15:9c5aaeda36dc 182 /*
madcowswe 15:9c5aaeda36dc 183 * unary_function(Matrix<std::complex<T>, Rows, Cols>)
madcowswe 15:9c5aaeda36dc 184 */
madcowswe 15:9c5aaeda36dc 185 #if defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 186 #define TVMET_IMPLEMENT_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 187 template<class T, std::size_t Rows, std::size_t Cols> \
madcowswe 15:9c5aaeda36dc 188 inline \
madcowswe 15:9c5aaeda36dc 189 XprMatrix< \
madcowswe 15:9c5aaeda36dc 190 XprUnOp< \
madcowswe 15:9c5aaeda36dc 191 Fcnl_##NAME< std::complex<T> >, \
madcowswe 15:9c5aaeda36dc 192 MatrixConstReference<std::complex<T>, Rows, Cols> \
madcowswe 15:9c5aaeda36dc 193 >, \
madcowswe 15:9c5aaeda36dc 194 Rows, Cols \
madcowswe 15:9c5aaeda36dc 195 > \
madcowswe 15:9c5aaeda36dc 196 NAME(const Matrix<std::complex<T>, Rows, Cols>& rhs) { \
madcowswe 15:9c5aaeda36dc 197 typedef XprUnOp< \
madcowswe 15:9c5aaeda36dc 198 Fcnl_##NAME< std::complex<T> >, \
madcowswe 15:9c5aaeda36dc 199 MatrixConstReference<std::complex<T>, Rows, Cols> \
madcowswe 15:9c5aaeda36dc 200 > expr_type; \
madcowswe 15:9c5aaeda36dc 201 return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs.const_ref())); \
madcowswe 15:9c5aaeda36dc 202 }
madcowswe 15:9c5aaeda36dc 203
madcowswe 15:9c5aaeda36dc 204 TVMET_IMPLEMENT_MACRO(real)
madcowswe 15:9c5aaeda36dc 205 TVMET_IMPLEMENT_MACRO(imag)
madcowswe 15:9c5aaeda36dc 206 TVMET_IMPLEMENT_MACRO(arg)
madcowswe 15:9c5aaeda36dc 207 TVMET_IMPLEMENT_MACRO(norm)
madcowswe 15:9c5aaeda36dc 208 TVMET_IMPLEMENT_MACRO(conj)
madcowswe 15:9c5aaeda36dc 209
madcowswe 15:9c5aaeda36dc 210 #undef TVMET_IMPLEMENT_MACRO
madcowswe 15:9c5aaeda36dc 211
madcowswe 15:9c5aaeda36dc 212 #endif // defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 213
madcowswe 15:9c5aaeda36dc 214
madcowswe 15:9c5aaeda36dc 215 } // namespace tvmet
madcowswe 15:9c5aaeda36dc 216
madcowswe 15:9c5aaeda36dc 217 #endif // TVMET_MATRIX_UNARY_FUNCTIONS_H
madcowswe 15:9c5aaeda36dc 218
madcowswe 15:9c5aaeda36dc 219 // Local Variables:
madcowswe 15:9c5aaeda36dc 220 // mode:C++
madcowswe 15:9c5aaeda36dc 221 // tab-width:8
madcowswe 15:9c5aaeda36dc 222 // End: