00001 // 00002 // LD_MRS.hpp 00003 // Device class of the LD-MRS class Laserscanners. 00004 // 00005 #ifndef LDMRS_HPP 00006 #define LDMRS_HPP 00007 00008 #include "../BasicDatatypes.hpp" 00009 #include "BasicDevice.hpp" 00010 #include "../manager.hpp" 00011 00012 //#include "../sopas/SopasBase.hpp" 00013 #include "../sopas/LdmrsSopasLayer.hpp" 00014 #include "LuxBase.hpp" 00015 00016 #include "../interfaces/tcp.hpp" 00017 00018 namespace devices 00019 { 00020 00021 using namespace datatypes; 00022 00023 00024 class LDMRS: public BasicDevice 00025 { 00026 00027 private: 00028 Manager* m_manager; 00029 LdmrsSopasLayer* m_sopas; 00030 LuxBase* m_lux; 00031 00032 bool m_beVerbose; 00033 bool m_isRunning; 00034 00035 // Config data for LDMRS 00036 bool m_weWantScanData; 00037 bool m_weWantFieldData; 00038 bool m_weWantObjectData; 00039 bool m_weWantScanDataFromSopas; 00040 00041 bool m_readOnlyMode; 00042 std::string m_ipAddress; 00043 UINT16 m_luxPortNumber; 00044 UINT16 m_SopasPortNumber; 00045 std::string m_inputFileName; 00046 00047 // Config data for LuxBase 00048 double m_scanFrequency; 00049 double m_scanStartAngle; 00050 double m_scanEndAngle; 00051 double m_offsetX; 00052 double m_offsetY; 00053 double m_offsetZ; 00054 double m_yawAngle; 00055 double m_pitchAngle; 00056 double m_rollAngle; 00057 00058 protected: 00059 void disconnectFunction(); 00060 void onScanReceived(); 00061 00062 public: 00063 LDMRS(Manager* manager); 00064 ~LDMRS(); 00065 00066 // Inherited from device 00067 virtual bool init(); 00068 virtual void shutdown(); 00069 virtual bool run(); 00070 virtual bool stop(); 00071 virtual bool isRunning(); 00072 00073 // returns true if command succeeded. 00074 bool getParameter(MrsParameterId id, UINT32* value); 00075 00076 // returns true if command succeeded. 00077 bool setParameter(MrsParameterId id, UINT32 value); 00078 00079 // Sets the MRS-internal clock to the given time. 00080 bool setNtpTime(UINT32 seconds, UINT32 fractionalSec); 00081 00082 // Sets scan start and end angles. 00083 bool setScanAngles(double startAngle, double endAngle); 00084 00085 // Sets sync angle offset. 00086 bool setSyncAngleOffset(double syncAngle); 00087 00088 // Sets scan frequency. 00089 // valid values are 12.5, 25.0 and 50.0 [Hz]. 00090 bool setScanFrequency(double scanFreq); 00091 00092 std::string getIpAddress(); 00093 00094 void setIpAddress(std::string ipAddress); 00095 00096 void setWeWantObjectData(bool weWantObjectData); 00097 00098 // returns the serial number 00099 std::string getSerialNumber(); 00100 00101 // returns the firmware version 00102 std::string getFirmwareVersion(); 00103 00104 // Function will be called if the scanner loses its tcp connection. 00105 static void disconnectFunctionS(void* obj); 00106 00107 // Function callback to be invoked when a scan was received. 00108 static void onScanReceivedS(void* obj); 00109 00110 // Write a field to the sensor. 00111 bool writeField(UINT16 fieldNum, const FieldParameter& para); 00112 00113 // Write the EvalCases to the sensor. 00114 bool writeEvalCases(const EvalCases& evalCases); 00115 00116 // Stores the SOPAS config data (fields and eval cases) permanently. 00117 bool flashSopasConfig(); 00118 }; 00119 00120 } // namespace devices 00121 00122 #endif // LDMRS_HPP