Skip to content

problem with the scan data #17

Open
nohhem opened this issue Feb 25, 2018 · 1 comment
Open

problem with the scan data #17

nohhem opened this issue Feb 25, 2018 · 1 comment

Comments

@nohhem
Copy link

nohhem commented Feb 25, 2018

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

@nohhem
Copy link
Author

nohhem commented Feb 25, 2018

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    `

screenshot 4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant