diff --git a/PyLidar3/__init__.py b/PyLidar3/__init__.py index 8fa6553..b0f23ad 100644 --- a/PyLidar3/__init__.py +++ b/PyLidar3/__init__.py @@ -120,13 +120,16 @@ def StartScanning(self): distdict.update({i:[]}) data = self._s.read(self.chunk_size).split(b"\xaa\x55")[1:-1] for e in data: - if(e[0]==0): - if(YdLidarX4._CheckSum(e)): - d = YdLidarX4._Calculate(e) - for ele in d: - angle = floor(ele[1]) - if(angle>=0 and angle<360): - distdict[angle].append(ele[0]) + try: + if(e[0]==0): + if(YdLidarX4._CheckSum(e)): + d = YdLidarX4._Calculate(e) + for ele in d: + angle = floor(ele[1]) + if(angle>=0 and angle<360): + distdict[angle].append(ele[0]) + except Exception as e: + pass for i in distdict.keys(): distdict[i]=self._Mean(distdict[i]) yield distdict diff --git a/setup.py b/setup.py index 39ddbd8..4b18b82 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="PyLidar3", python_requires=">=3.4", - version="1.4", + version="1.5", author="Lakshman mallidi", author_email="lakshman.mallidi@gmail.com", description="Library for Lidar. Currently supports YdLidar(X4,G4) from http://www.ydlidar.com",