SkoltechRobotics / rplidar

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

Wrong Body Size ERROR fix #24

Closed SamihQabaha closed 5 years ago

SamihQabaha commented 5 years ago

I have A1 with Raspberrypi 3B, and I have encountered the Wrong Body Size, that is because there is a mistake in the rplidar.py file when defining the function start_motor() ,and stop_motor ().

in rplidar.py it is " self._serial_port.setDTR(False) " & "self.motor_running = False" for start_motor(), and "self._serial_port.setDTR(True)" & "self.motor_running = True" for stop_motor(), you need to opposite them.

Feng1909 commented 2 years ago

Execuse me, do you mean we should change it into " self._serial_port.setDTR(True) " & "self.motor_running = True" for start_motor(), and "self._serial_port.setDTR(False)" & "self.motor_running = False" ? Thank you very much

Feng1909 commented 2 years ago

After doing this, I encounter this error:

Traceback (most recent call last):
  File "obstacle_avoidance.py", line 153, in <module>
    lidar_scan = next(iterator)
  File "/home/pi/.local/lib/python3.7/site-packages/rplidar.py", line 357, in iter_scans
    for new_scan, quality, angle, distance in iterator:
  File "/home/pi/.local/lib/python3.7/site-packages/rplidar.py", line 300, in iter_measurments
    status, error_code = self.get_health()
  File "/home/pi/.local/lib/python3.7/site-packages/rplidar.py", line 245, in get_health
    dsize, is_single, dtype = self._read_descriptor()
  File "/home/pi/.local/lib/python3.7/site-packages/rplidar.py", line 189, in _read_descriptor
    raise RPLidarException('Incorrect descriptor starting bytes')
rplidar.RPLidarException: Incorrect descriptor starting bytes