Multiple Slamtec LIDAR Connection Issues with MATLAB

  • So this is a little bit of a shot in the dark.... but here we go ...

    I'm running into some initial LIDAR connection issue with simultaneously connecting 4 Slamtec RPLIDAR A3 using MATALB

    with the provided interface library found here: https://github.com/ENSTABretagneRobotics/Hardware-MATLAB


    The issue is that I am having to retry the connection on at least one of the LIDARS before it connects.

    And it can also vary with LIDAR that is. That is, all but one LIDAR connects the first time.

    One time, it could be LIDAR on one COM port, another time it could be a LIDAR on another COM port.


    This is the way it is set up right now.

    Basically MATALB loads the provided interface library, hardwarex.dll. That exposes some library methods to be used by MATLAB.


    The method to connect the LIDAR does the following:

    1. Opens the RS232 port
    2. Sets port options
    3. Gets some info and health statuses form lidar
    4. Sets the motor PWM to zero (stop lidar motor)
    5. Uses express scan mode option


    Here somewhere the communication will error out.

    Using a serial sniffer I was able to see that the LIDAR errors out after the following message to the LIDAR:


    a5 f0 02 ff 03 ab a5 25 a5 82 05 00 00 00 00 00 22


    Which I tracked to the following library methods, in that order

    1. SetMotorPWMRequestRPLIDAR()
    2. CheckMotorControlSupportRequestRPLIDAR()
    3. StopRequestRPLIDAR()
    4. StartExpressScanRequestRPLIDAR() <-- Error here


    To which the LIDAR responds with:


    a5 5a 54 00 00 40 82


    Where as a successfully connection response from the LIDAR much longer in content.


    ------------------------------------------------------------------------------------------


    Things I've tried

    • Drain (force all write data) the write buffer with the interface libraries DrainComputerRS232Port() method before and/or after any write to lidar.
    • Setting the TX/Write OS FIFO buffer to FILE_FLAG_NO_BUFFERING (ie. WriteFile()).
    • Changing the Hardware FIFO buffer form max (16) to min (1).
    • Using MATLAB's serial() command to flush any input or output buffers prior to loading the library or trying the connections.


    ------------------------------------------------------------------------------------------


    This is the system and settings I am working with


    Lidar (x4):

    • Slamtec RPLIDAR A3
    • Connected via USB (no USB hub used)
    • No other COM port devices connected


    Computer

    • OS: Windows 10 Pro - Build 1903
    • CPU: Intel Xeon 3.00Ghz
    • RAM: 64 GB
    • HD: SSD - 512GB NVMe


    Serial Port Settings

    • Boud Rate: 256000
    • Timeout: 1000


    Software

    • MATLAB R2018b (9.5.0)


    Any help is much much appreciated!

  • Place your Ad here!
  • massula

    Approved the thread.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners