00001 #include "Component/ModelComponent.H" 00002 #include "Component/ModelParam.H" 00003 #include "Robots/RobotBrain/RobotBrainComponent.H" 00004 00005 #include "Ice/RobotBrainObjects.ice.H" 00006 #include "Ice/RobotSimEvents.ice.H" 00007 #include "Ice/IceImageUtils.H" 00008 #include "Util/Timer.H" 00009 00010 #include <IceUtil/Thread.h> 00011 00012 00013 #ifndef WAYPOINTCONTROLLERI_H 00014 #define WAYPOINTCONTROLLERI_H 00015 00016 class WaypointControllerI : public RobotBrainComponent 00017 { 00018 public: 00019 00020 WaypointControllerI(OptionManager& mgr, 00021 const std::string& descrName = "WaypointController", 00022 const std::string& tagName = "WaypointController"); 00023 00024 void evolve(); 00025 00026 //!Get a message 00027 void updateMessage(const RobotSimEvents::EventMessagePtr& eMsg, 00028 const Ice::Current&); 00029 00030 void registerTopics(); 00031 00032 // The various possible sources for waypoints to follow 00033 enum WaypointSource { BUOY, BIN, PATH, PINGER, NAV }; 00034 00035 struct Waypoint 00036 { 00037 int heading; 00038 int depth; 00039 int speed; 00040 Timer lastUpdate; // the last time the waypoint recieved update 00041 }; 00042 00043 private: 00044 void sendHeadingUpdate(int heading); 00045 void sendDepthUpdate(int depth); 00046 void sendSpeedUpdate(int speed); 00047 void sendThrusterUpdate(string thruster, int val); 00048 00049 int itsCurrentHeading, itsCurrentDepth; 00050 int itsImgWidth, itsImgHeight; 00051 WaypointSource itsWaypointSource; 00052 Waypoint itsNavigationWaypoint, itsTrackingWaypoint; 00053 00054 Timer itsBuoyTimer; 00055 00056 }; 00057 00058 #endif 00059