00001 #ifndef __PREMOTOR_COMPLEX_H__ 00002 #define __PREMOTOR_COMPLEX_H__ 00003 00004 #include "Component/ModelManager.H" 00005 #include "BeoSub/BeeBrain/PreFrontalCortex.H" 00006 #include "BeoSub/BeeBrain/ActionInput.H" 00007 #include "BeoSub/BeeBrain/ComplexMovement.H" 00008 #include "BeoSub/BeeBrain/AgentManagerA.H" 00009 #include "SeaBee/SubController.H" 00010 00011 #define INVALID -1.0 00012 00013 class AgentManagerA; 00014 class PreFrontalCortexAgent; 00015 00016 00017 class PreMotorComplex { 00018 00019 public: 00020 00021 PreMotorComplex(nub::soft_ref<SubController> motor, /*rutz::shared_ptr<PreFrontalCortexAgent> pfc,*/ std::string name); 00022 PreMotorComplex(std::string name); 00023 ~PreMotorComplex(); 00024 00025 inline void setPreFrontalCortexAgent 00026 (rutz::shared_ptr<PreFrontalCortexAgent> pfc); 00027 00028 00029 //! starts the PreMotorComplex 00030 void start(); 00031 //! stops everything 00032 inline void stop() { itsStop = itsInterrupt = true; } 00033 00034 00035 //! stop all movements. stay at current depth and heading, using PID 00036 inline void msgHalt() { itsInterrupt = true; } 00037 //! run ComplexMovement a, if there is a ComplexMovement already running, 00038 //! will cause interrupt and start new movement 00039 void run(rutz::shared_ptr<ComplexMovement> a); 00040 00041 inline void test() { LINFO("you called me"); } 00042 00043 00044 00045 // world/sensor moves 00046 // turn to a goal absolute angle (heading) 00047 // NOTE: will this be in radians? 00048 void turn(const SensorInput goal); 00049 // move forward/reverse in reference to goal distance (meters) 00050 // forward: positive, reverse: negative 00051 void forward(const SensorInput goal); 00052 // dive/surface to a goal depth in reference to goal depth (meters) 00053 // dive: positive, surface: negative 00054 void dive(const SensorInput goal); 00055 // types of searches 00056 void sweep(const SensorInput goal); 00057 00058 00059 // vision moves 00060 // turn to a goal pixel angle, or turn to a goal pixel point 00061 void vis_turn(const VisionInput& goal); 00062 // move forward/reverse to a goal pixel point 00063 void vis_forward(const VisionInput& goal); 00064 // dive/surface to a goal pixel point 00065 void vis_dive(const VisionInput& goal); 00066 // center on a pixel point 00067 void vis_center(const VisionInput& goal); 00068 // lost image retract search 00069 void vis_lost(const VisionInput& goal); 00070 00071 00072 00073 00074 00075 private: 00076 00077 00078 void run(); 00079 00080 00081 00082 // Angle itsHeading; 00083 // Angle itsPitch; 00084 // Angle itsRoll; 00085 // float itsTemp; 00086 // float itsInternalPressure; 00087 // float itsDepth; 00088 00089 // //possibly its position relative to the pinger; 00090 // Point3D itsAttitude; 00091 00092 rutz::shared_ptr<ComplexMovement> itsCurrentMove; 00093 rutz::shared_ptr<ComplexMovement> itsNextMove; 00094 00095 nub::soft_ref<SubController> itsPrimitiveMotor; 00096 rutz::shared_ptr<PreFrontalCortexAgent> itsCortex; 00097 00098 bool itsInterrupt; 00099 bool itsStop; 00100 std::string itsName; 00101 00102 }; 00103 00104 // ###################################################################### 00105 inline void PreMotorComplex::setPreFrontalCortexAgent 00106 (rutz::shared_ptr<PreFrontalCortexAgent> pfc) 00107 { 00108 itsCortex = pfc; 00109 } 00110 00111 #endif