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

Rplidar 3 descriptor length mismatch #5

Open
Mytre opened this issue Aug 17, 2020 · 8 comments
Open

Rplidar 3 descriptor length mismatch #5

Mytre opened this issue Aug 17, 2020 · 8 comments

Comments

@Mytre
Copy link

Mytre commented Aug 17, 2020

I am having this issue right now with a3 trying to do a scan. anybody knows how to solve this issue?

@gzchenjiajun
Copy link

same problem

@Mytre
Copy link
Author

Mytre commented Aug 19, 2020

This seems to be an issue with newer firmware versions? an example using start_scan_express, depending on the value i can have pyrplidarprotocolerror from line 54 on pyrplidar.py, and also an error on line 151 on pyrplidar.py data =self.receive_data(discriptor) .

changing start_scan_Express(3) to 4 gives me this, using 2 or one I get sync bytes are mismatched and no idea how to fix this.

@Mytre
Copy link
Author

Mytre commented Sep 16, 2020

This error alongside bytes mismatch happen if you try to run any type of scan while the LiDAR has the motor on , disconnecting the lidar and stopping motor and reconnecting will make this error go away as long as you had set up the A3 by editing libraries to adjust for the baudrate.

@AdroitBit
Copy link

AdroitBit commented May 17, 2022

I solve this issue by adding baudrate=256000 argument into RPLidar class and the lidar just spins. (reconnection still required)

@kamil52512
Copy link

On Windows 10, modifying a file the pyrplidar_serial.py from library helps.
In line 13 replace:
"self._serial = serial.Serial(port, baudrate, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=timeout, dsrdtr=True)"
to
" self._serial = serial.Serial(port, baudrate, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=timeout, dsrdtr=False)"

@egonzalez1958
Copy link

I'm using an A2-M12, and get:
File "usr/local/lib/python3.7/dist-packages/pyrplidar.py", line 156, in scan_generator
data = self.receive_data(discriptor)
File "usr/local/lib/python3.7/dist-packages/pyrplidar.py", line 54, in receive_data
raise PyRPlidarProtocolError()
pyrplidar_protocol.PyRPlidarProtocolError

Any hint on handling this problem that happens randomly?

@octotus
Copy link

octotus commented Mar 23, 2024

Very long frustrating story short: the slamtec LiDARs are very touchy about their baudrate. I have a slamtec C1 unit. Chased down its baudrate in the documentation - once that was set, it connected well; am not getting the "descriptor length mismatch" error anymore. Check your lidar's document for the baudrate.

@AlperShal
Copy link

AlperShal commented Dec 11, 2024

After reading @octotus's comment I have remembered that RPLidar S2M1-R2 I am using had a mention of it's baud rate being 1M in it's documentation. I first didn't use 1M as baud rate because I couldn't find any example of baud rate being set as 1 million for any device. (What 1M means wasn't clear to me too) Whatever, I have given it a go and I was able to get device health and info. When it came to scanning I again got the same error. Looks like for get_health, get_info etc. commands the baud rate is 1 million but for scanning etc. it is 115200.

So result is: Initialize the connection with 1 million, get whatever single response data you want and before actually using the scanner functions change the baud rate to 115200. If you again need to get a single response data, set the baud rate back and forth accordingly.

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

No branches or pull requests

7 participants