Movement.H

00001 #ifndef __MOVEMENT_AGENT_H__
00002 #define __MOVEMENT_AGENT_H__
00003 
00004 #include "Captain.H"
00005 #include "AgentManager.H"
00006 #include "SubController.H"
00007 #include "SubmarineAgent.H"
00008 #include "Point3D.H"
00009 
00010 class AgentManager;
00011 class CaptainAgent;
00012 
00013 class MovementAgent : public SubmarineAgent
00014 {
00015 
00016 public:
00017 
00018   MovementAgent(OptionManager& mgr,
00019                 nub::soft_ref<AgentManager> ama,
00020                 nub::soft_ref<SubController> subController,
00021                 const std::string& name = "MovementAgent");
00022 
00023 
00024   ~MovementAgent();
00025 
00026   inline void setCaptainAgent
00027   (nub::soft_ref<CaptainAgent> pfc);
00028 
00029 private:
00030 
00031   bool pickAndExecuteAnAction();
00032 
00033 
00034   bool dive(int depth, bool relative = false, int timeout = 0);
00035 
00036   bool goStraight(int speed, int time);
00037 
00038   bool setHeading(int heading, bool relative = false, int timeout = 0);
00039 
00040   int trackPipe(const Point2D<int>& pointToTrack, const Point2D<int>& desiredPoint);
00041 
00042   void paramChanged(ModelParamBase* const param,
00043                     const bool valueChanged,
00044                     ParamClient::ChangeStatus* status);
00045 
00046   NModelParam<int>  itsDepthErrThresh;
00047   NModelParam<int>  itsHeadingErrThresh;
00048 
00049   NModelParam<float> pipeP;
00050   NModelParam<float> pipeI;
00051   NModelParam<float> pipeD;
00052   PID<float> itsPipePID;
00053 
00054   NModelParam<int>  setDiveValue;
00055   NModelParam<int>  setGoStraightTimeValue;
00056   NModelParam<int>  setSpeedValue;
00057   NModelParam<int>  setHeadingValue;
00058   NModelParam<bool>  setRelative;
00059   NModelParam<int>  setTimeout;
00060 
00061   nub::soft_ref<SubController> itsSubController;
00062   nub::soft_ref<CaptainAgent> itsCaptainAgent;
00063   nub::soft_ref<AgentManager> itsAgentManager;
00064 
00065   uint itsFrameNumber;
00066 
00067   rutz::shared_ptr<Timer> itsTimer;
00068 
00069 };
00070 
00071 
00072 // ######################################################################
00073 inline void MovementAgent::setCaptainAgent
00074 (nub::soft_ref<CaptainAgent> ca)
00075 {
00076   itsCaptainAgent = ca;
00077 }
00078 
00079 #endif
Generated on Sun May 8 08:42:14 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3