urgSimulator.h

Go to the documentation of this file.
00001 #ifndef URG_SIMULATOR_H
00002 #define URG_SIMULATOR_H
00003 
00013 #include "taskInterface.h"
00014 //#include "delaiedTcpipDevice.h"
00015 #include "tcpipServer.h"
00016 #include "coordinateCtrl.h"
00017 #include <list>
00018 
00019 class URGCtrl;
00020 
00021 
00027 class URG_Simulator : public TaskInterface {
00028   TcpipServer* server;
00029   class ScanInfo {
00030   public:
00031     ScanInfo(void);
00032     ~ScanInfo(void);
00033     TcpipDevice* con;
00034     URGCtrl* obj;
00035     int pre_index;
00036     unsigned long raw_timestamp;
00037     long length[1024];
00038     bool cmd_handled;
00039     bool now_timeAdjustMode;
00040   };
00041   URGCtrl* pre_registered;
00042   std::list<ScanInfo*> sim_urgs;
00043   bool enable_timestamp;
00044 
00045   typedef CoordinateCtrl::polygon_t crd_polygon_t;
00046   std::vector<crd_polygon_t> env_polygons;
00047 
00048   void urgDeviceResponse(URG_Simulator::ScanInfo& urg);
00049   void urgDeviceSimulator(URG_Simulator::ScanInfo& urg,
00050                           unsigned long total_msec);
00051   bool checkCmdLength(TcpipDevice* con, int require_size);
00052   void replyVersionInfo(URG_Simulator::ScanInfo& urg);
00053   void replyAdjustTimestamp(URG_Simulator::ScanInfo& urg);
00054   void replyDataRequest(URG_Simulator::ScanInfo& urg);
00055   char decodeByte(char ch);
00056   void judgeSenseArea(URG_Simulator::ScanInfo& urg, bool isHandstand,
00057                       int from_index, int to_index);
00058 
00059 public:
00060   URG_Simulator(void);
00061   ~URG_Simulator(void);
00062   void init(void);
00063   void recv(void);
00064   void exec1msec(unsigned long total_msec);
00065   void send(void) {}
00066   bool updatePosition(void) { return false; }
00067   VXV::Position3D getBodyPosition(const VXV::Position3D& position) {
00068     return VXV::Position3D();
00069   }
00070 
00076   void setURGObject(URGCtrl* urg_obj);
00077 
00083   void setURGType(const char* type);
00084 
00088   void setEnvironment(const std::vector<crd_polygon_t>& objs);
00089 };
00090 
00091 #endif /* !URG_SIMULATOR_H */
00092 

Generated on Mon Apr 13 22:52:03 2009 by  doxygen 1.5.7.1