Skip to content

Commit

Permalink
in scan function list out of range in corner cases is eliminated
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshmanmallidi committed May 20, 2019
1 parent fb0bb95 commit 85f7a22
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions PyLidar3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 85f7a22

Please sign in to comment.