def __init__(self, buffer): """ Function to controll the Lidar Sensor. Writen especially for the RPLidar A2M8 :param buffer: Queue() - used for multiprocessing """ self.lidar = rp("/dev/tty.SLAB_USBtoUART") self.__buffer = buffer
def __init__(self, buffer): self.__buffer__ = buffer self.lidar = rp('/dev/tty.SLAB_USBtoUART') time.sleep(2)
def __init__(self, buffer): self.lidar = rp("/dev/tty.SLAB_USBtoUART") self.__buffer = buffer
import numpy as np from rplidar import RPLidar as rp import time def get_coords(g, d): x = int(round(np.cos(g * np.pi / 180) * d, 1)) y = int(round(np.sin(g * np.pi / 180) * d, 1)) return x, y def map_coords(points, position): return points[0] + position[0], points[1] + position[1] lidar = rp("/dev/tty.SLAB_USBtoUART") lidar.connect() lidar.start_motor() print(lidar.get_info()) time.sleep(2) karte = np.zeros((7000, 7000)) position = (3500, 3500) try: counter = 0 for i, scan in enumerate(lidar.iter_scans()): print(i) print(scan[0]) if i % 3 == 1: counter = 0 karte = np.zeros((7000, 7000))