Open RoboEvangelist opened 6 years ago
Hello,
Only 2 types of LIDARs are supposed to work with that library : Hokuyo URG-04LX-UG01 and RPLIDAR A2 (however since there are several hardware revisions, I don't know if some of them could be incompatible). As samples, you have the files test_hokuyo.m and test_rplidar.m that are provided.
For them to work on your computer, you will probably need to change the RS232 port (e.g. COM9) in their respective configuration files Hokuyo0.txt and RPLIDAR0.txt.
Ensure that you closed any other application that might use the devices.
Launch MATLAB preferably by right-clicking on Run as administrator on MATLAB shortcut (this is sometimes required to be able to access serial devices).
Then, follow the ReadMe.txt steps :
Note that you need to press the ESC key to exit cleanly the test script, if you interrupt the script by CTRL+C MATLAB might crash or you might not be able to launch successfully again the test script...
If you still have problems, please tell me more about the exact hardware, software, OS versions that you have.
Great code! Do you think that it will work with a rplidar A1?
I just realize that I probably never tested the MATLAB code with any RPLIDAR since I found an obvious index bug in test_rplidar.m (see commit e5247c82c36bfd203f43c49e8661d6ed4451d108 of today). At the moment I quickly tested a RPLIDAR A2 and it seemed to work more or less (the display of the data is not made intelligently at the moment), however an old RPLIDAR A1M1 did not work (and I could not upgrade its firmware) because it does not seem to support EXPRESS SCAN feature. I will try to solve that in the following days since anyway I have several updates from other projects to push in that repository...
In the commit 9c6a17ad5059a9d5f39420056c987fb24369ae3e, among other things I added some support to my old RPLIDAR A1M1 by using SCAN instead of EXPRESS SCAN, but whatever the RPLIDAR hardware version I test, I am not sure that the data are correctly retrieved for now, or maybe it's only due to problems in the display part... However Hokuyo URG-04LX-UG01 is working well, but its protocol is significantly different...
Thanks pro. I have a problem with RPLIDAR A1M8, i run test_rplidar.m and have warning: "Warning: The data type 'error' used by structure NAV_PVT_PL_UBX does not exist. The structure may not be usable". i receive only 1 data.."Distance at 0.000000 deg = 0.000000 m" Can you help me? I connect RPLIDAR to my laptop by USB UART.
Thoses warnings are not related to the RPLIDAR part, so there is another problem. For that version of the RPLIDAR, you need to ensure you use the latest commit (or beta release https://github.com/ENSTABretagneRobotics/Hardware-MATLAB/releases/tag/v1.3.1.1 that I just made), the previous releases were not working at all with my RPLIDAR A1M1 so it might be the same for A1M8. Otherwise, ensure that you followed the steps described in https://github.com/ENSTABretagneRobotics/Hardware-MATLAB/issues/1#issuecomment-414432990 . Also, check that the device is working with the apps from the manufacturer, and reboot if you realize that sometimes it does not work, it could be because some unknown app is already trying to access the serial port (I get often that problem, not sure why...).
I'm trying to use this code to interface with my lidar but am having trouble using the commands. Can anyone provide sample code that would give basic interface with the device?