Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
WallTestBehavior.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_WallTestBehavior_h_ 00003 #define INCLUDED_WallTestBehavior_h_ 00004 00005 #include "Behaviors/BehaviorBase.h" 00006 #include <vector> 00007 00008 namespace NEWMAT { 00009 class Matrix; 00010 class ColumnVector; 00011 }; 00012 00013 //! measures the relative angle of any walls to the front, left, or right 00014 /*! Making a special cameo appearance in solve1() and solve2(), linear least squares solution using newmat library */ 00015 class WallTestBehavior : public BehaviorBase { 00016 public: 00017 //! constructor 00018 WallTestBehavior() : BehaviorBase("WallTestBehavior"), d(), a(), usedNear() {} 00019 00020 virtual void DoStart(); 00021 virtual void DoStop(); 00022 virtual void processEvent(const EventBase& e); 00023 00024 //! Takes a series of measurements, returns slope and intercept of linear least square fit (use QR) 00025 /*! Uses QR factorization to solve \f$ax+b=y\f$ where we know @e x and @e y, and solve for @e a and @e b */ 00026 void solve1(const std::vector<float>& x, const std::vector<float>& y, float& x0, float& x1); 00027 //! Takes a series of measurements, returns slope and intercept of linear least square fit (uses SVD) 00028 /*! Uses SVD factorization to solve \f$ax+by=1\f$ where we know @e x and @e y, and solve for @e a and @e b */ 00029 void solve2(const std::vector<float>& x, const std::vector<float>& y, float& x0, float& x1); 00030 00031 static std::string getClassDescription() { return "Measures the relative angle of surrounding walls"; } 00032 virtual std::string getDescription() const { return getClassDescription(); } 00033 00034 protected: 00035 std::vector<float> d; //!< log of distance measurement for each sample 00036 std::vector<float> a; //!< log of head angle for each sample 00037 std::vector<bool> usedNear; //!< only used with ERS-7, records whether the sample is from near or far IR sensor 00038 00039 static const unsigned int reposTime=750; //!< time to stand up 00040 static const unsigned int panTime=3000; //!< time for actual panning 00041 static const unsigned int lagTime=128; //!< time between when the panning is supposed to get to extremes and when it actually does 00042 }; 00043 00044 /*! @file 00045 * @brief Defines WallTestBehavior, which measures the relative angle of any walls to the front, left, or right 00046 * @author ejt (Creator) 00047 * 00048 * $Author: ejt $ 00049 * $Name: tekkotsu-2_2_1 $ 00050 * $Revision: 1.4 $ 00051 * $State: Exp $ 00052 * $Date: 2004/11/16 00:11:46 $ 00053 */ 00054 00055 #endif |
Tekkotsu v2.2.1 |
Generated Tue Nov 23 16:36:41 2004 by Doxygen 1.3.9.1 |