Changeset 61 in pacpussensors for trunk


Ignore:
Timestamp:
07/22/14 16:36:25 (10 years ago)
Author:
DHERBOMEZ Gérald
Message:

commit after experiments on track
Issue with GPS receiver, no data recorded

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r60 r61  
    9494# add_subdirectory(Wifibot)
    9595add_subdirectory(Gps)
    96 add_subdirectory(SpanCPTComponent)
     96#add_subdirectory(SpanCPTComponent)
    9797add_subdirectory(NMEA0183)
    9898add_subdirectory(OpencvVideo)
  • trunk/OpencvVideo/README.txt

    r60 r61  
    1818    ---------------------
    1919
    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
    2222      a. Description:
    2323      ---------------
  • trunk/Sick/CMakeLists.txt

    r37 r61  
    22
    33################################################################################
     4add_definitions( -DSICK_EXPORTS )
    45add_definitions( -DSICKLDMRS_EXPORTS )
    5 
    6 
     6add_definitions( -DSICKLMS_EXPORTS )
    77
    88# ========================================
  • trunk/Sick/SickComponent.cpp

    r42 r61  
    7474    // Sick LD-MRS
    7575    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));
    7878        QStringList list = information.split(":");
    7979        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)
    8181        {
    82              recording = param.getProperty("sickldmrs_"+QString::number(num)+"_recording").toInt();
     82             recording = config.getProperty("sickldmrs_"+QString::number(num)+"_recording").toInt();
    8383        }
    8484
     
    8989    // Sick LMS 151
    9090       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));
    9393        QStringList list = information.split(":");
    9494        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)
    9696        {
    97              recording = param.getProperty("sicklms151_"+QString::number(num)+"_recording").toInt();
     97             recording = config.getProperty("sicklms151_"+QString::number(num)+"_recording").toInt();
    9898        }
    9999
     
    104104     // Sick LMS 511
    105105     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));
    108108      QStringList list = information.split(":");
    109109      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)
    111111      {
    112            recording = param.getProperty("sicklms511_"+QString::number(num)+"_recording").toInt();
     112           recording = config.getProperty("sicklms511_"+QString::number(num)+"_recording").toInt();
    113113      }
    114114
  • trunk/Sick/SickLDMRSData.h

    r52 r61  
    4343 */
    4444struct 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 reserved
    49     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.
    5151                                    ///< Types used are :
    5252                                    ///<     - Points : 0x2202
    5353                                    ///<     - Objects : 0x2221
    54     u_int64_t ntpTime;              //!< Time of the sensor when the message is created
     54    uint64_t ntpTime;              //!< Time of the sensor when the message is created
    5555};
    5656
     
    6666 */
    6767struct 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 scanner
     68    uint16_t scanNumber;       //!< Number of the scan since the sensor started measuring.
     69    uint16_t scannerStatus;    //!< Status of the scanner
    7070                                /**<
    7171                                 * - 0x0007: reserved,
     
    7777                                 */
    7878
    79     u_int16_t phaseOffset;  ///<
    80     u_int64_t startNtpTime; //!< NTP time first measurement
    81     u_int64_t endNtpTime;   //!< NTP time last measurement
    82     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)
    8383    int16_t startAngle;     //!< Angle of the first measured value
    8484    int16_t endAngle;       //!< Angle of the last measured value
    85     u_int16_t numPoints;    //!< Number of scanned points during this scan @see ScanPoint
     85    uint16_t numPoints;    //!< Number of scanned points during this scan @see ScanPoint
    8686
    8787    // mounting position; reference ?
     
    9393//    int16_t mountingZ;
    9494
    95     // u_int16_t reserved;
     95    // uint16_t reserved;
    9696
    9797};
     
    105105 */
    106106struct 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)
    108108                                //!< 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 :
    111111                                //!< \f$ angle (degree) = \frac{angle (ticks)}{ScanHeader.ticksPerRot}\f$ @see ScanHeader
    112112
    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;
    116116};
    117117
     
    134134typedef struct
    135135{
    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).
    137137    ScanHeader hScan;               //!< General information about points recorded. @see ScanHeader
    138138    road_time_t time;               //!< DBT timestamp.
  • trunk/Sick/SickLDMRSSensor.cpp

    r52 r61  
    138138    LOG_TRACE("destructor (" << this->name_ << ")");
    139139
    140     S_socket->sendToServer(QString((u_int32_t)0x0021));
     140    S_socket->sendToServer(QString((uint32_t)0x0021));
    141141
    142142    S_socket->closeSocket();
     
    157157
    158158
    159 u_int32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length)
     159uint32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length)
    160160{
    161161    if (length < 4) {
     
    164164
    165165    unsigned long i = 0;
    166     while(*((u_int32_t*)(message+i)) != 0xC2C0FEAF){ // BigE
     166    while(*((uint32_t*)(message+i)) != 0xC2C0FEAF){ // BigE
    167167        if (i == length) {
    168168            return -1;
     
    175175
    176176
    177 u_int32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex)
     177uint32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex)
    178178{
    179179
     
    202202{
    203203    // 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 (°)
    210210    msg.hScan.startAngle = *((int16_t*)(msg.body+24+24));
    211211    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));
    213213
    214214//    msg.hScan.mountingYawAngle = *((int16_t*)(msg.body+24+30));
     
    369369        }
    370370
    371         ScanPoint scanPoints[msg.hScan.numPoints];
     371        ScanPoint * scanPoints = new ScanPoint[msg.hScan.numPoints];
    372372
    373373        // replace memory with structured data
     
    375375            scanPoints[i].layerEcho = *((uchar*)(msg.body + index));
    376376            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));
    380380        }
    381381
    382382        memcpy(msg.body, scanPoints, sizeof(ScanPoint) * msg.hScan.numPoints);
     383
     384                delete[] scanPoints;
    383385    }
    384386    else if (msg.hData.dataType == SICKLDMRS_OBJECTDATA_TYPE){
     
    434436void SickLDMRSSensor::configure(){
    435437    // Start measuring
    436     // S_socket->sendToServer(QString((u_int32_t)0x0020));
     438    // S_socket->sendToServer(QString((uint32_t)0x0020));
    437439
    438440    // LOG_TRACE(this->name_ +" configured.");
  • trunk/Sick/SickLDMRSSensor.h

    r52 r61  
    158158     * - @b position of the magic word otherwise
    159159     */
    160     u_int32_t findMagicWord(const char * message, const unsigned length);
     160    uint32_t findMagicWord(const char * message, const unsigned length);
    161161
    162162    /**
     
    171171    *
    172172    */
    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);
    174174
    175175    /**
  • trunk/Sick/SickLMSData.h

    r37 r61  
    7676     * 1/100 Hz
    7777     */
    78     u_int32_t scanFrequency;
     78    uint32_t scanFrequency;
    7979
    8080    /*!
     
    8282     * 1/10000 degree
    8383     */
    84     u_int32_t angleResolution;
     84    uint32_t angleResolution;
    8585
    8686    /*!
     
    203203
    204204typedef struct{
    205     u_int16_t scanNumber;           //!< number of the scan
    206     u_int16_t scannerStatus;
     205    uint16_t scanNumber;           //!< number of the scan
     206    uint16_t scannerStatus;
    207207        //!< - 00 00 OK
    208208        //!< - 00 01 Error
     
    212212    road_time_t time;               //!< DBT timestamp
    213213    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]
    216216    int32_t startAngle;             //!< Angle of the first scanned point.
    217217    int dist_len1;                  //!< Number of points (1st echo).
  • trunk/Sick/SickLMSSensor.cpp

    r42 r61  
    201201void SickLMSSensor::configure(){
    202202    // Start measuring
    203     // S_socket->sendToServer(QString((u_int32_t)0x0020));
     203    // S_socket->sendToServer(QString((uint32_t)0x0020));
    204204
    205205    // LOG_TRACE(this->name_ +" configured.");
     
    592592
    593593        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));
    595595        }
    596596
     
    602602
    603603        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));
    605605        }
    606606
     
    612612
    613613        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));
    615615        }
    616616
     
    622622
    623623        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));
    625625        }
    626626
     
    632632
    633633        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));
    635635        }
    636636
     
    642642
    643643        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));
    645645        }
    646646
     
    652652
    653653        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));
    655655        }
    656656
Note: See TracChangeset for help on using the changeset viewer.