def draw_scan(channel, data): global points global isinit msg = laser_t.decode(data) rad = [msg.radstep * i + msg.rad0 for i in range(0, msg.nranges)] x = [cos(rad[i]) * msg.ranges[i] for i in range(0, msg.nranges)]; y = [sin(rad[i]) * msg.ranges[i] for i in range(0, msg.nranges)]; update_axes(x, y) points = [[x[i], y[i]] for i in range(0, msg.nranges)]; glutPostRedisplay()
def handler(channel, data): msg = laser_t.decode(data) print("Number of ranges " + str(msg.radstep))