Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#303 Error checking and better timeouts in SICK LMS200

closed
Brian Gerkey
Player (393)
5
2008-08-30
2008-07-12
Christopher Head
No

The sicklms200 driver currently implements read timeouts by spinning around a usleep(1000). A better solution in terms of CPU usage is to use select() with a timeval specified. On my particular machine, the driver didn't even work with the original code (it ran into timeouts all over the place, possibly due to high CPU load leaving little time for kernel processes to manage the USB stack, as I was using a USB-serial converter). After re-implementing the code to use select() instead, the problem seems to be solved and I successfully ran player for a few minutes with playerv watching the LIDAR.

As a result, it is no longer necessary to switch the file descriptor between blocking and nonblocking mode. Instead, the FD is kept in blocking mode at all times, and read() is only called if select() indicates readability. Since for a serial port the only time read() blocks is when no data is waiting, this is adequate.

Also, the return value of read() was never checked for errors or EOFs. I have implemented these checks as well.

Discussion

  • Toby Collett
    Toby Collett
    2008-08-30

    Logged In: YES
    user_id=974361
    Originator: NO

    fixed/patches in release-2-1-patches

     
  • Toby Collett
    Toby Collett
    2008-08-30

    • status: open --> closed