Homepage Demos Overview Downloads Tutorials Reference
Credits

WalkToTargetMachine.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_WalkToTargetMachine_h_
00003 #define INCLUDED_WalkToTargetMachine_h_
00004 
00005 #include "Behaviors/StateNode.h"
00006 #include "Behaviors/Transitions/TimeOutTrans.h"
00007 #include "Behaviors/Transitions/VisualTargetCloseTrans.h"
00008 #include "Motion/MotionManager.h"
00009 
00010 //! a state machine for walking towards a visual target
00011 class WalkToTargetMachine : public StateNode {
00012 public:
00013   //!constructor, pass success (close), failure (lost), and parent nodes, and VisionObjectSourceID_t
00014   WalkToTargetMachine(unsigned int obj,StateNode* c=NULL, StateNode* l=NULL,StateNode* p=NULL)
00015     : StateNode("WalkToTarget",p),tracking(obj),timeout(NULL),closeTrans(NULL),close(c),lost(l),
00016       walker_id(MotionManager::invalid_MC_ID), headpointer_id(MotionManager::invalid_MC_ID) 
00017   {}
00018   
00019   virtual void setup();
00020 
00021   virtual void DoStart();
00022   virtual void DoStop();
00023 
00024   virtual void teardown();
00025 
00026   static std::string getClassDescription() { return "walks towards a visual target until it gets \"close\""; }
00027 
00028   //uses head to watch ball, walks towards it
00029   virtual void processEvent(const EventBase& event);
00030   
00031   virtual Transition* getLostTrans() { return timeout; } //!< returns the transition controlling "lost" designation
00032   virtual Transition* getCloseTrans() { return closeTrans; } //!< returns the transition controlling "close to target" designation
00033 
00034 
00035 protected:
00036   unsigned int tracking; //!< the object being tracked
00037   TimeOutTrans* timeout; //!< transition in case we lose the target
00038   Transition* closeTrans; //!< transition in case we get close
00039   StateNode* close; //!< dest if we get close to the object
00040   StateNode* lost; //!< dest if we get lost
00041   MotionManager::MC_ID walker_id; //!< so we can walk
00042   MotionManager::MC_ID headpointer_id; //!< so we can point the head at the object
00043 
00044 private:
00045   WalkToTargetMachine(const WalkToTargetMachine&); //!< don't call this
00046   WalkToTargetMachine operator=(const WalkToTargetMachine&); //!< don't call this
00047 };
00048 
00049 /*! @file
00050  * @brief Describes WalkToTargetMachine, a state machine for walking towards a visual target
00051  * @author ejt (Creator)
00052  *
00053  * $Author: ejt $
00054  * $Name: tekkotsu-2_0 $
00055  * $Revision: 1.11 $
00056  * $State: Exp $
00057  * $Date: 2004/01/18 10:16:56 $
00058  */
00059 
00060 #endif

Tekkotsu v2.0
Generated Wed Jan 21 03:20:30 2004 by Doxygen 1.3.4