Changeset 74 in pacpussensors for trunk/StdDbtPlayerComponents/DbtPlySickLMSManager.cpp
- Timestamp:
- Jan 16, 2015, 5:01:19 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StdDbtPlayerComponents/DbtPlySickLMSManager.cpp
r43 r74 17 17 #include <string> 18 18 19 #include "kernel/Log.h" 20 #include "PacpusTools/ShMem.h" 21 19 #include "Pacpus/kernel/Log.h" 20 #include "Pacpus/PacpusTools/ShMem.h" 21 22 #include <Pacpus/kernel/InputOutputInterface.h> 23 24 #include <math.h> 22 25 23 26 #define UTC_MAGIC_WORD 0x55544300 24 27 #define PI 3.1415936 25 28 26 29 namespace pacpus { … … 59 62 DbtPlyFileManager::configureComponent(config); 60 63 61 mDataFilename = param.getProperty("binFile");62 64 //mDataFilename = param.getProperty("binFile"); 65 mDataFilename = config.getProperty("binFile"); 63 66 return ComponentBase::CONFIGURED_OK; 64 67 } … … 96 99 mDataFile.close(); 97 100 } 101 98 102 99 103 ////////////////////////////////////////////////////////////////////////// … … 115 119 mSickDbt.scanFrequency = sickLMS_dbt->scanFrequency; 116 120 mSickDbt.angleResolution = sickLMS_dbt->angleResolution; 117 mSickDbt.startAngle = sickLMS_dbt->startAngle; 121 mSickDbt.startAngle = sickLMS_dbt->startAngle; 122 123 std::cout << "start angle is " << mSickDbt.startAngle << std::endl; 124 std::cout << "angle step is " << mSickDbt.angleResolution << std::endl; 118 125 mSickDbt.time = t; 119 126 mSickDbt.timerange = tr; 120 127 121 122 int sizes[7];128 /*int sizes[7];*/ 129 int sizes[9]; 123 130 sizes[0] = mSickDbt.dist_len1 = sickLMS_dbt->dist_len1; 124 131 sizes[1] = mSickDbt.dist_len2 = sickLMS_dbt->dist_len2; … … 129 136 sizes[6] = mSickDbt.rssi_len2 = sickLMS_dbt->rssi_len2; 130 137 131 uint32_t pos[7]; 138 //sizes[7] = mSickDbt.rssi_len1 = sickLMS_dbt->rssi_len1_8; 139 //sizes[8] = mSickDbt.rssi_len2 = sickLMS_dbt->rssi_len2_8; 140 //uint32_t pos[7]; 141 uint32_t pos[9]; 132 142 pos[0] = mSickDbt.dataPos_dist1 = sickLMS_dbt->dataPos_dist1; 133 143 pos[1] = mSickDbt.dataPos_dist2 = sickLMS_dbt->dataPos_dist2; … … 138 148 pos[6] = mSickDbt.dataPos_rssi2 = sickLMS_dbt->dataPos_rssi2; 139 149 150 //pos[7] = mSickDbt.dataPos_rssi1 = sickLMS_dbt->dataPos_rssi1_8; 151 //pos[8] = mSickDbt.dataPos_rssi2 = sickLMS_dbt->dataPos_rssi2_8; 152 140 153 LOG_TRACE("(ScanPointsInfo) dist1 points\tSize : " << mSickDbt.dist_len1 <<"\tPos. : "<< mSickDbt.dataPos_dist1); 141 154 LOG_TRACE("(ScanPointsInfo) dist2 points\tSize : " << mSickDbt.dist_len2 <<"\tPos. : "<< mSickDbt.dataPos_dist2); … … 147 160 148 161 162 149 163 uint16_t* data[7]; 150 164 uint8_t* remission_8[2]; 151 165 int sumSizes = 0; 152 166 153 167 LOG_TRACE("Reading UTC file ... "); 154 for(int i = 0; i<7; ++i){ 155 156 if(sizes[i]){ 168 for(int i = 0; i<7; ++i) 169 { 170 171 if(sizes[i]) 172 { 157 173 mDataFile.seekg(pos[i]); // set the get pointer to the correct place 158 174 // // then copy the data contained in the binary file 159 175 data[i] = (uint16_t*) malloc(sizes[i]*sizeof(uint16_t)); 160 for (size_t j = 0; j < sizes[i]; ++j) { 176 for (size_t j = 0; j < sizes[i]; ++j) 177 { 161 178 mDataFile.read(reinterpret_cast<char*>(data[i]+j), sizeof(uint16_t)); 162 if(j%500==0){ 179 if(j%500==0) 180 { 163 181 LOG_TRACE("Data : " << (uint16_t) *(data[i] + j)); 164 182 } 183 if(i == 0) 184 { 185 186 //std::cout << mSickLMSScan.point[j].distance << std::endl; 187 } 188 if(i == 5) 189 { 190 191 std::cout << *(data[i]+j) << std::endl; 192 } 165 193 } 166 } 167 sumSizes += sizes[i]; 168 } 169 194 195 } 196 sumSizes += sizes[i]; 197 } 198 199 // for(int i = 7; i<9; ++i) 200 //{ 201 202 // if(sizes[i]) 203 // { 204 // mDataFile.seekg(pos[i]); // set the get pointer to the correct place 205 // // // then copy the data contained in the binary file 206 // remission_8[i] = (uint8_t*) malloc(sizes[i]*sizeof(uint8_t)); 207 // for (size_t j = 0; j < sizes[i]; ++j) 208 // { 209 // mDataFile.read(reinterpret_cast<char*>(remission_8[i]+j), sizeof(uint8_t)); 210 // if(j%500==0) 211 // { 212 // LOG_TRACE("Data : " << (uint16_t) *(remission_8[i] + j)); 213 // } 214 // if(i == 0) 215 // { 216 217 // //std::cout << mSickLMSScan.point[j].distance << std::endl; 218 // } 219 // if(i == 7) 220 // { 221 222 // std::cout << "the 8 bit remission" << *(remission_8[i]+j) << std::endl; 223 // } 224 // } 225 226 // } 227 // sumSizes += sizes[i]; 228 // } 229 // 170 230 171 231 // verify that the last value is the UTC magic word … … 181 241 182 242 /**********************************/ 183 /* TODO : Send data ! */ 243 244 184 245 /**********************************/ 185 246 } … … 198 259 199 260 200 for(int i=0; i<7; ++i){ 201 free(data[i]); 261 for(int i=0; i<7; ++i) 262 { 263 if(sizes[i]) 264 { 265 free(data[i]); 266 } 202 267 } 203 268 }
Note:
See TracChangeset
for help on using the changeset viewer.