Menu

Get measurement data for continuous scan

Ajay
2015-09-23
2017-10-31
  • Ajay

    Ajay - 2015-09-23

    Hello Everyone,

    How can i get measurement data for continuous scan without any delay.. In my case am using cpp libray.
    after every single scan line.. its getting stopped for few milli secodns and gets restarts.

    Also am getting message in console window like this:
    "Urg_driver::get_distance<>: checksum error"

    This is my code to start measurement:
    urg.start_measurement(Urg_driver::Distance, Urg_driver::Infinity_times, 0);

    Please suggest me solution if any.
    Thank you..

     
  • Mehrez Kristou

    Mehrez Kristou - 2015-09-23

    Hi there,

    Thank you for using our sensor.

    What is the sensor model you are using? do you use multi threading in your program.
    A more elabortaed snippet of your code couls give me some clues about what you are triying to acheive.

    Regards,
    Kristou

     
  • Ajay

    Ajay - 2015-09-24

    Thank you Sir,
    I am uisng URG-04LX-UG01, the problem is that, I need to aquire scan point continously without any breaks in between. But with my case, after every 1000 m seconds.. Its stops for few mili second and angain send data..

    To be more clearly, I have tested device with UrgBenriPlus V2.0.0 exe that you have provided. There you provided option called "Continuous" in the Mode tab.

    So now Questions is, How to enable continuous mode in programming with CPP Api. ??

    I Have attached screenshot and hilightated the mode options that i mentioned above.

    I am using thread (from Boost Library) for rendering scanned point using visualizer.

    while (!viewer->wasStopped ())
    {

    if(urg.is_open()){
        urg.start_measurement(Urg_driver::Distance, Urg_driver::Infinity_times,0);
    
    vector<long> data;
    long time_stamp = 0;
    
    if (!urg.get_distance(data, &time_stamp)) {
       cout << "Urg_driver::get_distance(): " << urg.what() << endl;
     }
        print_data(urg, data, time_stamp);
        viewer->updatePointCloud(point_cloud_Trans,"sample cloud1");
    }
    
    viewer->spinOnce (100);
    boost::this_thread::sleep (boost::posix_time::microseconds (100000));
    
    }
    

    this is my code snippet.

    " Only thing i need to know, How to switch between Normal and Continous scanning mode ".

    Thanks and Regards,
    Ajay

     

    Last edit: Ajay 2015-09-24
  • Ajay

    Ajay - 2015-09-28

    Hello Mehrez Sir,

    Waiting for your response from past 4 days.. Kindly suggest us possible options to get scanning data in continuous mode using cpp Api.

    There is not given any contact details in hokuyo website.

     
  • Mehrez Kristou

    Mehrez Kristou - 2015-09-29

    Sorry for my lae answer,
    I am in the IROS2015 exhibition in Hamburg Germany, so if you are arround you can have a talk.
    Back to the subject, There is a sample code within the library you can give it a try.

    The source would look like this:

    urg_set_scanning_parameter(&urg,
    urg_deg2step(&urg, -90),
    urg_deg2step(&urg, +90), 0);

    urg_start_measurement(&urg, URG_DISTANCE, URG_SCAN_INFINITY, 0);
    while (true) {
        n = urg_get_distance(&urg, data, &time_stamp);
        if (n <= 0) {
            printf("urg_get_distance: %s\n", urg_error(&urg));
            free(data);
            urg_close(&urg);
            return 1;
        }
        print_data(&urg, data, n, time_stamp);
    }
    
    free(data);
    urg_close(&urg);
    

    Regards,
    Kristou Merez

     
  • Ajay

    Ajay - 2015-09-29

    Thank for your response Sir,

    Even though i have tried the sample code that you have specified in your previous response,
    getting scan data interputing for every 100milisecond interval.

    I mean.. i am unable to get data continously, Here is my modified code according your Suggestion ,

    urg.start_measurement(Urg_driver::Distance, Urg_driver::Infinity_times, 0);
    
    //for (int i = 0; i < Capture_times; ++i) {
        vector<long> data;
        long time_stamp = 0;
    
    //    if (!urg.get_distance(data, &time_stamp)) {
    //        cout << "Urg_driver::get_distance(): " << urg.what() << endl;
    //        return 1;
    //    }
    //    print_data(urg, data, time_stamp);
    //}
    
    while(true){
        n=urg.get_distance(data, &time_stamp);
        if(n<=0){
    
            free(&data);
            urg.close();
            return 1;
        }
        print_data(urg, data, time_stamp);
    }
    free(&data);
    urg.close();
    
    I made changes in cpp file.
    
    thanks and Regards,
    Ajay
    
     

    Last edit: Ajay 2015-09-29
  • Ajay

    Ajay - 2015-10-05

    Mehrez Sir,

    Any suggestions Please, We are still strucked in the same problem.

     
  • Mehrez Kristou

    Mehrez Kristou - 2015-10-07

    The sensor scan rate is 100ms. Literally you can get scans only every 100ms.

    The continuous mode is a mode where you send once a request command and the sensor would send continuously the requested data. In this mode the sensor sends the data as soon as it is available. The application should have enough processing power to handle the flow of data.

    In handshake mode, you need to send every time a request command to get one scan. In this mode, it is up to the application to request data depending on its processing pace.

    Hope this helps.
    Kristou

     

    Last edit: Mehrez Kristou 2015-10-07
  • Ajay

    Ajay - 2015-10-08

    Thank you Kristou Sir, Theoritically i have gone through the process that takes in continuous and hand shake mode.

    My Question is to.. How can i request device to send data in continuous mode (What command should need to send, How should i send command ) . Since am using Cpp Api.. I could not able find the way to send command to request data in continuous mode.

    As i saw.. in UrgBenriPlus V2.0.0 exe there is way to switch between continuous and handshake Mode.

    Please , try to suggest .. " HOW CAN I SEND CONTINUOUS MODE COMMAND REQUEST from CPP API. "

     
  • Mehrez Kristou

    Mehrez Kristou - 2015-10-08

    Hi,

    From the library point of view:
    the handshake mode is:
    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    vector<long> data;
    long time_stamp = 0;

    while(true){
    urg.start_measurement(Urg_driver::Distance, 1, 0);
    n=urg.get_distance(data, &time_stamp);
    if(n<=0){
    break;
    }
    print_data(urg, data, time_stamp);
    }
    free(&data);
    urg.close();
    ///////////////////////////////////////////////////////////////////////////////////////////////////////

    the continous mode is:
    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    vector<long> data;
    long time_stamp = 0;

    urg.start_measurement(Urg_driver::Distance, Urg_driver::Infinity_times, 0);
    while(true){
    n=urg.get_distance(data, &time_stamp);
    if(n<=0){
    break;
    }
    print_data(urg, data, time_stamp);
    }
    free(&data);
    urg.close();
    ///////////////////////////////////////////////////////////////////////////////////////////////////////

    As shown in the snippets, requesting one scan at a time in start_measurement results in using the handshake mode under the hood.

    Hope this helps.
    Kristou

     
  • Ajay

    Ajay - 2015-10-08

    Thank you Sir,

    From my first post in regards to this issue, I have mentioned that i have problem with getting continous data, although i have used parameters like ,

    "urg.start_measurement(Urg_driver::Distance, Urg_driver::Infinity_times, 0);"

    Even i have posted code snippet from my program.

    I would appreciate your supports, kindly let me know, even though setting the parameters as above, Reason for not getting continous data.. ?

     
  • Mehrez Kristou

    Mehrez Kristou - 2015-10-09

    Hi,

    I am confused on how to help you. Please, define what do you mean with continous data.
    Providing more information regarding you system and what you are trying to implement could give me some hints on how to help you.

    Regards,
    Kristou

     
  • Ajay

    Ajay - 2015-10-09

    Thank you Sir,

    I am sorry for creating lot of confusion, Let me clear you as simple as possible.

    I am using URG-04LX-UG01 model , for 3D point cloud mapping. In my case am using Cpp Api.
    The term continuous data i have used, Since you have given the same in the UrgBenriPlus V2.0.0 exe .

    I kindly request you to reffer UrgBenriPlus V2.0.0 exe for clear understading of my problem.

    In Non continuous mode: data output will be in some defined interval of time. Where i cant get continously.

    In Continous Mode: data will be output from device continously without any break.

    As your suggestions i have used, messurment parameters as below, even though there is no change in data output from the device.
    I am getting data with some breaks in between ( as same as like Non-Continuous mode in UrgBenriPlus V2.0.0 ) .

    messurment parameters:
    "urg.start_measurement(Urg_driver::Distance, Urg_driver::Infinity_times, 0);"

    Sir, please reffer this UrgBenriPlus V2.0.0 application, and kindly suggest us to how to send command request to device, to send data continously.

    Sir recently we bought UTM-30LX-EW device and spend lot , beliving better quality and service of device.

    We are sorry for creating confusions, with our limited understandings, we appreciate your suggestions in this regard.

     
  • Mehrez Kristou

    Mehrez Kristou - 2015-10-09

    Hi,

    You are confusing the continous mode. Using the application UrgBenriPlus , you would not notice the diffrence between a continuous mode and non-continuous mode. The difference is in the undelying communication.
    The sensor has scan rate (differ depending on model). In the case of URG-04LX-UG01, the scan rate is 100ms (10Hz). Thus, the fastest data rate would be 100ms/scan (data output would be available every 100ms).
    In the case of UTM-30LX-EW, the scan rate is 25ms (40Hz). I thhink, it is the best fit for your application.

    In continuous mode, the user would request the data once and the sensor would send on every cycle the measurement until is it is stopped with a stop request. The communication model is one request multiple responses.
    Example:
    Host -> Sensor : request
    Host <- Sensor : reception
    Host <- Sensor : reception
    Host <- Sensor : reception
    ....
    Host -> Sensor : stop

    in non-cotinuous mode, the user should request the data for every scan. The communication model is one request one response.
    Example:
    Host -> Sensor : request
    Host <- Sensor : reception
    Host -> Sensor : request
    Host <- Sensor : reception
    ...
    Host -> Sensor : request
    Host <- Sensor : reception

    As a summery, your are already using the continuous mode.
    For your 3D point cloud, I think you want to put a timestamp on each point for fusion purpose.
    The data comes with timestamp of the scan expressed in milli-seconds. Therefore, using a simple mathematical calculation whitch take in considaration the scan rate, the point's count and the FOV, you can infer the timestamp for each point separatly. The measurement are (Almost) uniformly distributed in time.

    It is all what we can help you with. Hope this can help.

    Regards,
    Kristou

     

    Last edit: Mehrez Kristou 2015-10-09
  • Ajay

    Ajay - 2015-10-09

    Thank you Sir

     

Anonymous
Anonymous

Add attachments
Cancel