YDLIDAR / YDLidar-SDK

Driver for receiving YD LiDAR data and more...
Other
119 stars 221 forks source link

YDLidar X2: Error, cannot retrieve YDLidar health code: ffffffff when running python examples #17

Closed thehamzan6 closed 2 years ago

thehamzan6 commented 2 years ago

If I run ./ydlidar-test, it works fine. However, running with python, it does not work.

I receive the following error:

python/examples $ python3 test.py 
YDLidar SDK initializing
YDLidar SDK has been initialized
[YDLIDAR]:SDK Version: 1.0.3
LiDAR successfully connected
Error, cannot retrieve YDLidar health code: ffffffff
get Device Information Error
[CYdLidar::initialize] Error initializing YDLIDAR check status under [/dev/ttyUSB0] and [230400].
thehamzan6 commented 2 years ago

I fixed the problem.

Under the python code, since the Lidar X2 is one-way communication, I have to set the following line:

laser.setlidaropt(ydlidar.LidarPropSingleChannel, False);

To

laser.setlidaropt(ydlidar.LidarPropSingleChannel, True);
thehamzan6 commented 2 years ago
$ python3 test.py 
YDLidar SDK initializing
YDLidar SDK has been initialized
[YDLIDAR]:SDK Version: 1.0.3
LiDAR successfully connected
[YDLIDAR]:Lidar running correctly ! The health status: good
LiDAR init success!
3052528704 thread has been canceled
[CYdLidar] Failed to turn on the Lidar, because the lidar is [No error].

I am receiving this error now. How odd. Anyone has any idea?

thehamzan6 commented 2 years ago

Changing the baud_rate to:

laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 230400);

to

laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 115200);

Fixed the error.