orca-robotics


INTRODUCTION
Overview
Download and Install
Documentation

REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map

DEVELOPER
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

commandhistory.h

00001 #ifndef COMMANDHISTORY_SEGWAYRMP_H
00002 #define COMMANDHISTORY_SEGWAYRMP_H
00003 
00004 #include <sys/types.h>
00005 #include <deque>
00006 #include <string>
00007 
00008 namespace segwayrmpacfr {
00009 
00010 //
00011 // @brief remembers the history of commands sent to the Segway, so
00012 //        we can check that the last command it received was recently sent by us.
00013 //
00014 // @author Alex Brooks
00015 //
00016 class CommandHistory
00017 {
00018 
00019 public: 
00020 
00021     CommandHistory( int historyLength );
00022 
00023     void setCommand( int16_t speed, int16_t turnrate );
00024     void checkReceivedCommandWasRecentlySent( int16_t rxSpeed, int16_t rxTurnrate,
00025                                               bool &speedRecentlySent, bool &turnrateRecentlySent );
00026 
00027     std::string recentlySentSpeeds() const { return dequeAsString( sentSpeeds_ ); }
00028     std::string recentlySentTurnrates() const { return dequeAsString( sentTurnrates_ ); }
00029 
00030 private: 
00031 
00032     std::string dequeAsString( const std::deque<int16_t> &d ) const;
00033 
00034     const int historyLength_;
00035 
00036     std::deque<int16_t> sentSpeeds_;
00037     std::deque<int16_t> sentTurnrates_;
00038 
00039 };
00040 
00041 }
00042 
00043 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5