<div dir="ltr"><a class="gmail-anchor-3Z-8Bb gmail-anchorUnderlineOnHover-2ESHQB" title="https://learn.adafruit.com/slamtec-rplidar-on-pi/cpython-on-raspberry-pi" href="https://learn.adafruit.com/slamtec-rplidar-on-pi/cpython-on-raspberry-pi" rel="noreferrer noopener" target="_blank" role="button" tabindex="0" style="margin:0px;padding:0px;border:0px;font-family:Whitney,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;vertical-align:baseline;text-decoration-line:none;outline:0px;word-break:break-word;white-space:break-spaces;background-color:rgba(4,4,5,0.07)">https://learn.adafruit.com/slamtec-rplidar-on-pi/cpython-on-raspberry-pi</a><span style="color:rgb(220,221,222);font-family:Whitney,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;white-space:break-spaces;background-color:rgba(4,4,5,0.07)"> -</span><span style="color:rgb(220,221,222);font-family:Whitney,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;white-space:break-spaces;background-color:rgb(255,255,255)"> </span><span style="font-family:Whitney,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;white-space:break-spaces;background-color:rgb(255,255,255)"><font color="#000000" style="">The relevant code is below
</font></span><pre style="margin-top:6px;margin-bottom:0px;padding:0px;border:0px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;font-size:0.75rem;vertical-align:baseline;border-radius:4px;line-height:1rem;white-space:pre-wrap;background-clip:border-box;box-sizing:border-box;max-width:90%"><code class="gmail-scrollbarGhostHairline-1mSOM1 gmail-scrollbar-3dvm_9 gmail-hljs" style="margin:0px;padding:0.5em;font-weight:inherit;font-style:inherit;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;font-size:0.875rem;vertical-align:baseline;line-height:1.125rem;display:block;overflow-x:auto;border-radius:4px"><font color="#000000" style="background-color:rgb(255,255,255)">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()</font></code></pre><span style="font-family:Whitney,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;white-space:break-spaces"><font color="#000000" style="background-color:rgb(255,255,255)">
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
</font></span><br></div>