00001 #ifndef T_RUN_CTRL_SIMULATOR_H 00002 #define T_RUN_CTRL_SIMULATOR_H 00003 00013 #include "taskInterface.h" 00014 #include "nodeAccess.h" 00015 #include "structTables.h" 00016 #include "tcpipServer.h" 00017 //#include "delaiedTcpipDevice.h" 00018 #include "ticksPositionInterface.h" 00019 #include <deque> 00020 00021 00025 class tRunCtrl_Simulator : public TaskInterface { 00026 friend class mRunCtrl; 00027 00028 enum { SciPort = 0 }; 00029 TcpipServer* server; 00030 //DelaiedTcpipDevice* con; 00031 TcpipDevice* con; 00032 nodeInfo_t node; 00033 runCtrl_t tbl; 00034 00035 class TicksPosition : public VXV::TicksPositionInterface { 00036 friend class tRunCtrl_Simulator; 00037 friend class mRunCtrl; 00038 00039 std::deque<VXV::Position3D> pos_deque; 00040 unsigned long first_ticks; 00041 unsigned long offset_length; 00042 long ticksDiff; 00043 void add(const VXV::Position3D& pos, unsigned long total_msec); 00044 void adjustOwnTicks(unsigned long setTicks, unsigned long ticks); 00045 unsigned long adjustTicksDiff(unsigned long ticks) const; 00046 00047 public: 00048 TicksPosition(void); 00049 ~TicksPosition(void); 00050 VXV::Position3D getPosition(unsigned long ticks) const; 00051 void clear(void); 00052 void set_dataLength(unsigned long msec); 00053 }; 00054 TicksPosition ticksPos; 00055 00056 public: 00057 tRunCtrl_Simulator(void); 00058 ~tRunCtrl_Simulator(void); 00059 void init(void); 00060 void recv(void); 00061 void exec1msec(unsigned long total_msec); 00062 void send(void) {} 00063 bool updatePosition(void); 00064 00070 void setLocalPosition(const VXV::Position3D& position); 00071 VXV::Position3D getBodyPosition(const VXV::Position3D& position); 00072 }; 00073 00074 #endif /* !T_RUN_CTRL_SIMULATOR_H */ 00075