Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

WorldModel2Behavior.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_WorldModel2Behavior_h_
00002 #define INCLUDED_WorldModel2Behavior_h_
00003 
00004 /* @file
00005  * @brief Implements WorldModel2Behavior, a stateful behavior specifically designed to feed data to the second WorldModel.
00006  * Started 13 February 2003, tss
00007  * @author tss (Creator)
00008  */
00009 
00010 #include "Behaviors/StateNode.h"
00011 #include "Motion/MotionManager.h"
00012 #include "WorldModel2/WorldModel2.h"
00013 #include "Motion/MotionSequenceMC.h"
00014 #include "Shared/SharedObject.h"
00015 
00016 //! Implements a stateful behavior specifically designed to feed data to the second WorldModel.
00017 class WorldModel2Behavior : public StateNode {
00018 public:
00019   WorldModel2Behavior();    //!< Constructor
00020   virtual ~WorldModel2Behavior(); // Destructor
00021 
00022   virtual void setup();     //!< Initial setup
00023   virtual void DoStart();   //!< Behavior startup
00024   virtual void DoStop();    //!< Behavior stop
00025 
00026   static std::string getClassDescription() { return "Attempts to build and transmit a spherical depth map and horizontal height map (run MATLAB visualizer to see)"; }
00027 
00028 private:
00029   StateNode *start;     //!< Pointer to the start state
00030   WorldModel2 WM2;      //!< WorldModel2 controller
00031 
00032   //! Crap related to standing up
00033   SharedObject< MotionSequenceMC<MotionSequence::SizeSmall> > standUp;
00034   MotionManager::MC_ID standUp_id; //!< id for the standup
00035   
00036   // Private classes for specific behavior states
00037   //! This one does a random walk
00038   struct WalkNode : public StateNode {
00039     WalkNode(const char *title, StateNode *poppa,
00040        MotionManager::MC_ID su);  //!< Constructor
00041     virtual ~WalkNode();    //!< Destructor
00042 
00043     virtual void processEvent(const EventBase&);  //!< IR obstacle avoidance
00044 
00045     virtual void DoStart();   //!< Behavior startup
00046     virtual void DoStop();    //!< Behavior stop
00047 
00048     MotionManager::MC_ID walker_id; //!< A motion command ID for WalkMC
00049     MotionManager::MC_ID head_id;   //!< A motion command ID for the head
00050     MotionManager::MC_ID stand_id;  //!< A motion command ID for standing up
00051     enum { TURN, AHEAD } walkstate; //!< are we walking forward or turning?
00052 
00053     static const double THR_TURN = 300; //!< obstacle threshold for turning away
00054     static const double THR_AHEAD =600; //!< obstacle threshild for stopping turn
00055   };
00056   //! This one wags the head around
00057   struct GawkNode : public StateNode {
00058     WorldModel2 *WM2ref;    //!< Reference to WM2B's WM2 object
00059 
00060     GawkNode(const char *title, StateNode *poppa,
00061        WorldModel2 *WM,
00062              MotionManager::MC_ID su);  //!< Constructor
00063 
00064     virtual void processEvent(const EventBase&);  //!< Head wag poll timer
00065 
00066     virtual void DoStart();   //!< Behavior startup
00067     virtual void DoStop();    //!< Behavior stop
00068 
00069     MotionManager::MC_ID head_id;   //!< A motion command ID for the head
00070     MotionManager::MC_ID stand_id;  //!< A motion command ID for standing up
00071 
00072     // to avoid warnings
00073     GawkNode(const WorldModel2Behavior::GawkNode&); //!< don't call
00074     GawkNode operator=(const WorldModel2Behavior::GawkNode&); //!< don't call
00075   };
00076   //! This one lets the AIBO have a reflective pause
00077   struct WaitNode : public StateNode {
00078     WaitNode(const char *title, StateNode *poppa,
00079        MotionManager::MC_ID su);  //!< Constructor
00080 
00081     virtual void DoStart();   //!< Behavior startup
00082     virtual void DoStop();    //!< Behavior stop
00083 
00084     MotionManager::MC_ID head_id;   //!< A motion command ID for the head
00085     MotionManager::MC_ID stand_id;  //!< A motion command ID for standing up
00086   };
00087 
00088   // to avoid warnings:
00089   WorldModel2Behavior(const WorldModel2Behavior&); //!< don't call
00090   WorldModel2Behavior operator=(const WorldModel2Behavior&); //!< don't call
00091 };
00092 
00093 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:32 2003 by Doxygen 1.3.2