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 available on Aperios!
00008 #else
00009 #  include "Shared/ProjectInterface.h"
00010 #endif
00011 
00012 //! Requests the next camera frame and sensor data, for use when running in simulation
00013 /*! Note that this won't increment the simulator time if triggered while paused... */
00014 class SimulatorAdvanceFrameControl : public NullControl {
00015 
00016 public:
00017   //! default constructor
00018   SimulatorAdvanceFrameControl()
00019     : NullControl("SimulatorAdvanceFrameControl","Requests the next camera frame and sensor data, for use when running in simulation")
00020   {}
00021   //! constructor which allows a custom name
00022   SimulatorAdvanceFrameControl(const std::string& n)
00023     : NullControl(n,"Requests the next camera frame and sensor data, for use when running in simulation")
00024   {}
00025 
00026   //can't do anything if we're running on aperios
00027 #ifndef PLATFORM_APERIOS
00028 
00029   virtual ControlBase * activate(MotionManager::MC_ID disp_id, Socket * gui) {
00030     ProjectInterface::sendCommand("advance");
00031     return NullControl::activate(disp_id,gui);
00032   }
00033 
00034   virtual std::string getName() const {
00035     if(canManuallyAdvance())
00036       return NullControl::getName();
00037     return "[Auto-Advancing]";
00038   }
00039 
00040   virtual std::string getDescription() const {
00041     if(canManuallyAdvance())
00042       return NullControl::getDescription();
00043     return "Cannot manually advance when in realtime mode, or when AdvanceOnAccess is enabled";
00044   }
00045   
00046 protected:
00047   //! ideally, this should return true only when the simulator is paused or the data source is frozen...
00048   bool canManuallyAdvance() const { return true; }
00049   
00050 #endif
00051 
00052 };
00053 
00054 /*! @file
00055  * @brief Defines SimulatorAdvanceFrameControl, which requests the next camera frame and sensor data, for use when running in simulation
00056  * @author ejt (Creator)
00057  *
00058  * $Author: ejt $
00059  * $Name: tekkotsu-4_0 $
00060  * $Revision: 1.4 $
00061  * $State: Exp $
00062  * $Date: 2007/11/10 22:58:05 $
00063  */
00064 #endif

Tekkotsu v4.0
Generated Thu Nov 22 00:54:55 2007 by Doxygen 1.5.4