Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
00001 //-*-c++-*- 00002 #ifndef INCLUDED_StartupBehavior_h_ 00003 #define INCLUDED_StartupBehavior_h_ 00004 #include "Behaviors/BehaviorBase.h" 00005 #include "Motion/MotionManager.h" 00006 #include <vector> 00007 #include <stack> 00008 00009 class Controller; // defined in Controller.h, don't actually need header file yet 00010 class ControlBase; // defined in ControlBase.h, don't actually need header file yet 00011 00012 //! This Behavior is the only hardcoded behavior by the framework to start up once all the data structures and such are set up 00013 00014 /*! This is done by assigning an instance of StartupBehavior to the 00015 * global ::startupBehavior variable. Note that there's nothing 00016 * special about the type of this class, it's just another 00017 * BehaviorBase - ::startupBehavior could be any behavior. If you 00018 * want some other behavior to run automatically at startup, simply 00019 * remove StartupBehavior from the project and assign an instance of 00020 * your own class to ::startupBehavior instead. 00021 * 00022 * By default, this behavior is similar in idea to the init process 00023 * in unix/linux. */ 00024 class StartupBehavior : public BehaviorBase { 00025 public: 00026 //! Constructor 00027 StartupBehavior(); 00028 //! Destructor 00029 virtual ~StartupBehavior(); 00030 00031 //! @name Inherited 00032 virtual void DoStart(); 00033 virtual void DoStop(); 00034 virtual void processEvent(const EventBase&); 00035 virtual std::string getName() const { return "StartupBehavior"; } 00036 static std::string getClassDescription() { return "The initial behavior, when run, sets up everything else"; } 00037 //@} 00038 protected: 00039 //! Initializes the Controller menu structure - calls each of the other Setup functions in turn 00040 /*! Also adds Shutdown and Help items at the end */ 00041 virtual ControlBase* SetupMenus(); 00042 00043 virtual ControlBase* SetupModeSwitch(); //!< sets up Mode Switch menu 00044 virtual ControlBase* SetupBackgroundBehaviors(); //!< sets up Background Behaviors menu 00045 virtual ControlBase* SetupTekkotsuMon(); //!< sets up TekkotsuMon menu 00046 virtual ControlBase* SetupStatusReports(); //!< sets up Status Reports menu 00047 virtual ControlBase* SetupFileAccess(); //!< sets up File Access menu 00048 virtual ControlBase* SetupWalkEdit(); //!< sets up Walk Editing menus (contributed by PGSS 2003 team project - see StartupBehavior_SetupWalkEdit.cc ) 00049 virtual ControlBase* SetupVision(); //!< sets up the Vision menu 00050 00051 virtual void initVision(); //!< Sets up the vision pipelines (held in StartupBehavior_SetupVision.cc) 00052 00053 virtual void startSubMenu(); //!< future calls to addItem() will be placed under the most recently added item 00054 virtual void addItem(ControlBase * control); //!< inserts a control at the end of the menu 00055 virtual ControlBase* endSubMenu(); //!< closes out a submenu so that future calls to addItem() will be added to the enclosing menu, returns the menu being closed out 00056 00057 std::vector<BehaviorBase*> spawned; //!< Behaviors spawned from DoStart, so they can automatically be stopped on DoStop 00058 std::stack<ControlBase*> setup; //!< only used during setup - easier than passing it around all the functions 00059 MotionManager::MC_ID stop_id; //!< the main EmergencyStopMC 00060 MotionManager::MC_ID pid_id; //!< used to fade in the PIDs up to full strength (from initial zero) This is so the joints don't jerk on startup. 00061 }; 00062 00063 extern BehaviorBase& startupBehavior; 00064 00065 #endif
Tekkotsu v2.0 |
Generated Wed Jan 21 03:20:30 2004 by Doxygen 1.3.4 |