Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SimulatorAdvanceFrameControl.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_SimulatorAdvanceFrameControl_h
00003 #define INCLUDED_SimulatorAdvanceFrameControl_h
00004 
00005 #include "Behaviors/Controls/NullControl.h"
00006 #ifdef PLATFORM_APERIOS
00007 #  warning SimulatorAdvanceFrameControl is only useful when running in simulation!
00008 #else
00009 #  include "local/sim/Simulator.h"
00010 #endif
00011 
00012 //! Requests the next camera frame and sensor data, for use when running in simulation
00013 /*! There are a number of options regarding control of input data and
00014  *  flow of time.  This is only applicable when using a non-realtime
00015  *  source (such as loading logged data from disk) and the simulator's
00016  *  AdvanceOnAccess is 'false' (this is "advance on request" -- the
00017  *  same data may be accessed multiple times until you manually
00018  *  request the next frame) */
00019 class SimulatorAdvanceFrameControl : public NullControl {
00020 
00021 public:
00022   //! default constructor
00023   SimulatorAdvanceFrameControl()
00024     : NullControl("SimulatorAdvanceFrameControl","Requests the next camera frame and sensor data, for use when running in simulation")
00025   {}
00026   //! constructor which allows a custom name
00027   SimulatorAdvanceFrameControl(const std::string& n)
00028     : NullControl(n,"Requests the next camera frame and sensor data, for use when running in simulation")
00029   {}
00030 
00031   //can't do anything if we're running on aperios
00032 #ifndef PLATFORM_APERIOS
00033 
00034   virtual ControlBase * activate(MotionManager::MC_ID disp_id, Socket * gui) {
00035     Simulator::sendCommand("advance");
00036     return NullControl::activate(disp_id,gui);
00037   }
00038 
00039   virtual std::string getName() const {
00040     if(canManuallyAdvance())
00041       return NullControl::getName();
00042     return "[Auto-Advancing]";
00043   }
00044 
00045   virtual std::string getDescription() const {
00046     if(canManuallyAdvance())
00047       return NullControl::getDescription();
00048     return "Cannot manually advance when in realtime mode, or when AdvanceOnAccess is enabled";
00049   }
00050   
00051 protected:
00052   bool canManuallyAdvance() const { return true; }
00053   
00054 #endif
00055 
00056 };
00057 
00058 /*! @file
00059  * @brief Defines SimulatorAdvanceFrameControl, which requests the next camera frame and sensor data, for use when running in simulation
00060  * @author ejt (Creator)
00061  *
00062  * $Author: ejt $
00063  * $Name: tekkotsu-3_0 $
00064  * $Revision: 1.2 $
00065  * $State: Exp $
00066  * $Date: 2006/08/30 14:26:44 $
00067  */
00068 #endif

Tekkotsu v3.0
Generated Wed Oct 4 00:03:46 2006 by Doxygen 1.4.7