Changeset 42 in pacpussensors for trunk/Sick/SickLMSSensor.cpp
- Timestamp:
- Apr 1, 2014, 2:47:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Sick/SickLMSSensor.cpp
r37 r42 86 86 } 87 87 88 ////////////////////////////////////////////////////////////////////////// 89 /// Destructor. 88 90 89 SickLMSSensor::~SickLMSSensor() 91 90 { … … 94 93 } 95 94 96 ////////////////////////////////////////////////////////////////////////// 97 /// Called by the ComponentManager to start the component 95 98 96 void SickLMSSensor::startActivity() 99 97 { … … 143 141 144 142 try { 145 dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK , sizeof(SickLMS_dbt));143 dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK_LMS, sizeof(SickLMS_dbt)); 146 144 } catch (DbiteException & e) { 147 145 cerr << "error opening dbt file: "<< kSickDbtFileName << ", " << e.what() << endl; … … 174 172 } 175 173 176 ////////////////////////////////////////////////////////////////////////// 177 /// Called by the ComponentManager to stop the component 174 175 178 176 void SickLMSSensor::stopActivity() 179 177 { … … 200 198 } 201 199 202 ////////////////////////////////////////////////////////////////////////// 203 /// 200 204 201 void SickLMSSensor::configure(){ 205 202 // Start measuring … … 212 209 213 210 214 / // Data must be parsed in slot customEvent211 /* Data must be parsed in slot customEvent */ 215 212 void SickLMSSensor::askScanCfg(){ 216 213 char buf[100]; … … 222 219 223 220 224 ////////////////////////////////////////////////////////////////////////// 225 /// 221 226 222 int SickLMSSensor::isMessageComplete(const char* packets, unsigned int size) 227 223 { … … 234 230 235 231 236 ////////////////////////////////////////////////////////////////////////// 237 /// look for the position of the Start of Text character 238 /// Return it if found else return -1 232 239 233 int SickLMSSensor::findSTX(const char* packets, const unsigned int size ){ 240 234 int i = 0; … … 248 242 249 243 250 //////////////////////////////////////////////////////////////////////////251 /// this function is called when no complete message has been found252 /// we set the flag previousData to true for the next processing stage253 /// and we store the timestamp of the bytes acquisition254 244 void SickLMSSensor::storePendingBytes(road_time_t time) 255 245 { … … 261 251 } 262 252 263 ////////////////////////////////////////////////////////////////////////// 264 /// Analyse the ethernet packet received from the Sick LMS and try to find a 265 /// complete message (scan data message) 266 /// If a message has been found it is added at the end of the message list 267 /// else the pending bytes are stored to be analyzed by further icoming data 268 ////////////////////////////////////////////////////////////////////////// 253 269 254 void SickLMSSensor::reconstituteMessage(const char * packet, const int length, road_time_t time) 270 255 { … … 332 317 333 318 334 /**335 * \fn336 * \brief337 * \param338 * \param339 * \return340 */341 319 int SickLMSSensor::splitMessage(MessageLMS* message){ 342 320 … … 357 335 } 358 336 359 ////////////////////////////////////////////////////////////////////////// 360 /// Convert hexadecimal value stored as ASCII string to long 361 /// Warning : alpha characters must be in capital letters 337 338 362 339 long SickLMSSensor::xstol(std::string str){ 363 340 long ret = 0; … … 587 564 } 588 565 589 ////////////////////////////////////////////////////////////////////////// 590 /// write the data on the disk: 566 591 567 void SickLMSSensor::writeData(MessageLMS &msg) 592 568 { … … 595 571 entry.scanNumber = xstol(msg.splitMessage->at(7)); 596 572 entry.scannerStatus = xstol(msg.splitMessage->at(6)); 597 entry.time = msg.time; 598 entry.timerange = msg.timerange; 573 /* time in SickLMS_dbt is used uniquely when DBT file read */ 574 // entry.time = msg.time; 575 // entry.timerange = msg.timerange; 599 576 entry.scanFrequency = msg.data.scanFrequency; 600 577 entry.angleResolution = msg.data.angleResolution; 601 578 entry.startAngle = msg.data.startAngle; 579 580 // Initialisation 581 entry.dist_len1 = entry.dataPos_dist1 = 0; 582 entry.dist_len2 = entry.dataPos_dist2 = 0; 583 entry.dist_len3 = entry.dataPos_dist3 = 0; 584 entry.dist_len4 = entry.dataPos_dist4 = 0; 585 entry.dist_len5 = entry.dataPos_dist5 = 0; 586 entry.rssi_len1 = entry.dataPos_rssi1 = 0; 587 entry.rssi_len2 = entry.dataPos_rssi2 = 0; 602 588 603 589 if(msg.data.dist_len1){ … … 687 673 688 674 689 ////////////////////////////////////////////////////////////////////////// 690 /// Event call by the SickSocket class when new data has been arrived 691 /// on the network. 675 692 676 void SickLMSSensor::customEvent(QEvent * e) 693 677 {
Note:
See TracChangeset
for help on using the changeset viewer.