Open nohhem opened 6 years ago
in addition I wrote this code to illustrate more clearly I made some changes inside the loop so that I: 1-make list with 360 length 2-round both the degree and distance to an integer. 3-use degree as index, distance as value. 4- and 9999 for initial value. 5-after taking the data from scan object and assign it to the list, the empty indices will have a value of 9999 which mean i did not get a value for those degrees. as you will see in the image below
`try: print('Recording measurments... Press Crl+C to stop.') for scan in lidar.iter_scans(): print type(scan)
list=[9999 for _ in range(360)]
for tup in scan:
## tup ={quality,degree,distance mm}
degree_index=int(round(tup[1]))%360
distance=int(round(tup[2]))
list[degree_index]=distance
print list `
when I run record_scans.py and inside this for loop here :
try: print('Recording measurments... Press Crl+C to stop.') for scan in lidar.iter_scans(): data.append(np.array(scan)) except KeyboardInterrupt:
instead of data.append(np.array(scan)) line I print the "scan" object which is tuple that contain (quality,degree,distance)
but the problem is that I do not get 360 measurements in the scan, in each loop I get different number of measurement in a "scan" object, note that I did not change the lidar's position when it test it.
can you explain the cause or the solution to this problem urgently.
many thanks in advance