How can I use RPlidar and YDLidar on Plutarco’s CP2102 reprogramming…

In Plutarco I’ve a lot of different USB device and I found a lot of problems with their names which change in relation to their plug-in order sequence.

Linux UDEV rules file helped me in a partial solution of the problem but 2 different Lidar devices, rplidar and ydlidar, used the same CP2102  USB to Serial converter with the same serial number.

Googling a bit I found cp210x-cfg tool able to program a new serial number on CP2102 chip.

I connected YDlidar only device at the system ( to be sure to work with right device ) and I programmed it’s serial number with this command:

sudo ./cp210x-cfg -m 10c4:ea60 -S 0002

RPlidar kept the original S/N 0001

At this point I used udevadm command which would be useful for serial number changing check and to discover other parameters necessary for udev file creation:

udevadm info -a -n /dev/ttyUSB0

Using previous command on all USB device file ( /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyACM0, etc… ) I created a file called /etc/udev/rules.d/plutarco.rules whit these lines:

KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0002", MODE:="0777", GROUP="users", SYMLINK+="ydlidar"
KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", MODE:="0777", GROUP="users", SYMLINK+="rplidar"
KERNEL=="ttyUSB*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A701313R", MODE:="0777", GROUP="users", SYMLINK+="imu"
KERNEL=="ttyACM0", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", ATTRS{product}=="u-blox 7 - GPS/GNSS Receiver", MODE:="0777", GROUP="users", SYMLINK+="ublox"
KERNEL=="ttyACM*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="003e", ATTRS{product}=="Arduino Due", MODE:="0777", GROUP="users", SYMLINK+="monitor"
KERNEL=="ttyACM*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="003d", ATTRS{product}=="Arduino Due Prog. Port", MODE:="0777", GROUP="users", SYMLINK+="monitor1"

You can use this command to reload new rules without system reboot:

sudo udevadm control --reload-rules && sudo udevadm trigger

You can use “ls -lah /dev/YOURDEVICE” command to check plutarco.rules file result.

In my actual hardware config these are some output examples:

plutarco 08:21:03 /dev $ ls -lah rplidar
lrwxrwxrwx 1 root root 7 2000-01-01 01:00 rplidar -> ttyUSB0

plutarco 08:21:14 /dev $ ls -lah imu
lrwxrwxrwx 1 root root 7 2000-01-01 01:00 imu -> ttyUSB1


plutarco 08:21:36 /dev $ ls -lah ublox
lrwxrwxrwx 1 root root 7 2000-01-01 01:00 ublox -> ttyACM0


plutarco 08:21:39 /dev $ ls -lah monitor1
lrwxrwxrwx 1 root root 7 2000-01-01 01:00 monitor1 -> ttyACM1


I commenti sono chiusi.