Changeset 61 in pacpussensors
- Timestamp:
- Jul 22, 2014, 4:36:25 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMakeLists.txt
r60 r61 94 94 # add_subdirectory(Wifibot) 95 95 add_subdirectory(Gps) 96 add_subdirectory(SpanCPTComponent)96 #add_subdirectory(SpanCPTComponent) 97 97 add_subdirectory(NMEA0183) 98 98 add_subdirectory(OpencvVideo) -
trunk/OpencvVideo/README.txt
r60 r61 18 18 --------------------- 19 19 20 <webcam type="CVWebcam" device="0" width="640" height="480" framerate="25" ui="true" recording="false" />21 20 <component name="webcam" type="CVWebcam" device="0" width="640" height="480" framerate="25" ui="true" recording="true" /> 21 22 22 a. Description: 23 23 --------------- -
trunk/Sick/CMakeLists.txt
r37 r61 2 2 3 3 ################################################################################ 4 add_definitions( -DSICK_EXPORTS ) 4 5 add_definitions( -DSICKLDMRS_EXPORTS ) 5 6 6 add_definitions( -DSICKLMS_EXPORTS ) 7 7 8 8 # ======================================== -
trunk/Sick/SickComponent.cpp
r42 r61 74 74 // Sick LD-MRS 75 75 int num = 0; 76 while ( param.getProperty("sickldmrs_"+QString::number(num)) != QString::null){77 QString information = param.getProperty("sickldmrs_"+QString::number(num));76 while (config.getProperty("sickldmrs_"+QString::number(num)) != QString::null){ 77 QString information = config.getProperty("sickldmrs_"+QString::number(num)); 78 78 QStringList list = information.split(":"); 79 79 int recording = 0; 80 if ( param.getProperty("sickldmrs_"+QString::number(num)+"_recording") != QString::null)80 if (config.getProperty("sickldmrs_"+QString::number(num)+"_recording") != QString::null) 81 81 { 82 recording = param.getProperty("sickldmrs_"+QString::number(num)+"_recording").toInt();82 recording = config.getProperty("sickldmrs_"+QString::number(num)+"_recording").toInt(); 83 83 } 84 84 … … 89 89 // Sick LMS 151 90 90 num = 0; 91 while ( param.getProperty("sicklms151_"+QString::number(num)) != QString::null){92 QString information = param.getProperty("sicklms151_"+QString::number(num));91 while (config.getProperty("sicklms151_"+QString::number(num)) != QString::null){ 92 QString information = config.getProperty("sicklms151_"+QString::number(num)); 93 93 QStringList list = information.split(":"); 94 94 int recording = 0; 95 if ( param.getProperty("sicklms151_"+QString::number(num)+"_recording") != QString::null)95 if (config.getProperty("sicklms151_"+QString::number(num)+"_recording") != QString::null) 96 96 { 97 recording = param.getProperty("sicklms151_"+QString::number(num)+"_recording").toInt();97 recording = config.getProperty("sicklms151_"+QString::number(num)+"_recording").toInt(); 98 98 } 99 99 … … 104 104 // Sick LMS 511 105 105 num = 0; 106 while ( param.getProperty("sicklms511_"+QString::number(num)) != QString::null){107 QString information = param.getProperty("sicklms511_"+QString::number(num));106 while (config.getProperty("sicklms511_"+QString::number(num)) != QString::null){ 107 QString information = config.getProperty("sicklms511_"+QString::number(num)); 108 108 QStringList list = information.split(":"); 109 109 int recording = 0; 110 if ( param.getProperty("sicklms511_"+QString::number(num)+"_recording") != QString::null)110 if (config.getProperty("sicklms511_"+QString::number(num)+"_recording") != QString::null) 111 111 { 112 recording = param.getProperty("sicklms511_"+QString::number(num)+"_recording").toInt();112 recording = config.getProperty("sicklms511_"+QString::number(num)+"_recording").toInt(); 113 113 } 114 114 -
trunk/Sick/SickLDMRSData.h
r52 r61 43 43 */ 44 44 struct DataHeader { 45 u _int32_t magicWord; //!< 0xAFFEC0C2 for the Sick LDMRS sensor (this value must be found in order to decode the message).46 u _int32_t sizePreviousMessage; //!< Size in bytes of the previous message.47 u _int32_t sizeCurrentMessage; //!< Size of the message content without the header (DataHeader).48 // u _int8_t reserved49 u _int8_t deviceId; //!< Unused in data received directly from LD-MRS sensors.50 u _int16_t dataType; //!< Type of information carried into the message.45 uint32_t magicWord; //!< 0xAFFEC0C2 for the Sick LDMRS sensor (this value must be found in order to decode the message). 46 uint32_t sizePreviousMessage; //!< Size in bytes of the previous message. 47 uint32_t sizeCurrentMessage; //!< Size of the message content without the header (DataHeader). 48 // uint8_t reserved 49 uint8_t deviceId; //!< Unused in data received directly from LD-MRS sensors. 50 uint16_t dataType; //!< Type of information carried into the message. 51 51 ///< Types used are : 52 52 ///< - Points : 0x2202 53 53 ///< - Objects : 0x2221 54 u _int64_t ntpTime; //!< Time of the sensor when the message is created54 uint64_t ntpTime; //!< Time of the sensor when the message is created 55 55 }; 56 56 … … 66 66 */ 67 67 struct SICKLDMRS_API ScanHeader { 68 u _int16_t scanNumber; //!< Number of the scan since the sensor started measuring.69 u _int16_t scannerStatus; //!< Status of the scanner68 uint16_t scanNumber; //!< Number of the scan since the sensor started measuring. 69 uint16_t scannerStatus; //!< Status of the scanner 70 70 /**< 71 71 * - 0x0007: reserved, … … 77 77 */ 78 78 79 u _int16_t phaseOffset; ///<80 u _int64_t startNtpTime; //!< NTP time first measurement81 u _int64_t endNtpTime; //!< NTP time last measurement82 u _int16_t ticksPerRot; //!< Angle ticks per rotation (used to compute the real angle of a point)79 uint16_t phaseOffset; ///< 80 uint64_t startNtpTime; //!< NTP time first measurement 81 uint64_t endNtpTime; //!< NTP time last measurement 82 uint16_t ticksPerRot; //!< Angle ticks per rotation (used to compute the real angle of a point) 83 83 int16_t startAngle; //!< Angle of the first measured value 84 84 int16_t endAngle; //!< Angle of the last measured value 85 u _int16_t numPoints; //!< Number of scanned points during this scan @see ScanPoint85 uint16_t numPoints; //!< Number of scanned points during this scan @see ScanPoint 86 86 87 87 // mounting position; reference ? … … 93 93 // int16_t mountingZ; 94 94 95 // u _int16_t reserved;95 // uint16_t reserved; 96 96 97 97 }; … … 105 105 */ 106 106 struct SICKLDMRS_API ScanPoint{ 107 u _char layerEcho; //!< 4 LSB : Layer (scan layer of the point)107 uchar layerEcho; //!< 4 LSB : Layer (scan layer of the point) 108 108 //!< 4 MSB : Echo 109 u _char flags;110 u _int16_t angle; //!< Angle in number of ticks. You can easily compute the real angle :109 uchar flags; 110 uint16_t angle; //!< Angle in number of ticks. You can easily compute the real angle : 111 111 //!< \f$ angle (degree) = \frac{angle (ticks)}{ScanHeader.ticksPerRot}\f$ @see ScanHeader 112 112 113 u _int16_t distance; //!< Distance of the point from the sensor in centimeters.114 u _int16_t echoPulseWidth; //!< Width of echo pulse (cm)115 // u _int16_t reserved;113 uint16_t distance; //!< Distance of the point from the sensor in centimeters. 114 uint16_t echoPulseWidth; //!< Width of echo pulse (cm) 115 // uint16_t reserved; 116 116 }; 117 117 … … 134 134 typedef struct 135 135 { 136 u _int64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor).136 uint64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor). 137 137 ScanHeader hScan; //!< General information about points recorded. @see ScanHeader 138 138 road_time_t time; //!< DBT timestamp. -
trunk/Sick/SickLDMRSSensor.cpp
r52 r61 138 138 LOG_TRACE("destructor (" << this->name_ << ")"); 139 139 140 S_socket->sendToServer(QString((u _int32_t)0x0021));140 S_socket->sendToServer(QString((uint32_t)0x0021)); 141 141 142 142 S_socket->closeSocket(); … … 157 157 158 158 159 u _int32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length)159 uint32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length) 160 160 { 161 161 if (length < 4) { … … 164 164 165 165 unsigned long i = 0; 166 while(*((u _int32_t*)(message+i)) != 0xC2C0FEAF){ // BigE166 while(*((uint32_t*)(message+i)) != 0xC2C0FEAF){ // BigE 167 167 if (i == length) { 168 168 return -1; … … 175 175 176 176 177 u _int32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex)177 uint32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex) 178 178 { 179 179 … … 202 202 { 203 203 // address = base + Data header size (24-byte long) + offset 204 msg.hScan.scanNumber = *((u _int16_t*)(msg.body+24));205 msg.hScan.scannerStatus = *((u _int16_t*)(msg.body+24+2));206 msg.hScan.phaseOffset = *((u _int16_t*)(msg.body+24+4));207 msg.hScan.startNtpTime = *((u _int64_t*)(msg.body+24+6));208 msg.hScan.endNtpTime = *((u _int64_t*)(msg.body+24+14));209 msg.hScan.ticksPerRot= *((u _int16_t*)(msg.body+24+22)); // needed to compute angle (°)204 msg.hScan.scanNumber = *((uint16_t*)(msg.body+24)); 205 msg.hScan.scannerStatus = *((uint16_t*)(msg.body+24+2)); 206 msg.hScan.phaseOffset = *((uint16_t*)(msg.body+24+4)); 207 msg.hScan.startNtpTime = *((uint64_t*)(msg.body+24+6)); 208 msg.hScan.endNtpTime = *((uint64_t*)(msg.body+24+14)); 209 msg.hScan.ticksPerRot= *((uint16_t*)(msg.body+24+22)); // needed to compute angle (°) 210 210 msg.hScan.startAngle = *((int16_t*)(msg.body+24+24)); 211 211 msg.hScan.endAngle = *((int16_t*)(msg.body+24+26)); 212 msg.hScan.numPoints = *((u _int16_t*)(msg.body+24+28));212 msg.hScan.numPoints = *((uint16_t*)(msg.body+24+28)); 213 213 214 214 // msg.hScan.mountingYawAngle = *((int16_t*)(msg.body+24+30)); … … 369 369 } 370 370 371 ScanPoint scanPoints[msg.hScan.numPoints];371 ScanPoint * scanPoints = new ScanPoint[msg.hScan.numPoints]; 372 372 373 373 // replace memory with structured data … … 375 375 scanPoints[i].layerEcho = *((uchar*)(msg.body + index)); 376 376 scanPoints[i].flags = *((uchar*)(msg.body + index + 1)); 377 scanPoints[i].angle = *((u _int16_t*)(msg.body + index + 2));378 scanPoints[i].distance = *((u _int16_t*)(msg.body + index + 4));379 scanPoints[i].echoPulseWidth = *((u _int16_t*)(msg.body + index + 6));377 scanPoints[i].angle = *((uint16_t*)(msg.body + index + 2)); 378 scanPoints[i].distance = *((uint16_t*)(msg.body + index + 4)); 379 scanPoints[i].echoPulseWidth = *((uint16_t*)(msg.body + index + 6)); 380 380 } 381 381 382 382 memcpy(msg.body, scanPoints, sizeof(ScanPoint) * msg.hScan.numPoints); 383 384 delete[] scanPoints; 383 385 } 384 386 else if (msg.hData.dataType == SICKLDMRS_OBJECTDATA_TYPE){ … … 434 436 void SickLDMRSSensor::configure(){ 435 437 // Start measuring 436 // S_socket->sendToServer(QString((u _int32_t)0x0020));438 // S_socket->sendToServer(QString((uint32_t)0x0020)); 437 439 438 440 // LOG_TRACE(this->name_ +" configured."); -
trunk/Sick/SickLDMRSSensor.h
r52 r61 158 158 * - @b position of the magic word otherwise 159 159 */ 160 u _int32_t findMagicWord(const char * message, const unsigned length);160 uint32_t findMagicWord(const char * message, const unsigned length); 161 161 162 162 /** … … 171 171 * 172 172 */ 173 u _int32_t getMessageSize(const char * message, const unsigned length, const long magicWordIndex);173 uint32_t getMessageSize(const char * message, const unsigned length, const long magicWordIndex); 174 174 175 175 /** -
trunk/Sick/SickLMSData.h
r37 r61 76 76 * 1/100 Hz 77 77 */ 78 u _int32_t scanFrequency;78 uint32_t scanFrequency; 79 79 80 80 /*! … … 82 82 * 1/10000 degree 83 83 */ 84 u _int32_t angleResolution;84 uint32_t angleResolution; 85 85 86 86 /*! … … 203 203 204 204 typedef struct{ 205 u _int16_t scanNumber; //!< number of the scan206 u _int16_t scannerStatus;205 uint16_t scanNumber; //!< number of the scan 206 uint16_t scannerStatus; 207 207 //!< - 00 00 OK 208 208 //!< - 00 01 Error … … 212 212 road_time_t time; //!< DBT timestamp 213 213 road_timerange_t timerange; //!< DBT timerange 214 u _int32_t scanFrequency; //!< Frequency of the scan [1/100 Hz]215 u _int32_t angleResolution; //!< Angle resolution (default is 5000 <=> 0.5 degree) [1/10000 degree]214 uint32_t scanFrequency; //!< Frequency of the scan [1/100 Hz] 215 uint32_t angleResolution; //!< Angle resolution (default is 5000 <=> 0.5 degree) [1/10000 degree] 216 216 int32_t startAngle; //!< Angle of the first scanned point. 217 217 int dist_len1; //!< Number of points (1st echo). -
trunk/Sick/SickLMSSensor.cpp
r42 r61 201 201 void SickLMSSensor::configure(){ 202 202 // Start measuring 203 // S_socket->sendToServer(QString((u _int32_t)0x0020));203 // S_socket->sendToServer(QString((uint32_t)0x0020)); 204 204 205 205 // LOG_TRACE(this->name_ +" configured."); … … 592 592 593 593 for (unsigned int i = 0 ; i < msg.data.dist_len1; ++i) { 594 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist1[i])), sizeof(u _int16_t));594 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist1[i])), sizeof(uint16_t)); 595 595 } 596 596 … … 602 602 603 603 for (unsigned int i = 0 ; i < msg.data.dist_len2; ++i) { 604 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist2[i])), sizeof(u _int16_t));604 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist2[i])), sizeof(uint16_t)); 605 605 } 606 606 … … 612 612 613 613 for (unsigned int i = 0 ; i < msg.data.dist_len3; ++i) { 614 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist3[i])), sizeof(u _int16_t));614 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist3[i])), sizeof(uint16_t)); 615 615 } 616 616 … … 622 622 623 623 for (unsigned int i = 0 ; i < msg.data.dist_len4; ++i) { 624 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist4[i])), sizeof(u _int16_t));624 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist4[i])), sizeof(uint16_t)); 625 625 } 626 626 … … 632 632 633 633 for (unsigned int i = 0 ; i < msg.data.dist_len5; ++i) { 634 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist5[i])), sizeof(u _int16_t));634 dataFile_.write(reinterpret_cast<char*>(&(msg.data.dist5[i])), sizeof(uint16_t)); 635 635 } 636 636 … … 642 642 643 643 for (unsigned int i = 0 ; i < msg.data.rssi_len1; ++i) { 644 dataFile_.write(reinterpret_cast<char*>(&(msg.data.rssi1[i])), sizeof(u _int16_t));644 dataFile_.write(reinterpret_cast<char*>(&(msg.data.rssi1[i])), sizeof(uint16_t)); 645 645 } 646 646 … … 652 652 653 653 for (unsigned int i = 0 ; i < msg.data.rssi_len2; ++i) { 654 dataFile_.write(reinterpret_cast<char*>(&(msg.data.rssi2[i])), sizeof(u _int16_t));654 dataFile_.write(reinterpret_cast<char*>(&(msg.data.rssi2[i])), sizeof(uint16_t)); 655 655 } 656 656
Note:
See TracChangeset
for help on using the changeset viewer.