#ifndef INCLUDED_SimpleSoccer_h_ #define INCLUDED_SimpleSoccer_h_ #include "Behaviors/BehaviorBase.h" #include "Motion/MotionManager.h" #include "Behaviors/Controls/FileBrowserControl.h" #include "Motion/MotionSequenceMC.h" #include "Motion/EmergencyStopMC.h" #include "Motion/LedMC.h" #include "SoundPlay/SoundManager.h" #include "Motion/MMAccessor.h" #include "Shared/TimeET.h" #include "Shared/Config.h" #include //various player types const int GOALIE_ID = 0; //const Goalie const int ATTACKER_ID = 10;//conts Attacker Drop Chest const int ATTACKER_ID2 = 11;//conts Attacker Head Butt //desired area of ball to trigger action const float GOALIE_DESIRED_AREA = 0.03491717; //const Goalie const float ATTACKER_DESIRED_AREA = 0.3;//conts Attacker //const float ATTACKER_DESIRED_AREA = 0.02091717;//conts Attacker //const float ATTACKER_DESIRED_AREA = 0.02991717;//conts Attacker const float ATTACKER_DESIRED_AREA2 = 0.02491717;//conts Attacker //various play modes const int PLAY_PAUSED = 0; const int PLAY_PLAY = 10; const int PLAY_LOOK_FOR_BALL = 30; const int PLAY_GO_TO_BALL = 40; const int PLAY_NEAR_BALL = 50; const int PLAY_NEAR_BALL_FIND_GOAL = 50; const int PLAY_BALL_GOAL_INLINE = 60; const int bDEBUG = false; //timer modes const int TIMER_OFF = 0; const int TIMER_ON = 1; //! A simple behavior to chase after any objects seen by the vision system class SimpleSoccer : public BehaviorBase { public: //!constructor SimpleSoccer() : BehaviorBase("SimpleSoccer"), headpointer_id(MotionManager::invalid_MC_ID), walker_id(MotionManager::invalid_MC_ID), HBtn(EventBase::buttonEGID,HeadButOffset,EventBase::activateETID) { sndman->PlayFile("SoccerPr.wav"); //goto standing position OK, but did not keep head up... SharedObject p("/ms/data/motion/pounce.pos"); motman->addPrunableMotion(p); //SharedObject p("/ms/data/motion/stand.mot"); //motman->addMotion(p); } //!destructor virtual ~SimpleSoccer() {} //! adds a headpointer and a walker, and a listens for vision events virtual void DoStart(); //! removes motion commands and stops listening virtual void DoStop(); //! sets the head to point at the object and sets the body to move where the head points virtual void processEvent(const EventBase& event); static std::string getClassDescription() { return "Follows ball with head and walks whereever the head is pointing"; } virtual std::string getDescription() const { return getClassDescription(); } protected: int player_type; //PlayerType float previous_area; //previous Area float desired_area; float MyDi;//diameter float prior_di; int play_mode; int prior_mode; int timer_mode; int timer_counter;//used to count iterations of the timer. int AreaCounter; int PrevAreaCounter; bool motion_waiting; EventBase HBtn; MotionManager::MC_ID headpointer_id; //!< a HeadPointerMC object MotionManager::MC_ID walker_id; //!< a WalkMC object }; #endif