Open camelator opened 2 years ago
hi, i solved problem. but im not certain that this is perfect solution. i found handleVersionInfoByPackage occur buffer error in c++ code.
just rid off handleVersionInfoByPackage(debug); code at CYdLidar.cpp and then build again
CYdLidar.cpp is at src/CydLidar.cpp
Here is the simple python code. I have the same parameters for the c++ code and it works. I am using Ubuntu 20.04
import ydlidar
port = "/dev/ttyUSB1";
laser = ydlidar.CYdLidar(); laser.setlidaropt(ydlidar.LidarPropSerialPort, port); laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 153600) laser.setlidaropt(ydlidar.LidarPropLidarType, ydlidar.TYPE_TRIANGLE); laser.setlidaropt(ydlidar.LidarPropDeviceType, ydlidar.YDLIDAR_TYPE_SERIAL); laser.setlidaropt(ydlidar.LidarPropScanFrequency, 8.0); laser.setlidaropt(ydlidar.LidarPropSampleRate, 4); laser.setlidaropt(ydlidar.LidarPropSingleChannel, True); laser.setlidaropt(ydlidar.LidarPropIntenstiy, True); laser.setlidaropt(ydlidar.LidarPropSupportMotorDtrCtrl,False); laser.setlidaropt(ydlidar.LidarPropFixedResolution,False) ; laser.setlidaropt(ydlidar.LidarPropReversion,False) laser.setlidaropt(ydlidar.LidarPropInverted,False) laser.setlidaropt(ydlidar.LidarPropAutoReconnect,True) laser.setlidaropt(ydlidar.LidarPropSupportHeartBeat,False)
laser.setlidaropt(ydlidar.LidarPropMaxAngle,180.0) laser.setlidaropt(ydlidar.LidarPropMinAngle,0.0) laser.setlidaropt(ydlidar.LidarPropMaxRange,64.0) laser.setlidaropt(ydlidar.LidarPropMinRange,0.05)
ret = laser.initialize(); if ret: ret = laser.turnOn(); scan = ydlidar.LaserScan() while ret and ydlidar.os_isOk() : r = laser.doProcessSimple(scan); if r: print("Scan received[",scan.stamp,"]:",scan.points.size(),"ranges is [",1.0/scan.config.scan_time,"]Hz"); else : print("Failed to get Lidar Data.") laser.turnOff(); laser.disconnecting();
Display: 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! [YDLIDAR1]:Fixed Size: 720 [YDLIDAR1]:Sample Rate: 4K [YDLIDAR1]:Fixed Size: 720 [YDLIDAR1]:Sample Rate: 4K [YDLIDAR]:Single Fixed Size: 570 [YDLIDAR]:Sample Rate: 4K [YDLIDAR INFO] Current Sampling Rate : 4K [YDLIDAR INFO] Now YDLIDAR is scanning ...... buffer overflow detected : terminated
The issue comes from the line below, but I am not able to debug. /Maybe someone can help me?
r = laser.doProcessSimple(scan)