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 * $Id: Identity.h,v 1.4 2006-11-21 18:43:09 opetzold Exp $
madcowswe 15:9c5aaeda36dc 3 */
madcowswe 15:9c5aaeda36dc 4
madcowswe 15:9c5aaeda36dc 5 #ifndef TVMET_XPR_IDENTITY_H
madcowswe 15:9c5aaeda36dc 6 #define TVMET_XPR_IDENTITY_H
madcowswe 15:9c5aaeda36dc 7
madcowswe 15:9c5aaeda36dc 8
madcowswe 15:9c5aaeda36dc 9 namespace tvmet {
madcowswe 15:9c5aaeda36dc 10
madcowswe 15:9c5aaeda36dc 11
madcowswe 15:9c5aaeda36dc 12 /**
madcowswe 15:9c5aaeda36dc 13 * \class XprIdentity Identity.h "tvmet/xpr/Identity.h"
madcowswe 15:9c5aaeda36dc 14 * \brief Expression for the identity matrix.
madcowswe 15:9c5aaeda36dc 15 *
madcowswe 15:9c5aaeda36dc 16 * This expression doesn't hold any other expression, it
madcowswe 15:9c5aaeda36dc 17 * simply returns 1 or 0 depends where the row and column
madcowswe 15:9c5aaeda36dc 18 * element excess is done.
madcowswe 15:9c5aaeda36dc 19 *
madcowswe 15:9c5aaeda36dc 20 * \since release 1.6.0
madcowswe 15:9c5aaeda36dc 21 * \sa identity
madcowswe 15:9c5aaeda36dc 22 */
madcowswe 15:9c5aaeda36dc 23 template<class T, std::size_t Rows, std::size_t Cols>
madcowswe 15:9c5aaeda36dc 24 struct XprIdentity
madcowswe 15:9c5aaeda36dc 25 : public TvmetBase< XprIdentity<T, Rows, Cols> >
madcowswe 15:9c5aaeda36dc 26 {
madcowswe 15:9c5aaeda36dc 27 XprIdentity& operator=(const XprIdentity&);
madcowswe 15:9c5aaeda36dc 28
madcowswe 15:9c5aaeda36dc 29 public:
madcowswe 15:9c5aaeda36dc 30 typedef T value_type;
madcowswe 15:9c5aaeda36dc 31
madcowswe 15:9c5aaeda36dc 32 public:
madcowswe 15:9c5aaeda36dc 33 /** Complexity counter. */
madcowswe 15:9c5aaeda36dc 34 enum {
madcowswe 15:9c5aaeda36dc 35 ops_assign = Rows * Cols,
madcowswe 15:9c5aaeda36dc 36 ops = ops_assign
madcowswe 15:9c5aaeda36dc 37 };
madcowswe 15:9c5aaeda36dc 38
madcowswe 15:9c5aaeda36dc 39 public:
madcowswe 15:9c5aaeda36dc 40 /** access by index. */
madcowswe 15:9c5aaeda36dc 41 value_type operator()(std::size_t i, std::size_t j) const {
madcowswe 15:9c5aaeda36dc 42 return i==j ? 1 : 0;
madcowswe 15:9c5aaeda36dc 43 }
madcowswe 15:9c5aaeda36dc 44
madcowswe 15:9c5aaeda36dc 45 public: // debugging Xpr parse tree
madcowswe 15:9c5aaeda36dc 46 void print_xpr(std::ostream& os, std::size_t l=0) const {
madcowswe 15:9c5aaeda36dc 47 os << IndentLevel(l++)
madcowswe 15:9c5aaeda36dc 48 << "XprIdentity[O="<< ops << ")]<"
madcowswe 15:9c5aaeda36dc 49 << std::endl;
madcowswe 15:9c5aaeda36dc 50 os << IndentLevel(l)
madcowswe 15:9c5aaeda36dc 51 << typeid(T).name() << ","
madcowswe 15:9c5aaeda36dc 52 << "R=" << Rows << ", C=" << Cols << std::endl;
madcowswe 15:9c5aaeda36dc 53 os << IndentLevel(--l) << ">"
madcowswe 15:9c5aaeda36dc 54 << ((l != 0) ? "," : "") << std::endl;
madcowswe 15:9c5aaeda36dc 55 }
madcowswe 15:9c5aaeda36dc 56 };
madcowswe 15:9c5aaeda36dc 57
madcowswe 15:9c5aaeda36dc 58
madcowswe 15:9c5aaeda36dc 59 } // namespace tvmet
madcowswe 15:9c5aaeda36dc 60
madcowswe 15:9c5aaeda36dc 61
madcowswe 15:9c5aaeda36dc 62 #endif // TVMET_XPR_IDENTITY_H
madcowswe 15:9c5aaeda36dc 63
madcowswe 15:9c5aaeda36dc 64
madcowswe 15:9c5aaeda36dc 65 // Local Variables:
madcowswe 15:9c5aaeda36dc 66 // mode:C++
madcowswe 15:9c5aaeda36dc 67 // tab-width:8
madcowswe 15:9c5aaeda36dc 68 // End: