Changeset 104 in pacpussensors
- Timestamp:
- Nov 22, 2015, 11:00:29 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Sick/SickLDMRSData.h
r71 r104 17 17 #include "Pacpus/kernel/cstdint.h" 18 18 #include "Pacpus/kernel/road_time.h" 19 #include <QVector> 19 20 20 21 // Export macro for SickLDMRS DLL for Windows only … … 83 84 uint64_t endNtpTime; //!< NTP time last measurement 84 85 uint16_t ticksPerRot; //!< Angle ticks per rotation (used to compute the real angle of a point) 85 int16_t startAngle; //!< Angle of the first measured value86 int16_t endAngle; //!< Angle of the last measured value86 int16_t startAngle; //!< Angle of the first measured value 87 int16_t endAngle; //!< Angle of the last measured value 87 88 uint16_t numPoints; //!< Number of scanned points during this scan @see ScanPoint 88 89 … … 124 125 * Data type 0x2221 @see DataHeader 125 126 */ 127 126 128 struct SICKLDMRS_API ScanObject{ 127 129 // TODO … … 136 138 typedef struct 137 139 { 138 uint64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor).140 uint64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor). 139 141 ScanHeader hScan; //!< General information about points recorded. @see ScanHeader 140 142 road_time_t time; //!< DBT timestamp. … … 142 144 int32_t dataPos; //!< The position of the data in the binary file associated to the dbt file (utc file). 143 145 } SickLDMRS_dbt; 146 147 /*! 148 * \brief The Sick LDMRS scan struct 149 * 150 * Used to describe one complete scan 151 * @see DataHeader 152 */ 153 struct SICKLDMRS_API SickLDMRSScan{ 154 uint64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor). 155 ScanHeader header; //!< General information about points recorded. 156 QVector<ScanPoint> points; //!< Scan point cloud 157 road_time_t time; //!< DBT timestamp. 158 road_timerange_t timerange; //!< DBT timerange. 159 }; 144 160 145 161 #ifdef SICKLDMRS_SH_MEM -
trunk/StdDbtPlayerComponents/DbtPlySickLDMRSManager.cpp
r74 r104 35 35 static const char * kSickMemoryName = "sickLDMRS"; 36 36 37 ////////////////////////////////////////////////////////////////////////// 38 /// Constructor. 37 /************************************************************************ 38 * Constructor 39 ************************************************************************/ 39 40 DbtPlySickLDMRSManager::DbtPlySickLDMRSManager(QString name) 40 41 : DbtPlyFileManager(name) 41 42 { 42 43 LOG_TRACE("constructor(" << name << ")"); 43 44 // mShMem = new ShMem(kAlaskaMemoryName, sizeof(ScanSickData));45 44 } 46 45 47 ////////////////////////////////////////////////////////////////////////// 48 /// Destructor. 46 /************************************************************************ 47 * Destructor 48 ************************************************************************/ 49 49 DbtPlySickLDMRSManager::~DbtPlySickLDMRSManager() 50 50 { 51 51 LOG_TRACE("destructor"); 52 // delete mShMem;53 52 } 54 53 55 ////////////////////////////////////////////////////////////////////////// 56 /// Configure the component. 54 /************************************************************************ 55 * Configuration of the component, called by the ComponentManager after 56 * the construction of the object 57 ************************************************************************/ 57 58 ComponentBase::COMPONENT_CONFIGURATION DbtPlySickLDMRSManager::configureComponent(XmlComponentConfig config) 58 59 { … … 64 65 } 65 66 66 ////////////////////////////////////////////////////////////////////////// 67 /// Starts the component. 67 /************************************************************************ 68 * Start function, called by the ComponentManager when a start() 69 * command is received 70 ************************************************************************/ 68 71 void DbtPlySickLDMRSManager::startActivity() 69 72 { 70 // QString dataDir = mEngine->getDataDir();71 72 // for (int i = 0; i < mDataFilenameList.size(); ++i) {73 // QString file = mDataFilenameList.at(i);74 // mDataFilenameList[i] = dataDir + file;75 76 73 LOG_TRACE("DbtPlySickLDMRSManager component is starting."); 77 74 … … 85 82 return; 86 83 } 87 // } 84 85 outScan = getTypedOutput<SickLDMRSScan, DbtPlySickLDMRSManager>("scan"); 86 88 87 DbtPlyFileManager::startActivity(); 89 88 } 90 89 91 ////////////////////////////////////////////////////////////////////////// 92 /// Stops the component. 90 /************************************************************************ 91 * Stop function, called by the ComponentManager when a stop() 92 * command is received 93 ************************************************************************/ 93 94 void DbtPlySickLDMRSManager::stopActivity() 94 95 { … … 97 98 } 98 99 99 ////////////////////////////////////////////////////////////////////////// 100 /// processData 100 101 /************************************************************************ 102 * Called by the framework at initialization 103 ************************************************************************/ 104 void DbtPlySickLDMRSManager::addInputs() 105 { 106 // uncomment to add an input 107 } 108 109 110 /************************************************************************ 111 * Called by the framework at initialization 112 ************************************************************************/ 113 void DbtPlySickLDMRSManager::addOutputs() 114 { 115 // empty: no output 116 addOutput<SickLDMRSScan, DbtPlySickLDMRSManager>("scan"); 117 } 118 119 120 /************************************************************************ 121 * Process LiDAR data 122 ************************************************************************/ 101 123 void DbtPlySickLDMRSManager::processData(road_time_t t, road_timerange_t tr, void * buffer) 102 124 { … … 111 133 112 134 // // copy the values contained in the dbt file 113 mS ickDbt.timeStartFromSensor = sickLDMRS_dbt->timeStartFromSensor;114 mS ickDbt.hScan= sickLDMRS_dbt->hScan;115 mS ickDbt.dataPos = sickLDMRS_dbt->dataPos;116 mS ickDbt.time = t;117 mS ickDbt.timerange = tr;135 mScan.timeStartFromSensor = sickLDMRS_dbt->timeStartFromSensor; 136 mScan.header = sickLDMRS_dbt->hScan; 137 mScan.time = t; 138 mScan.timerange = tr; 139 mScan.points = QVector<ScanPoint>(mScan.header.numPoints); 118 140 119 LOG_TRACE("Number of points " << mS ickDbt.hScan.numPoints);141 LOG_TRACE("Number of points " << mScan.header.numPoints); 120 142 121 143 LOG_TRACE("Reading UTC file ... "); 122 144 123 mDataFile.seekg(mSickDbt.dataPos); // set the get pointer to the correct place 124 125 ScanPoint* points = (ScanPoint*) malloc(mSickDbt.hScan.numPoints * sizeof(ScanPoint)); 145 mDataFile.seekg(sickLDMRS_dbt->dataPos); // set the get pointer to the correct place 126 146 127 147 // then copy the data contained in the binary file 128 for (unsigned int i = 0 ; i < mS ickDbt.hScan.numPoints ; ++i) {129 mDataFile.read(reinterpret_cast<char *>(&( points[i])), sizeof(ScanPoint));148 for (unsigned int i = 0 ; i < mScan.header.numPoints ; ++i) { 149 mDataFile.read(reinterpret_cast<char *>(&(mScan.points[i])), sizeof(ScanPoint)); 130 150 } 131 132 151 133 152 // verify that the last value is the UTC magic word … … 138 157 LOG_DEBUG("wrong magic word: EXPECTED=" << UTC_MAGIC_WORD << ", ACTUAL=" << utcMagicWord); 139 158 } else { 140 LOG_TRACE("writing scan "); 141 LOG_WARN("NOT YET IMPLEMENTED"); 142 // mShMem->write(&mSickDbt, sizeof(SickLMS_dbt)); 143 144 /**********************************/ 145 /* TODO : Send data ! */ 146 /**********************************/ 159 LOG_TRACE("sending scan "); 160 checkedSend(outScan, mScan); 147 161 } 148 162 149 163 if (mVerbose) { 150 164 cout << "[SICK LDMRS]:\t" 151 << "numPoints=" << mS ickDbt.hScan.numPoints << "\t"165 << "numPoints=" << mScan.header.numPoints << "\t" 152 166 << "time=" << t << endl 153 167 ; … … 155 169 if (mVerbose >= 2) { 156 170 cout << "[SICK LDMRS]:\t" 157 << "startAngle=" << mS ickDbt.hScan.startAngle << "\t"158 << "endAngle=" << mS ickDbt.hScan.endAngle << std::endl ;171 << "startAngle=" << mScan.header.startAngle << "\t" 172 << "endAngle=" << mScan.header.endAngle << std::endl ; 159 173 } 160 free(points);161 174 } 162 175 -
trunk/StdDbtPlayerComponents/DbtPlySickLDMRSManager.h
r99 r104 17 17 18 18 #include "Pacpus/DbitePlayer/DbtPlyFileManager.h" 19 #include <Pacpus/kernel/InputOutputInterface.h> 19 20 #include "../Sick/SickLDMRSData.h" 20 21 … … 44 45 ~DbtPlySickLDMRSManager(); 45 46 47 virtual void startActivity(); 48 virtual void stopActivity(); 49 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 50 51 virtual void addInputs(); 52 virtual void addOutputs(); 53 46 54 protected: 47 55 void processData(road_time_t t, road_timerange_t tr, void * buffer); 48 56 void displayUI(); 49 57 50 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);51 virtual void startActivity();52 virtual void stopActivity();53 54 58 private: 55 // ShMem * mShMem;56 59 SickLDMRS_dbt mSickDbt; 57 60 61 // .dbt file ("sickldmrs_0.dbt") 58 62 std::ifstream mDataFile; 63 // .utc data file ("sickldmrs_0_data.utc") 59 64 QString mDataFilename; 60 65 61 QStringList mDataFilenameList; 66 // local copy of each scan 67 SickLDMRSScan mScan; 68 69 // Declaration of outputs 70 OutputInterface<SickLDMRSScan, DbtPlySickLDMRSManager>* outScan; 62 71 }; 63 72
Note:
See TracChangeset
for help on using the changeset viewer.