MicroRTPS-Bridge not publishing ROS2 msgs

Hey everyone,
I’m currently trying to set up a micrortps-connection between a pixhawk 2 cube (black) flight controller (Hex Cube Black Flight Controller | PX4 User Guide) and a Raspberry Pi. The flight controller is running the default Firmware version of fmu_v3 where “micrortpsbridge”-module has been added to the cmake file. The Raspberry Pi is using a 20.04 Ubuntu LTS Server-Edition with ROS2-Foxy. As a connection I use the Tele2-Port of the pixhawk and a usb2uart ftdi-adapter (CP2102 USB UART Board(type A)).

Issue

To set up a connection between the Raspberry Pi and the flight controller I start the micrortps_client via Mavlink-Console from Q-GroundControll. I can also call a listener on any available topic there, which produces an output with a timestamp and some data.
Starting the micrortps_agent on the RPi I get notifications, that topics are published now.
Entering ros2 topic list in a new console on the RPi, none of the topics are listed.
Also starting the sensorCombined listener-node doesn’t give me any data, staying at the stage of “Starting listener node…”.
After closing the agent and the client, the notifications on both consoles show me an amount of messages “sent” and “received”. The Console-Code can be seen below.

This leaves me wondering, whether the micrortps-bridge is not working correctly (for this setup?) or messages are correctly exchanged but not published into ros2. Is there anything I’m missing about setting up the connection, that causes this problems or did anyone else already have this problem? Any help or advices are welcome, since I’m pretty new to ROS2.

Console-Code
Output from Pixhawk (Mavlink-Console from QGroundControll):

NuttShell (NSH) NuttX-10.1.0
nsh> micrortps_client start -d /dev/ttyS2 -b 921600 -t UART
INFO [micrortps_client] UART transport: device: /dev/ttyS2; baudrate: 921600; poll: 1ms; flow_control: No
nsh> listener sensor_accel

TOPIC: sensor_accel 3 instances

Instance 0:
sensor_accel_s
timestamp: 465679695 (0.007060 seconds ago)
timestamp_sample: 465679429 (266 us before timestamp)
device_id: 2359330 (Type: 0x24, SPI:4 (0x00))
x: -0.2087
y: 0.2006
z: -9.9163
temperature: 50.0412
error_count: 0
clip_counter: [0, 0, 0]
samples: 5

Instance 1:
sensor_accel_s
timestamp: 465728511 (0.000594 seconds ago)
timestamp_sample: 465728485 (26 us before timestamp)
device_id: 1114146 (Type: 0x11, SPI:4 (0x00))
x: 2.4120
y: -2.8786
z: -7.9107
temperature: 45.1250
error_count: 0
clip_counter: [0, 0, 0]
samples: 1

Instance 2:
sensor_accel_s
timestamp: 465776512 (0.000456 seconds ago)
timestamp_sample: 465776239 (273 us before timestamp)
device_id: 2359306 (Type: 0x24, SPI:1 (0x00))
x: 0.0962
y: -0.0699
z: -9.7784
temperature: 55.3128
error_count: 0
clip_counter: [0, 0, 0]
samples: 5
nsh>

Output from Raspberry Pi Agent:

ubuntu@ubuntu:~$ micrortps_agent -d /dev/ttyUSB0 -b 921600 -t UART
--- MicroRTPS Agent ---
[ micrortps_agent ] Starting link...
[ micrortps_agent ] UART transport: device: /dev/ttyUSB0; baudrate: 921600; poll: 1ms; flow_control: No
--- Subscribers ---

    DebugArray subscriber started
    DebugKeyValue subscriber started
    DebugValue subscriber started
    DebugVect subscriber started
    OffboardControlMode subscriber started
    OpticalFlow subscriber started
    PositionSetpoint subscriber started
    PositionSetpointTriplet subscriber started
    TelemetryStatus subscriber started
    Timesync subscriber started
    VehicleCommand subscriber started
    VehicleLocalPositionSetpoint subscriber started
    VehicleTrajectoryWaypoint subscriber started
    OnboardComputerStatus subscriber started
    TrajectoryBezier subscriber started
    VehicleTrajectoryBezier subscriber started
    TrajectorySetpoint subscriber started
    VehicleMocapOdometry subscriber started
    VehicleVisualOdometry subscriber started

---- Publishers ----

    Timesync publishers started
    TrajectoryWaypoint publisher started
    VehicleControlMode publisher started
    VehicleOdometry publisher started
    VehicleStatus publisher started
    CollisionConstraints publisher started
    TimesyncStatus publisher started
    SensorCombined publisher started
    VehicleTrajectoryWaypointDesired publisher started

^C
[ micrortps_agent ] Interrupt signal (2) received.
[ micrortps_transport ] Closed UART.
[ micrortps_agent ] RECEIVED: 10318 messages - 1338737 bytes; 36369 LOOPS - 36.680 seconds - 36.50KB/s
[ micrortps_agent ] SENT: 369 messages - 19188 bytes
1 Like

if you command in a new terminal like first ros2 run px4_ros_com sensor_combined_listener then in another terminal ros2 topic pub /fmu/sensor_combined/out you can see the outputs BUT if you see correct output could you look my issue:

Hey, thanks for your time. I’m going to have a look at that as soon as I’m back at the laboratory, so you mean:

  1. Start micrortps_client on the drone via nsh.
  2. Start micrortps_agent on companion computer.
  3. Start in new terminal sensor_combined_listener on companion pc.
  4. Use ros2 topic pub /fmu/sensor_combined/out.
    Right?

for 4th one actually you have to do : ros2 topic pub /fmu/sensor_combined/out px4_msgs/MessageName (in my post you can see, or if you just tab after writing px4_m you will see the relaaed message.)
And please use reply button top right of the text , sometimes created topic wihtout reply can be missed by me.

1 Like

Hello again,
so I tested what you described in the previous post and I got the same result as you. I also still miss the messages “XXX publisher matched” on the agent side. So I think I still got another problem to solve here.
But from what I know about ROS2 by now, the empty messages you get are not surprising. What you do with those commands is actually just establish a connection - which is not creating any ROS2 messages (I dont know why) - and after that you publish an empty topic from your Laptop with the same name. But I also might be mistaken here.

To make sure there is no problem on our hardware side, we are now ordering a Pixhawk 5X controller, which should support the rtps brige by default. In the meantime we are flying our drone with some ROS1 Mavros setup, which is working perfectly fine.
I’ll give you an update, if we get any progress with the new setup.

1 Like

I will relook your opinion whenever I solve my another issue, thanks a lot !

Hi there, we are currently working on a drone project using pixhawk and ROS2, we have also encounted the situation you are facing, our solution is connecting your companion computer to the Internet and the massage will be correctly received and printed.

Hello again,
we finally solved our issue and established a connection between a Pixhawk 5X and a Laptop with Ubuntu 20.04 and ROS2 Foxy.

We are not 100% sure, but we suspect QGroundControls Mavlink-Console to be the source of our issue, which we used to start the client. This connection seems to kind of block the microRTPS-connection. After using the PX4 “mavlink_shell.py” script for starting the client, we were able to establish a connection with both the TELE2 and the USB-C port.
This is the only change we made besides reinstalling ubuntu, ros2 foxy, fastdds-gen and the PX4-Autopilot & px4_ros_com_ros2 packages.

@tugbakara I dont know if that helps you, but at least this was our issue. We will try this setup in the future with another companion pc (Raspberry Pi 4) and an older version of the controller (pixhawk 3) to see if that works as well and keep you updated.