00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <unistd.h> 00004 #include <sys/ioctl.h> 00005 #include <fcntl.h> 00006 #include <signal.h> 00007 00008 #include "cmtdef.h" 00009 #include "xsens_time.h" 00010 #include "xsens_list.h" 00011 #include "cmtscan.h" 00012 #include "cmt3.h" 00013 00014 #include "Component/ModelManager.H" 00015 #include "Component/OptionManager.H" 00016 00017 #include "Component/ModelComponent.H" 00018 #include "Component/ModelParam.H" 00019 #include "Media/FrameSeries.H" 00020 #include "Transport/FrameInfo.H" 00021 #include "Raster/GenericFrame.H" 00022 #include "Image/Image.H" 00023 #include "GUI/XWinManaged.H" 00024 #include "GUI/ImageDisplayStream.H" 00025 #include "Image/Image.H" 00026 #include "Image/Pixels.H" 00027 #include "Robots/RobotBrain/RobotBrainComponent.H" 00028 00029 #include "Ice/RobotBrainObjects.ice.H" 00030 #include "Ice/RobotSimEvents.ice.H" 00031 #include "Ice/IceImageUtils.H" 00032 #include <IceUtil/Thread.h> 00033 00034 #include "Devices/Serial.H" 00035 00036 #ifndef IMUDATASERVER_H 00037 #define IMUDATASERVER_H 00038 00039 class IMUDataServer: public RobotBrainComponent 00040 { 00041 public: 00042 00043 struct Mode 00044 { 00045 const static int quat = 0; 00046 const static int euler = 1; 00047 const static int cos_mat = 2; 00048 }; 00049 //!Constructor 00050 IMUDataServer(int id, OptionManager& mgr, const std::string& descrName = 00051 "BasicBrainComponent", const std::string& tagName = 00052 "BasicBrainComponent"); 00053 00054 //!Destructor 00055 ~IMUDataServer(); 00056 00057 //!Main run loop 00058 virtual void evolve(); 00059 00060 void stop2(); 00061 00062 //!Get a message 00063 virtual void updateMessage(const RobotSimEvents::EventMessagePtr& eMsg, 00064 const Ice::Current&); 00065 00066 //!Component registers itself as publisher/subscriber to topic(s) 00067 virtual void registerTopics(); 00068 00069 bool initMe(); 00070 int doHardwareScan(xsens::Cmt3 &, CmtDeviceId []); 00071 void doMtSettings(xsens::Cmt3 &, CmtOutputMode &, CmtOutputSettings &, CmtDeviceId []); 00072 void getUserInputs(CmtOutputMode &, CmtOutputSettings &); 00073 00074 private: 00075 xsens::Cmt3 cmt3; 00076 CmtDeviceId deviceIds[256]; 00077 00078 CmtOutputMode mode; 00079 CmtOutputSettings settings; 00080 00081 XsensResultValue res; 00082 00083 CmtCalData caldata; 00084 CmtQuat qat_data; 00085 CmtEuler euler_data; 00086 CmtMatrix matrix_data; 00087 RobotSimEvents::IMUDataServerMessagePtr msg; 00088 double tdata; 00089 00090 xsens::Packet * packet; 00091 00092 bool inited; 00093 OModelParam<int> mEnableConfig; 00094 //nub::soft_ref<Serial> itsPort; //!< Serial port to use 00095 }; 00096 00097 #endif