orca-robotics


INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

REPOSITORY
Interfaces
Components
Libraries
Utilities
Software Map

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard
Wiki
login/pass: orca/orca

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

segwayrmp/stats.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2008 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     // The stats collected so far will not be lost.
00033     void resetRawData();
00034 
00035     // Add new piece of data to stats
00036     void addData( const hydrointerfaces::SegwayRmp::Data& data );
00037 
00038     // total distance travelled [m]
00039     double distance() const { return distance_; };
00040     // total time while in motion [m/s]
00041     double timeInMotion() const { return timeInMotion_; };
00042     // maximum (forward) speed [m/s]
00043     double maxSpeed() const { return maxSpeed_; };
00044 
00045 private: 
00046     // keep record of raw data
00047     hydrointerfaces::SegwayRmp::Data lastData_;
00048     bool haveData_;
00049     
00050     // stats
00051     double distance_;
00052     double timeInMotion_;
00053     double maxSpeed_;
00054 };
00055 
00056 } // namespace
00057 
00058 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5