robopeak / rplidar_ros

BSD 2-Clause "Simplified" License
453 stars 370 forks source link

udev rule causes occasional failure on launch #75

Closed Achllle closed 5 years ago

Achllle commented 6 years ago

I occasionally get an error launching my A2 indicating that ROS can't establish a connection with it, the same error as when the lidar isn't plugged in:

[ERROR] [1538678043.322231936]: Error, operation time out. RESULT_OPERATION_TIMEOUT! 
[rplidar-2] process has died [pid 21040, exit code 255, cmd /opt/ros/kinetic/lib/rplidar_ros/rplidarNode __name:=rplidar __log:=/home/user/.ros/log/10be304a-c804-11e8-a5ac-646e69630aab/oil-navigation-lidar-rplidar-2.log].
log file: /home/user/.ros/log/10be304a-c804-11e8-a5ac-646e69630aab/oil-navigation-lidar-rplidar-2*.log

The problem is resolved when the USB is unplugged and replugged. This made me suspect that the problem is due to the udev rule in the scripts folder and indeed, when I directly specify the portname using the ttyUSB* name, I never get the error. I tested this by repeatedly launching through the symlink 'rplidar' and continuously failing and the specifying the direct portname instead and it immediately working.

I also opened this issue on the slamtec repo as I only saw this seemingly more active one later

kintzhao commented 6 years ago

@Achllle may be the device port rplidar is blocked by OS(because of other node process) , it is fine when you replugged.

when you happen again, give some message in detail by the following command: ls -la /dev/ttyUSB*

ls -la /dev/rplidar