Changeset 42 in pacpussensors for trunk/Sick/SickLMSSensor.cpp


Ignore:
Timestamp:
Apr 1, 2014, 2:47:39 PM (11 years ago)
Author:
cfougera
Message:

Last version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Sick/SickLMSSensor.cpp

    r37 r42  
    8686}
    8787
    88 //////////////////////////////////////////////////////////////////////////
    89 /// Destructor.
     88
    9089SickLMSSensor::~SickLMSSensor()
    9190{
     
    9493}
    9594
    96 //////////////////////////////////////////////////////////////////////////
    97 /// Called by the ComponentManager to start the component
     95
    9896void SickLMSSensor::startActivity()
    9997{
     
    143141
    144142        try {
    145             dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK, sizeof(SickLMS_dbt));
     143            dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK_LMS, sizeof(SickLMS_dbt));
    146144        } catch (DbiteException & e) {
    147145            cerr << "error opening dbt file: "<< kSickDbtFileName << ", " << e.what() << endl;
     
    174172}
    175173
    176 //////////////////////////////////////////////////////////////////////////
    177 /// Called by the ComponentManager to stop the component
     174
     175
    178176void SickLMSSensor::stopActivity()
    179177{
     
    200198}
    201199
    202 //////////////////////////////////////////////////////////////////////////
    203 ///
     200
    204201void SickLMSSensor::configure(){
    205202    // Start measuring
     
    212209
    213210
    214 /// Data must be parsed in slot customEvent
     211/* Data must be parsed in slot customEvent */
    215212void SickLMSSensor::askScanCfg(){
    216213    char buf[100];
     
    222219
    223220
    224 //////////////////////////////////////////////////////////////////////////
    225 ///
     221
    226222int SickLMSSensor::isMessageComplete(const char* packets, unsigned int size)
    227223{
     
    234230
    235231
    236 //////////////////////////////////////////////////////////////////////////
    237 /// look for the position of the Start of Text character
    238 /// Return it if found else return -1
     232
    239233int SickLMSSensor::findSTX(const char* packets, const unsigned int size ){
    240234    int i = 0;
     
    248242
    249243
    250 //////////////////////////////////////////////////////////////////////////
    251 /// this function is called when no complete message has been found
    252 /// we set the flag previousData to true for the next processing stage
    253 /// and we store the timestamp of the bytes acquisition
    254244void SickLMSSensor::storePendingBytes(road_time_t time)
    255245{
     
    261251}
    262252
    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
    269254void SickLMSSensor::reconstituteMessage(const char * packet, const int length, road_time_t time)
    270255{
     
    332317
    333318
    334 /**
    335  * \fn
    336  * \brief
    337  * \param
    338  * \param
    339  * \return
    340  */
    341319int SickLMSSensor::splitMessage(MessageLMS* message){
    342320
     
    357335}
    358336
    359 //////////////////////////////////////////////////////////////////////////
    360 /// Convert hexadecimal value stored as ASCII string to long
    361 /// Warning : alpha characters must be in capital letters
     337
     338
    362339long SickLMSSensor::xstol(std::string str){
    363340    long ret = 0;
     
    587564}
    588565
    589 //////////////////////////////////////////////////////////////////////////
    590 /// write the data on the disk:
     566
    591567void SickLMSSensor::writeData(MessageLMS &msg)
    592568{
     
    595571    entry.scanNumber = xstol(msg.splitMessage->at(7));
    596572    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;
    599576    entry.scanFrequency = msg.data.scanFrequency;
    600577    entry.angleResolution = msg.data.angleResolution;
    601578    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;
    602588
    603589    if(msg.data.dist_len1){
     
    687673
    688674
    689 //////////////////////////////////////////////////////////////////////////
    690 /// Event call by the SickSocket class when new data has been arrived
    691 /// on the network.
     675
    692676void SickLMSSensor::customEvent(QEvent * e)
    693677{
Note: See TracChangeset for help on using the changeset viewer.