LORD-MicroStrain / MSCL

MicroStrain Communication Library
https://www.microstrain.com/software/mscl
MIT License
76 stars 57 forks source link

Connecting multiple WSDA-200-USB devices reliably on a single computer. #358

Closed ybabs closed 10 months ago

ybabs commented 12 months ago

We’re currently using the MSCL C++ library on a linux device. And we have multiple WSDA-200-USB gateways connected to a raspberry like device. These devices show up as a serial device e.g. ttyUSB0 and ttyUSB1 etc on linux and we have no issues interacting with our software when connecting to them using the device path link. However, one thing we’ve noticed is sometimes, these two devices tend to swap their device path names, so we then have no idea what device we are talking to. As an example, say WSDA1 is on ttyUSB0 and WSDA2 is on ttyUSB1, a reboot could swap these devices and now we have WSDA1 on ttyUSB1 and WSDA2 on ttyUSB2.

For our usecase, it is important for us to have a consistent naming scheme for each device and we’ve tried to achieve this but we are not getting consistent usable results. We’ve tried to create a UDEV rule to create a symlink for both devices based on the serial number of both devices. We essentially have a register of both devices for each drone we have and use their serial numbers to create a new symlink. The udev rule looks something like this:

KERNEL=="ttyUSB[0-9]", ATTRS{serial}=="abcdefg1234", SYMLINK+="ttyWSDA1" KERNEL=="ttyUSB[0-9]", ATTRS{serial}=="123456890", SYMLINK+="ttyWSDA2"

We find this works but occasionally, we run into a communication error like the screenshot below:

image

Unfortunately, the system becomes unrecoverable at this point, and the only thing to do get it back is a complete power cycle. A soft reset doesn’t seem to always work and a plug/unplug isn’t feasible as the drone is in the air.

Do you have any recommendations on how to improve this setup for multiple homogeneous gateways?