title: too many measurments in the input buffer in rplidar
body: <p>I am using a RPLidar A1 in python. 
  it looks pretty perfect and this is my code below
  it is originally from <a href="https://github.com/SkoltechRobotics/rplidar/blob/master/examples/animate.py#L1" rel="nofollow noreferrer">https://github.com/SkoltechRobotics/rplidar/blob/master/examples/animate.py#L1</a>
  GitHub.</p>
  
  <pre><code>#!/usr/bin/env python3
  '''Animates distances and measurment quality'''
  from rplidar import RPLidar
  import matplotlib.pyplot as plt
  import numpy as np
  import matplotlib.animation as animation
  
  PORT_NAME = '/dev/ttyUSB0'
  DMAX = 4000
  IMIN = 0
  IMAX = 50
  
  def update_line(num, iterator, line):
      scan = next(iterator)
      offsets = np.array([(np.radians(meas[1]), meas[2]) for meas in scan])
      line.set_offsets(offsets)
      intens = np.array([meas[0] for meas in scan])
      line.set_array(intens)
      return line,
  
  def run():
      lidar = RPLidar(PORT_NAME)
      fig = plt.figure()
      ax  = plt.subplot(111, projection='polar')
      line = ax.scatter([0, 0], [0, 0], s=5, c=[IMIN, IMAX],
                             cmap=plt.cm.Greys_r, lw=0)
      ax.set_rmax(DMAX)
      ax.grid(True)
  
      iterator = lidar.iter_scans()
      ani = animation.FuncAnimation(fig, update_line,
          fargs=(iterator, line), interval=50)
      plt.show()
      lidar.stop()
      lidar.disconnect()
  
  if __name__ == '__main__':
      run()
  </code></pre>
  
  <p>but it has issues like this picture.<a href="https://i.stack.imgur.com/pLyGC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pLyGC.png" alt="enter image description here"></a></p>
  
  <p>I think that it is because of something buffer. But no idea how to handle this one. if you help me about this issues, I really appreciate of it.
  I have no idea why this is happened please let me know Thank you!</p>