Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using rplidar in matlab #1

Open
RoboEvangelist opened this issue Aug 20, 2018 · 6 comments
Open

Problems using rplidar in matlab #1

RoboEvangelist opened this issue Aug 20, 2018 · 6 comments
Labels

Comments

@RoboEvangelist
Copy link

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?

@lebarsfa
Copy link
Member

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 :

  • Right-click and Add to Path (or go to File\Set Path...\Add Folder... and add) this folder as well as x64 folder if you use MATLAB 64 bit.
  • Run test_hokuyo.m or test_rplidar.m.

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.

@Davo-Exp4
Copy link

Great code! Do you think that it will work with a rplidar A1?

@lebarsfa
Copy link
Member

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 e5247c8 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...

@lebarsfa
Copy link
Member

In the commit 9c6a17a, 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...

@TuilaMadMars
Copy link

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.

@lebarsfa
Copy link
Member

lebarsfa commented Sep 21, 2018

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 #1 (comment) . 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...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants