Start doing test.
This commit is contained in:
@@ -15,16 +15,22 @@ DMAX = 4000
|
|||||||
IMIN = 0
|
IMIN = 0
|
||||||
IMAX = 50
|
IMAX = 50
|
||||||
|
|
||||||
|
def update_line(num, iterator, line, prev_groups):
|
||||||
def update_line(num, iterator, line):
|
|
||||||
scan = next(iterator)
|
scan = next(iterator)
|
||||||
# Now update the groups, and then update the maps with different colours for different groups.
|
# Now update the groups, and then update the maps with different colours for different groups.
|
||||||
|
if(prev_groups.groups is None):
|
||||||
|
prev_groups = alg.calc_groups(scan)
|
||||||
|
groups = alg.assign_groups(prev_groups, alg.calc_groups(scan))
|
||||||
offsets = np.array([(np.radians(meas[1]), meas[2]) for meas in scan])
|
offsets = np.array([(np.radians(meas[1]), meas[2]) for meas in scan])
|
||||||
line.set_offsets(offsets)
|
line.set_offsets(offsets)
|
||||||
intens = np.array([meas[0] for meas in scan])
|
intens = np.array([meas[0] for meas in scan])
|
||||||
line.set_array(intens)
|
line.set_array(intens)
|
||||||
return line,
|
return line,
|
||||||
|
|
||||||
|
class Bunch:
|
||||||
|
def __init__(self, **kwds):
|
||||||
|
self.__dict__.update(kwds)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
lidar = MockLidar(loader.load_scans_bytes_file("tracking/out.pickle"))
|
lidar = MockLidar(loader.load_scans_bytes_file("tracking/out.pickle"))
|
||||||
@@ -34,10 +40,10 @@ def run():
|
|||||||
cmap=plt.cm.Greys_r, lw=0)
|
cmap=plt.cm.Greys_r, lw=0)
|
||||||
ax.set_rmax(DMAX)
|
ax.set_rmax(DMAX)
|
||||||
ax.grid(True)
|
ax.grid(True)
|
||||||
|
prev_groups = Bunch(groups=None)
|
||||||
iterator = lidar.iter_scans()
|
iterator = lidar.iter_scans()
|
||||||
ani = animation.FuncAnimation(fig, update_line,
|
ani = animation.FuncAnimation(fig, update_line,
|
||||||
fargs=(iterator, line), interval=50)
|
fargs=(iterator, line, prev_groups), interval=50)
|
||||||
plt.show()
|
plt.show()
|
||||||
lidar.stop()
|
lidar.stop()
|
||||||
lidar.disconnect()
|
lidar.disconnect()
|
||||||
|
|||||||
Reference in New Issue
Block a user