INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
segwayrmp/stats.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef SEGWAYRMP_STATS_H 00012 #define SEGWAYRMP_STATS_H 00013 00014 #include <hydrointerfaces/segwayrmp.h> 00015 00016 namespace segwayrmp { 00017 00018 00019 /* 00020 Not thread safe. 00021 00022 @author Alex Makarenko, based on earlier code by Duncan Mercer 00023 */ 00024 class Stats 00025 { 00026 00027 public: 00028 Stats(); 00029 00030 // The raw data stream may be reset during the life time of Stats object. 00031 // This happens for example when the hardware driver is reinitialized. 00032 // We need to know, or the robot will appear to have teleported. 00033 // The stats collected so far will not be lost. 00034 void resetRawData(); 00035 00036 // Add new piece of data to stats 00037 void addData( const hydrointerfaces::SegwayRmp::Data& data ); 00038 00039 // currently, there's a natural initalization of all historical data 00040 // even in the absence of incoming data. 00041 bool isValid() { return true; } 00042 00043 // total distance travelled [m] 00044 double distance() const { return distance_; }; 00045 // total time while in motion [s] 00046 double timeInMotion() const { return timeInMotion_; }; 00047 // maximum (forward) speed [m/s] 00048 double maxSpeed() const { return maxSpeed_; }; 00049 00050 private: 00051 // keep record of raw data 00052 hydrointerfaces::SegwayRmp::Data lastData_; 00053 bool haveData_; 00054 00055 // stats 00056 double distance_; 00057 double timeInMotion_; 00058 double maxSpeed_; 00059 }; 00060 00061 } // namespace 00062 00063 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)