I have a weird problem, I will try to describe it as best as I can. I hope that someone can help me debug it. The main problem is that I cannot reproduce it consistently, so I find it hard to debug.
I have the following setup:
- Jetson Xavier NX with Ubuntu 18.04
- on the Jetsons run a Docker container with Ubuntu 20.04 and ROS2 Foxy
- the Jetson is connected to a pxhawk 6c flight controller trough the RX/TX pins on TELEM2
- I have some Vicon camera which gives me position and orientation feedback
- I run ROS 2 foxy on my laptop on a Docker container
I want to drive the drone with a Model Predictive Controller we implemented in our lab, and I do the following:
- I run the dds agent on the Jetson Docker container and I see that it correctly creates the ROS 2 topics to send and receive messages from the PX4
- I feed the position and orientation data from the Vicon to the PX4 trough a ROS 2 node that runs on the Docker container on my laptop.
- I run the MPC node on the Jetson Docker container (which gives the offboard command and then wait for set-points and trajectories to be published)
Sometimes, it all works: the drones get armed and I can make it fly indoors by publishing set-points and trajectories to the custom controller.
Sometimes, the MicroXRCE agent running on the Docker container on the Xavier starts writing again the “publisher created” “datawriter created” stuff. In that moments it does not receive data from ROS nor it publish anything. It always happens for a fraction of a second.
I checked the cable over and over again, so I do not think the problem is with the TX/RX-TELEM2 connection.
The weird things is, the MicroXRCE agent lose connectivity (I assume that is what it happens) only when I am running some ROS 2 node (either the vicon publisher or the MPC, as I said I was not able to reproduce the error consistently). So far, if I was not running any ROS 2 node, and I tried to listen to some topic, it had never lost connectivity.