$search
00001 /* 00002 * Copyright (c) 2010, Bosch LLC 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 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of Bosch LLC nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 //\Author Lukas Marti, Bosch LLC 00031 00032 #ifndef __BMA180_CALIBRATE__ 00033 #define __BMA180_CALIBRATE__ 00034 00035 #include <bma180/bma180meas.h> 00036 #include <bma180/bma180.h> 00037 00038 namespace bma180_spec { 00039 const static double std_acc_g = 0.02; //[g] measured on the actual sensor 00040 const static double outlier_sigma = 2; //consdiering 3 sigma rule for outlier 00041 const static int calib_varreduct = 100; //calibartion accuracy -> variance red = num of calib samples 00042 }; 00043 00045 00049 class bma180_calibrate 00050 { 00051 public: 00053 00057 bma180_calibrate (); 00058 00060 ~bma180_calibrate (); 00061 00063 00070 bool setdata_bma180 (struct OneBma180Meas); 00071 00073 00080 void setcalibsens (struct OneBma180Meas); 00081 00083 00086 void clearcalibsens (); 00087 00089 00092 bool calibsens_completed (); 00093 00095 00098 bool verification_completed (); 00099 00101 00108 bool verification_active (); 00109 00111 00114 bool calibsens_set (); 00115 00117 00120 bool get_estbiases (double*, double*, double*); 00121 bool biasverify (); 00122 bool get_verifiedbiases (double*, double*, double*); 00123 00124 private: 00125 struct SensID { 00126 std::string Sub20ID; 00127 int iChipSelect; 00128 }; 00129 struct OneCalibDataSet { 00130 SensID Sensor_ID; 00131 ros::Time AgeOfBias; //contains the time stamp of the last calibration measurement 00132 double dBias_AccX; 00133 double dBias_AccY; 00134 double dBias_AccZ; 00135 int iNumOfCalibMeas; 00136 bool bCalib_complete; 00137 bool bCalibsensID_set; 00138 }; 00139 OneCalibDataSet CalibSensor[2]; //2 array of 0: primary calibration, 1: calibration verification 00140 short int iActiveDataIndex; 00141 bool bVerification_activated; 00142 }; // class 00143 00144 #endif