Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Main.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_Main_h_
00003 #define INCLUDED_Main_h_
00004 
00005 #include "Process.h"
00006 #include "sim.h"
00007 #include "IPC/SharedObject.h"
00008 #include "SharedGlobals.h"
00009 #include "Motion/MotionManager.h"
00010 #include "Sound/SoundManager.h"
00011 #include "local/EntryPoint.h"
00012 #include "Vision/BufferedImageGenerator.h"
00013 #include "Shared/Profiler.h"
00014 #include "Events/EventListener.h"
00015 #include "Shared/WorldState.h"
00016 
00017 class Main : public Process, public virtual EventListener {
00018 public:
00019   //! constructor
00020   Main();
00021   //! destructor
00022   ~Main();
00023 
00024   virtual void doStart();
00025   virtual void run();
00026   virtual void doStop();
00027   
00028   //! listens for a sensor update event, then calls SharedGlobals::signalHaveSensors()
00029   virtual void processEvent(const EventBase& event);
00030 
00031   static const char* getClassName() { return "Main"; }
00032   static ProcessID::ProcessID_t getID() { return ProcessID::MainProcess; }
00033   
00034   static const char * getEventsID() { return "MainEvents"; }
00035   
00036 protected:
00037   SharedObject<sim::SoundPlayQueue_t> sounds;
00038   SharedObject<sim::MotionCommandQueue_t> motions;
00039   SharedObject<sim::EventQueue_t> events;
00040   SharedObject<sim::CameraQueue_t> cameraFrames;
00041   SharedObject<sim::SensorQueue_t> sensorFrames;
00042   SharedObject<sim::TimerWakeup_t> timerWakeup;
00043   SharedObject<sim::StatusRequest_t> statusRequest;
00044   SharedObject<MotionManager> motionmanager;
00045   SharedObject<SoundManager> soundmanager;
00046   SharedObject<motionProfiler_t> motionProf;
00047   SharedObject<soundProfiler_t> soundProf;
00048   
00049   class MessageReceiver * visrecv;
00050   class MessageReceiver * sensrecv;
00051   class MessageReceiver * evtrecv;
00052   class MessageReceiver * timerrecv;
00053   class MessageReceiver * statusrecv;
00054   class TimerExecThread * timerExec;
00055   bool visionRead;
00056   WirelessThread wireless_thread;
00057   WorldState worldStateCache; //!< used for temporary storage when parsing sensor frames, allocation here avoids rather costly constructor call on every sensor frame
00058   EntryPoint behaviorLock;
00059 
00060   static bool gotCamera(RCRegion* msg);
00061   static bool gotSensors(RCRegion* msg);
00062   static bool gotEvent(RCRegion* msg);
00063   static bool gotTimer(RCRegion* msg);
00064   void gotThreadedEvent(EventBase* evt);
00065   
00066   RCRegion * curimgregion;
00067   BufferedImageGenerator::ImageSource img; //!< root data source for vision stream, references data in #curimgregion
00068   unsigned int lastVisionSN; //!< serial number of last camera frame, just so we can give warning message when we drop (if verbose is set)
00069   
00070 private:
00071   Main(const Main&); //!< don't call (copy constructor)
00072   Main& operator=(const Main&); //!< don't call (assignment operator)
00073 };
00074 
00075 /*! @file
00076  * @brief Defines Main, which DESCRIPTION
00077  * @author ejt (Creator)
00078  */
00079 
00080 #endif

Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:38 2016 by Doxygen 1.6.3