Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Aibo3DControllerBehavior.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_Aibo3DControllerBehavior_h_
00003 #define INCLUDED_Aibo3DControllerBehavior_h_
00004 
00005 #include <iostream>
00006 #include "Wireless/Wireless.h"
00007 #include "Behaviors/BehaviorBase.h"
00008 #include "Motion/MotionManager.h"
00009 #include "Motion/RemoteControllerMC.h"
00010 #include "Events/EventRouter.h"
00011 #include "Events/EventBase.h"
00012 #include "Shared/RobotInfo.h"
00013 #include "Behaviors/Controller.h"
00014 #include "Shared/WorldState.h"
00015 
00016 
00017 class BehaviorSwitchControlBase;
00018 class Aibo3DControllerBehavior;
00019 
00020 //! Listens to aibo3d control commands coming in from the command port.
00021 class Aibo3DControllerBehavior : public BehaviorBase {
00022  private:
00023   Aibo3DControllerBehavior(const Aibo3DControllerBehavior&); //!< don't call
00024   Aibo3DControllerBehavior operator=(const Aibo3DControllerBehavior&); //!< don't call
00025   //! so we can start the serializer behavior if it's not already running
00026   static BehaviorSwitchControlBase* stateSerializerControl;
00027   //! if true, indicates we launched the WorldState serializer, so we should stop it again if we stop
00028   bool launchedSerializer;
00029   
00030  public:
00031   //! constructor
00032   Aibo3DControllerBehavior() : BehaviorBase("Aibo3DControllerBehavior"),launchedSerializer(false) { }
00033   //! destructor
00034   virtual ~Aibo3DControllerBehavior() { }
00035 
00036   virtual void DoStart();
00037   virtual void DoStop();
00038   
00039   //! returns string corresponding to the Java GUI which should be launched
00040   virtual std::string getGUIType() const { return "org.tekkotsu.aibo3d.Aibo3D"; }
00041   //! returns port number the Java GUI should connect to
00042   virtual unsigned int getPort() const { return config->main.wsjoints_port; }
00043 
00044   static std::string getClassDescription() { 
00045     return "Launches a WorldStateSerializer and asks gui to load Aibo3D GUI";
00046     //char tmp[20];
00047     //sprintf(tmp,"%d",config->main.aibo3d_port);
00048     //return std::string("Listens to aibo3d control commands coming in from port ")+tmp;
00049   }
00050   virtual std::string getDescription() const { return getClassDescription(); }
00051 
00052   //! sets the BehaviorSwitchControlBase which should be used to activate the serialization of WorldState data for the Aibo3D client to read
00053   static void setSerializerControl(BehaviorSwitchControlBase* ctrl) { stateSerializerControl=ctrl; }
00054 };
00055 
00056 /*! @file
00057  * @brief Defines Aibo3DControllerBehavior, which listens to commands from the Aibo3D gui and shows current state
00058  * @author alokl (Creator)
00059  *
00060  * $Author: ejt $
00061  * $Name: tekkotsu-4_0 $
00062  * $Revision: 1.9 $
00063  * $State: Exp $
00064  * $Date: 2006/09/16 06:28:07 $
00065  */
00066 
00067 #endif 

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