Port is in use when using PX4 and DXL from RPi simultaneously

Hi,

My setup consists of a DXL servo along with a PX4 flight controller on a drone, with higher level control coming from a custom algorithm running on a Raspberry Pi, which sends position references to both the servo and flight controller. Everything is powered by a 6S LiPo battery (~24V), with a step-down converter to provide 12V to the DXL.
I’m using a XH430-W210-R with the U2D2 board from a Raspberry Pi running Ubuntu 18.4 server. I use a USB cable to connect the U2D2 board to the Pi (connected at /dev/ttyUSB1) and another (/dev/ttyUSB0) to connect to the PX4 from the Pi. When I try to give the DXL position commands in-flight I get the error:
[TxRxResult] Port is in use!

I’ve written my own wrapper in the form of a ROS node using the packethandler and porthandler, but my code is very heavily derived from the ROS position control node in the dynamixel_sdk_examples.

Has someone else also encountered this problem or can anyone that knows more about USB ports (which is probably all of you) give me some pointers on what may go wrong here?

From my experiences with the RPi-4B, unplug/replug USB devices sometimes swapped around the ttyUSB0 and ttyUSB1. I had to use “dmesg” to make sure.

I have not used ROS, but I have used straight Dynamixel SDK on RPi-4B, I had to change ownership of these ports ONCE: sudo chmod a+rw /dev/ttyUSBx