Changeset 114 in pacpussensors for trunk/StdDbtPlayerComponents
- Timestamp:
- Dec 16, 2015, 2:36:49 PM (9 years ago)
- Location:
- trunk/StdDbtPlayerComponents
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StdDbtPlayerComponents/DbtPlyAlascaManager.cpp
r111 r114 16 16 #include <iostream> 17 17 #include <string> 18 #include <math.h> 18 19 19 20 #include "kernel/Log.h" 21 #include "kernel/InputOutputInterface.h" 20 22 #include "PacpusTools/ShMem.h" 23 24 #define CENTIMETER_TO_METER 100 21 25 22 26 namespace pacpus { … … 57 61 58 62 return ComponentBase::CONFIGURED_OK; 63 } 64 65 void DbtPlyAlascaManager::addInputs() 66 { 67 // empty: no inputs 68 } 69 70 void DbtPlyAlascaManager::addOutputs() 71 { 72 addOutput<LidarScan, DbtPlyAlascaManager>("scan"); 73 addOutput<ScanAlascaData, DbtPlyAlascaManager>("raw"); 59 74 } 60 75 … … 118 133 } 119 134 135 lidarScan = LidarScan(4); 136 int layer; 137 138 lidarScan.nbPoint = mAlascaData.nbPoint; 139 lidarScan.time = mAlascaData.time; 140 lidarScan.timerange = mAlascaData.timerange; 141 lidarScan.scannerId; 142 lidarScan.scannerType = mAlascaData.scannertype; 143 lidarScan.nbLayer = 4; 144 145 for (size_t i = 0; i < mAlascaData.nbPoint; ++i) { 146 LidarPoint point; 147 148 layer = mAlascaData.point[i].layerNumber; 149 point.echo = mAlascaData.point[i].echoNumber; 150 151 point.x = (float)mAlascaData.point[i].x / CENTIMETER_TO_METER; 152 point.y = (float)mAlascaData.point[i].y / CENTIMETER_TO_METER; 153 point.z = (float)mAlascaData.point[i].z / CENTIMETER_TO_METER; 154 point.intensity = mAlascaData.point[i].width; 155 point.d = (sqrt(point.x*point.x+point.y*point.y+point.z*point.z) * CENTIMETER_TO_METER); 156 157 lidarScan.layers[layer].nbPoint++; 158 lidarScan.layers[layer].points.append(point); 159 } 160 120 161 // verify that the last value is the UTC magic word 121 162 int32_t utcMagicWord = 0; 122 163 mDataFile.read(reinterpret_cast<char *>(&(utcMagicWord)), sizeof(utcMagicWord)); 123 /*if (UTC_MAGIC_WORD != utcMagicWord) {164 if (UTC_MAGIC_WORD != utcMagicWord) { 124 165 LOG_WARN("corrupted data, do not use them!"); 125 166 LOG_DEBUG("wrong magic word: EXPECTED=" << UTC_MAGIC_WORD << ", ACTUAL=" << utcMagicWord); 126 167 } else { 127 168 LOG_TRACE("writing scan"); 128 mShMem->write(&mAlascaData, sizeof(ScanAlascaData)); 129 }*/ // deprecated 169 //mShMem->write(&mAlascaData, sizeof(ScanAlascaData)); 170 171 OutputInterface<LidarScan, DbtPlyAlascaManager> * scanOutput = getTypedOutput<LidarScan, DbtPlyAlascaManager>("scan"); 172 if (scanOutput && scanOutput->hasConnection()) { 173 scanOutput->send(lidarScan, road_time(), /*timerange=*/50000); // FIXME: magic numbers? 174 } 175 OutputInterface<ScanAlascaData, DbtPlyAlascaManager> * rawOutput = getTypedOutput<ScanAlascaData, DbtPlyAlascaManager>("raw"); 176 if (rawOutput && rawOutput->hasConnection()) { 177 rawOutput->send(mAlascaData, road_time(), /*timerange=*/50000); 178 } 179 } 130 180 131 181 if (mVerbose) { -
trunk/StdDbtPlayerComponents/DbtPlyAlascaManager.h
r111 r114 20 20 #include "../Alasca/AlascaData.h" 21 21 #include "StdDbtPlayerComponentsConfig.h" 22 #include <Pacpus/structures/genericLidarStructures.h> 22 23 23 24 namespace pacpus { … … 28 29 : public DbtPlyFileManager 29 30 { 31 Q_OBJECT 30 32 public: 31 33 DbtPlyAlascaManager(QString name); … … 36 38 void displayUI(); 37 39 38 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 39 virtual void startActivity(); 40 virtual void stopActivity(); 40 ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 41 void startActivity(); 42 void stopActivity(); 43 44 virtual void addInputs(); 45 virtual void addOutputs(); 41 46 42 47 private: 43 48 //ShMem * mShMem;// deprecated 44 49 ScanAlascaData mAlascaData; 50 LidarScan lidarScan; 45 51 46 52 std::ifstream mDataFile;
Note:
See TracChangeset
for help on using the changeset viewer.