Hello,
As per @rfriedman 's comment, I’m starting a new topic for my DDS issue.
To sum up my problem, I am able to install and configure everything correctly (as far that I am aware), but my flight controller (Matek H743 Slim V3) doesn’t seem to publish the topics to my companion computer (Raspberry Pi 4).
If I have the ROS2 micro_ros_agent running and I reboot my FC (either through the Mavproxy reboot command or cycling the FC’s power), the Pi receives topics from the FC for about 7 or 8 seconds (if I have ros2 topic echo /ap/time
running, I can see the FC’s time being published and updating until 7-8 seconds), and then it stops publishing. It will restart publishing for 7 seconds if I reboot again. Also, if I terminate the ROS2 micro_ros_agent on my Pi, I’ll see the DDS: No ping response, disconnecting
message on console, and if I restart the ROS2 micro_ros_agent before receiving DDS No ping response, exiting
, then the same phenomenon will occur (the FC will publish topics, but only for 7-8 seconds.
I’ve tried running the ROS2 micro_ros_agent both with and without mavproxy running. No difference.
In the AP logs, near boot time, I have a bunch of messages DDS: Topic/Sub/Reader session pass for index 'XX'
and DDS: Service/Replier session pass for index 'X'
and DDS: Initialization passed
.
This is what the ROS2 micro_ros_agent terminal looks like, when the flight controller is already turned on and connected:
And here it is after I reboot the FC:
And like a said, topics only get published for 7-8 seconds.
Details on my setup
- Raspberry Pi 4, Ubuntu Desktop 22.04.5 64bit, ROS2 Humble
- Serial connection on GPIO 14 and 15. I’ve disabled bluetooth (
dtoverlay=disable-bt
in /boot/firmware/config.txt), placing UART0 on those pins and addressed as ttyAMA0 (According to RPi docs).
- Serial connection on GPIO 14 and 15. I’ve disabled bluetooth (
- Matek H743 Slim V3
- Serial connection on Rx3, Tx3. On this board, this is SERIAL4 using USART3. I don’t know if there’s an important distinction between UART and USART.
- Nothing else is connected to the FC. No compass, no GPS, no receiver. Only SERIAL4 and USB (for console). But I’ve tried supplying power via a USB power adapter instead of plugging it into the Pi’s USB port, but the same result occurs.
- I tried to use the OTG2 (SERIAL8) port for DDS, but I get something similar, but worse. The 2 lines from the first picture appear, but when I reboot, I get connection errors and then only
running...
, and no published topics, like so:
[1729489148.498787] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-ArduPilot_MatekH743_360035001951333231333730-if00, error 2, waiting for connection...
[1729489148.795670] info | TermiosAgentLinux.cpp | init | running... | fd: 3
Steps to reproduce:
What follows is the record of all terminal commands performed on a fresh Ubuntu install on my Pi. No errors occurred during installations or builds. I’ve done this whole process 3 times (with minor variations, depending on the documentation followed) and I end up with the same issue at the end.
Use Raspberry Pi Imager v1.8.5 to flash microSD card with Ubuntu Desktop 22.04.5 LTS (64BIT) for Raspberry Pi 4
Boot Raspberry Pi, set location as New York (for correct locale settings for ROS2).
sudo apt update
sudo apt upgrade
To enable UART connection on ttyAMA0 (UART0 on GPIO14 and 15)
Add dtoverlay=disable-bt
to /boot/firmware/config.txt
sudo systemctl disable hciuart
sudo reboot
Clone Ardupilot repo
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git
cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y
. ~/.profile
sudo reboot
Install ROS 2 Humble
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt install ros-humble-ros-base ros-dev-tools -y
sudo apt install ros-humble-geographic-msgs
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
sudo reboot
Import AP ros2 dependencies (this is from the AP ros2 readme, but I’ve also followed the instruction from AP documentation during another installation trial).
mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src
wget https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/ros2.repos
vcs import --recursive < ros2.repos
cd ~/ros2_ws
sudo apt update
sudo rosdep init
rosdep update
rosdep install --rosdistro humble --from-paths src --ignore-src
Install Micro-XRCE-DDS-Gen
sudo apt install default-jre
cd ~/ros2_ws
git clone --recurse-submodules https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git
cd Micro-XRCE-DDS-Gen
./gradlew assemble
echo "export PATH=\$PATH:$PWD/scripts" >> ~/.bashrc
Build colcon
cd ~/ros2_ws
colcon build --cmake-args -DBUILD_TESTING=ON
But on another installation trial, I also performed:
colcon build --packages-up-to ardupilot_dds_tests
Then I connect the FC via USB to the Pi (The only thing configured on the FC is the frame selection and accelerometer calibration), build and upload AP firmware to the FC.
cd ~/ardupilot
./waf configure --board MatekH743 --enable-dds
./waf copter --upload
mavproxy.py --console
param set DDS_ENABLE 1
param set SERIAL4_PROTOCOL 45
param set SERIAL4_BAUD 115
param set LOG_DISARMED 1
reboot
And then finally, I run the ros2 micro_ros_agent and I experience what I’ve described above
cd ~/ros2_ws
source install/setup.bash
cd src/ardupilot/libraries/AP_DDS
ros2 run micro_ros_agent micro_ros_agent serial -b 115200 -D /dev/ttyAMA0
LOGS
I have the outputs for both
colcon test --executor sequential --parallel-workers 0 --base-paths src/ardupilot --event-handlers=console_cohesion+
and
colcon test-result --all --verbose
colcon test.txt (86.3 KB)
colcon test-results.txt (4.9 KB)
colcon test-result
shows that there are no errors, but 65 skipped tests (out of 263). Don’t know if that’s normal.
But in the colcon test --executor sequential ...
, there is a warning when testing ardupilot_dds_tests
Starting >>> ardupilot_dds_tests
/home/bobzwik/.local/lib/python3.10/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
warnings.warn(msg)
--- output: ardupilot_dds_tests
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
---
--- stderr: ardupilot_dds_tests
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
---
Finished <<< ardupilot_dds_tests [1.26s]
Summary: 3 packages finished [53.4s]
1 package had stderr output: ardupilot_dds_tests
I also have a AP log: 18 1979-12-31 7-00-00 PM.bin - Google Drive
Let me know if there’s any other relevant information that you’d need to help me debug this.