def run():
    plt.ion()
    laser = HokuyoLX()
    ax = plt.subplot(111, projection='polar')
    plot = ax.scatter([0, 1], [0, 1], s=5, c=[IMIN, IMAX], cmap=plt.cm.Greys_r, lw=0)
    text = plt.text(0, 1, '', transform=ax.transAxes)
    ax.set_rmax(DMAX)
    ax.grid(True)
    plt.show()
    while plt.get_fignums():
        update(laser, plot, text)
    laser.close()
Exemple #2
0
def run():
    plt.ion()
    laser = HokuyoLX()
    ax = plt.subplot(111, projection='polar')
    plot = ax.plot([], [], '.')[0]
    text = plt.text(0, 1, '', transform=ax.transAxes)
    ax.set_rmax(DMAX)
    ax.grid(True)
    plt.show()
    while plt.get_fignums():
        update(laser, plot, text)
    laser.close()
def run():
    plt.ion()
    laser = HokuyoLX()
    ax = plt.subplot(111, projection='polar')
    plot = ax.plot([], [], '.')[0]
    text = plt.text(0, 1, '', transform=ax.transAxes)
    ax.set_rmax(DMAX)
    ax.grid(True)
    plt.show()
    while plt.get_fignums():
        update(laser, plot, text)
    laser.close()
Exemple #4
0
def run():
    plt.ion()
    laser = HokuyoLX(tsync = False)
    laser.convert_time = False
    ax = plt.subplot(111, projection='polar')
    plot = ax.scatter([0, 1], [0, 1], s=5, c=[IMIN, IMAX], cmap=plt.cm.Reds, lw=0)
    text = plt.text(0, 1, '', transform=ax.transAxes)
    ax.set_rmax(DMAX)   
    ax.grid(True)
    plt.show()
    while plt.get_fignums():
        update(laser, plot, text)
    laser.close()
Exemple #5
0
def run():
    plt.ion()
    laser = HokuyoLX(tsync=False)
    laser.convert_time = False
    ax = plt.subplot(111, projection='polar')
    plot = ax.scatter([0, 1], [0, 1], s=10, c='b', lw=0)
    text = plt.text(0, 1, '', transform=ax.transAxes)
    ax.set_rmax(DMAX)
    ax.grid(True)
    images.append((plot, ))
    plt.show()
    while plt.get_fignums():
        update(laser, plot, text)
    laser.close()
def generateSampleDist():

    lidar = HokuyoLX()

    _, data = lidar.get_filtered_dist()

    data = data.tolist()

    fileName = input("Enter a file name: ")

    with open(str(fileName) + ".txt", 'w') as pw:
        for i in range(len(data)):
            pw.write(str(data[i][0]) + "," + str(data[i][1]))
            if i != len(data) - 1:
                pw.write("\n")
            pw.close()
    lidar.close()
pos_x = 0
pos_y = 0
step_index = 2
color_index = 0
orientation = 0

dataset = []
plots = []

laser = HokuyoLX()
fig, ax = plt.subplots()
arrow_obj = Arrow(pos_x,
                  pos_y,
                  1000 * math.sin(orientation),
                  1000 * math.cos(orientation),
                  width=200,
                  color="red")
arrow = ax.add_patch(arrow_obj)
text = plt.text(0,
                1,
                'x: %d y: %d step = %d' % (pos_x, pos_y, STEPS[step_index]),
                transform=ax.transAxes)
ax.set_xlim(-DMAX, DMAX)
ax.set_ylim(-DMAX, DMAX)
ax.grid(True)
fig.canvas.mpl_connect('key_press_event', press)
plt.draw()
plt.show()
laser.close()