ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Sensors not working when both plugged in

asked 2022-12-12 15:10:48 -0500

chased11 gravatar image

I am using a Jetson Nano dev kit, and have a RPlidar A2, and LPMS IMU. They both use a UART bridge (cp210x converter). When I only have 1 of the devices plugged in, I have no problems, but when I have both, neither one works. In my launch file I have specified device paths and also tried to run both separately. Any ideas what could be causing this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-12-14 08:40:53 -0500

Mike Scheutzow gravatar image

The issue is that the /dev/ttyUSB0 and 1 device names are not consistently assigned to a specific external usb device.

The ttyUSBx device names are dynamically assigned by the kernel as the devices are plugged in (or become visible to the kernel at boot time), so the number MAY change each time you boot the computer. This means you should not hard-code the path /dev/ttyUSB0 into your ros launch file if you expect more than one such USB device will be present.

If the manufacturer provides an API to probe the device to confirm it is an X, you can use that with a system udev rule to create a custom device symlink e.g. /dev/rplidar. You can then safely use this custom device name in your ros launch file. This approach works only if there is zero or one rplidar devices attached.

There is an uglier approach where you use the physical USB port to identify a type of device. Look at the path in the links in /sys/bus/usb-serial/devices/ directory. The parent path does not change across reboots. This approach requires that you create a custom script, and run it from system udev when it detects that a generic cp201x usb device is plugged into the computer.

edit flag offensive delete link more

Comments

If you have an existing 99-rplidar.rules file, you probably need to modify it because the default one seems to assume it's the only cp210x usb device in the system.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-12-14 09:16:44 -0500 )edit

I do have both ports hardcoded into the launch file. I checked the ports before running launch as well. Even if I don't try to start both at the same time, and only launch one of the two sensors, but both are plugged in, they won't run at all. It's a weird issue I haven't seen before. I'll checkout the .rules file, I assume it's in the rplidar src folder?.

chased11 gravatar image chased11  ( 2022-12-14 12:02:55 -0500 )edit

Source is in rplidar_ros repo. On our robots it's installed to /etc/udev/rules.d/99-rplidar.rules

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-12-14 12:46:45 -0500 )edit

Hi Mike, I am just getting around to checking out the 99-rplidar.rules file. It appears there are bash scripts that both add and delete the rules from the /rules.d folder. I checked and the rplidar.rules is not in the rules.d folder. Should I run the script to add the 99-rplidar.rules file to /rules.d folder or is that how it's supposed to be?

I am looking to add a custom symlink as well as I will have to do that eventually regardless but understanding that will clear some things up.

chased11 gravatar image chased11  ( 2022-12-20 23:22:54 -0500 )edit

My first comment informed you that their rules file doesn't work correctly when there are multiple cp210x devices, but you want to install it anyway? Sure, fine with me. /s

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-12-21 06:54:19 -0500 )edit

Understood. Thanks for the help again.

chased11 gravatar image chased11  ( 2022-12-22 11:01:33 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2022-12-12 15:10:48 -0500

Seen: 76 times

Last updated: Dec 14 '22