You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing on the A1M8 which is not set up for variable motor speed using the Slamtec USB adapter board I found that this initiating command leaves the CTRL_MOT line low, after which the motor comes to a stop. This line is actually DTR on the UART. Most example code for scanning immediately implements "lidar.set_motor_pwm(500)", which in turn clears DTR and the motor continues to run. I found that sending other commands did not fix this and only the set_motor_pwm() command corrected the state of DTR. Failure to use the set_motor_pwm() command after the connect() command will cause scans to fail. The use of no other command fixes DTR and it remains low. In the Slamtec C++ SDK in net_serial.cpp these lines of code are found which addresses the point.
//Clear the DTR bit to let the motor spin
clearDTR();
To demonstrate the issue here one can use the following test code but with a time delay.
Testing on the A1M8 which is not set up for variable motor speed using the Slamtec USB adapter board I found that this initiating command leaves the CTRL_MOT line low, after which the motor comes to a stop. This line is actually DTR on the UART. Most example code for scanning immediately implements "lidar.set_motor_pwm(500)", which in turn clears DTR and the motor continues to run. I found that sending other commands did not fix this and only the set_motor_pwm() command corrected the state of DTR. Failure to use the set_motor_pwm() command after the connect() command will cause scans to fail. The use of no other command fixes DTR and it remains low. In the Slamtec C++ SDK in net_serial.cpp these lines of code are found which addresses the point.
To demonstrate the issue here one can use the following test code but with a time delay.
from pyrplidar import PyRPlidar
import time
lidar = PyRPlidar()
lidar.connect(port="/dev/ttyUSB0", baudrate=115200, timeout=3)
info = lidar.get_info()
print("info :", info)
health = lidar.get_health()
print("health :", health)
samplerate = lidar.get_samplerate()
print("samplerate :", samplerate)
scan_modes = lidar.get_scan_modes()
print("scan modes :")
for scan_mode in scan_modes:
print(scan_mode)
time.sleep(6.0)
#now watch the motor come to a stop
#after disconnect() the motor starts again
lidar.disconnect()
The text was updated successfully, but these errors were encountered: