SkoltechRobotics / rplidar

Python module for RPLidar A1 and A2 rangefinder scanners
MIT License
186 stars 126 forks source link

How to get one measurement at a time #37

Open bolin01 opened 3 years ago

bolin01 commented 3 years ago

Hi, this is a great repository! All the examples work out great for me. The only problem I have is when I call lidar.iter_scan(), it returns measurement continuously and the program just stucks there so that I can not do that tasks in the code. I am curious how can I get one measurement at a time from lidar so that I can do others tasks in a while loop.

Pseudo code for my desired program is: while True:

  1. Get raspberry pi v2 camera image
  2. Get measurement from lidar (when I use lidar.iter_scan(), lidar starts returning scans continuously and the program gets stuck here forever)
  3. Command robot to move

Appreciate your help.

emilbak5 commented 3 years ago

Did you ever get this solved? I am having the exact same problem.