def animate(i):
    analog_data = parser.readLidar()
    for index, item in enumerate(analog_data):
        x, y = pol2cart(item, x_data[index])
        if abs(x) > 2000:
            x = 0
        if abs(y) > 2000:
            y = 0
        ptArray[x + 2000][y + 2000] = 200
    lines[0].set_data(x_data, analog_data)
    '''print np.sum(ptArray)'''
    return tuple(lines)
def animate(i):
    analog_data=parser.readLidar()
    for index, item in enumerate(analog_data):
    	x,y = pol2cart(item,x_data[index])
    	if abs(x) > 2000:
    		x=0
    	if abs(y) > 2000:
    		y=0
    	ptArray[x+2000][y+2000]=200
    lines[0].set_data(x_data, analog_data)
    '''print np.sum(ptArray)'''
    return tuple(lines)
示例#3
0
def animate(i):
    global start, last_x
    newnow = datetime.datetime.now();
    delta = newnow - start;
    start = newnow
    seconds = delta.total_seconds();
    #print("time since last animate = ", seconds)
    samples = round(seconds * 5000)
    x = np.linspace(last_x, last_x + seconds, samples)
    last_x += seconds;
    analog_data[0]=parser.readLidar()
    analog_data[1].extend(np.add(np.multiply(np.abs(np.sin(2 * np.pi * x * -1.0)), .3), 1.3))
    lines[0].set_data(x_data, analog_data[0])
    return tuple(lines)
示例#4
0
def animate(i):
    global start, last_x
    newnow = datetime.datetime.now()
    delta = newnow - start
    start = newnow
    seconds = delta.total_seconds()
    #print("time since last animate = ", seconds)
    samples = round(seconds * 5000)
    x = np.linspace(last_x, last_x + seconds, samples)
    last_x += seconds
    analog_data[0] = parser.readLidar()
    analog_data[1].extend(
        np.add(np.multiply(np.abs(np.sin(2 * np.pi * x * -1.0)), .3), 1.3))
    lines[0].set_data(x_data, analog_data[0])
    return tuple(lines)