-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_br24.py
executable file
·38 lines (36 loc) · 1.24 KB
/
test_br24.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
import br24_driver
import time
if __name__ == '__main__':
br = br24_driver.br24()
br.start()
br.set_radar_range(5)
br.reset_scan_speed()
angle_increment = 360.0/4096.0
try:
last_angle = -1
start_time = time.time()
count = 0
while True:
#if br.scanline_ready():
sc = br.get_scanline()
#print sc
curr_angle = sc['angle']*angle_increment
curr_idx = sc['index']
#print (sc.index,curr_angle)
if last_angle > curr_angle:
# e.g. 360 > 1
curr_time = time.time()-start_time
print "finished full scan: %s %s"%(curr_time,last_angle)
print "processed %d scan lines"%(count)
print "socket queue size: %d"%(br.data_q.qsize())
print "scanline queue size: %d"%(br.scan_data_decoder.scanlines.qsize())
count = 0
start_time = time.time()
last_angle = curr_angle
count+=1
#else:
# time.sleep(0.001)
except KeyboardInterrupt:
print "Stopping radar.."
br.stop()