[Dprglist] Need help with getting a map of the house using RPLidar with RPi

Thalanayar Muthukumar tnkumar at gmail.com
Sun Nov 21 09:35:53 PST 2021


https://learn.adafruit.com/slamtec-rplidar-on-pi/cpython-on-raspberry-pi - The
relevant code is below

def process_data(data):
    global max_distance
    lcd.fill((0,0,0))
    for angle in range(360):
        distance = data[angle]
        if distance > 0:                  # ignore initially
ungathered data points
            max_distance = max([min([5000, distance]), max_distance])
            radians = angle * pi / 180.0
            x = distance * cos(radians)
            y = distance * sin(radians)
            point = (160 + int(x / max_distance * 119), 120 + int(y /
max_distance * 119))
            lcd.set_at(point, pygame.Color(255, 255, 255))
    pygame.display.update()

This code is used to update the TFT display and is working for me.
Instantaneously, the RPLidar's surroundings are displayed on the TFT
display. I would like to adapt this to move the RPLidar through the rooms
of the house to create a map. @Chris - Any suggestions or pointers? I do
not have ROS installed. Regards. - Kumar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20211121/e587a5dc/attachment.html>


More information about the DPRGlist mailing list