Is it possible to test XRCE DDS on real HW?

Thank you for the reply @rhys . Also Micro_ros should be installed in the flight controller right?

No, we are not using micro-ROS, but DDS eProsima micro XRCE DDS directly (they are different). We use the micro-ROS agent on the PC / companion computer to connect the DDS comms from the flight controller to the ROS 2 network.

1 Like

I have tried to connect Cube Orange Plus with ros2
in terminal I can see that dds connection is working but I’m not able to see any topics in ROS2
Am I missing something? I have tried it with running mavproxy but still no luck!

Workstation-PC:~/ros2_ws/src/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent serial -b 115200 -r dds_xrce_profile.xml -D /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02
[1716818954.908877] info | TermiosAgentLinux.cpp | init | running
 | fd: 3
[1716818954.909521] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
[1716818986.718754] info | TermiosAgentLinux.cpp | fini | server stopped | fd: 3
[1716818986.728907] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818987.733142] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818988.736850] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818989.740287] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818990.743772] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818991.744622] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818992.748691] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818993.750880] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1716818994.712218] info | TermiosAgentLinux.cpp | init | running
 | fd: 3
[1716819003.037712] info | Root.cpp | create_client | create | client_key: 0xAAAABBBB, session_id: 0x81
[1716819003.037816] info | SessionManager.hpp | establish_session | session established | client_key: 0xAAAABBBB, address: 0
[1716819003.047283] info | ProxyClient.cpp | create_participant | participant created | client_key: 0xAAAABBBB, participant_id: 0x001(1)
[1716819003.049949] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x000(2), participant_id: 0x001(1)
[1716819003.050076] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x000(3), participant_id: 0x001(1)
[1716819003.050526] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x000(5), publisher_id: 0x000(3)
[1716819003.053347] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x001(2), participant_id: 0x001(1)
[1716819003.053428] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x001(3), participant_id: 0x001(1)
[1716819003.053680] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x001(5), publisher_id: 0x001(3)
[1716819003.056364] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x002(2), participant_id: 0x001(1)
[1716819003.056409] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x002(3), participant_id: 0x001(1)
[1716819003.056621] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x002(5), publisher_id: 0x002(3)
[1716819003.059660] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x003(2), participant_id: 0x001(1)
[1716819003.059699] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x003(3), participant_id: 0x001(1)
[1716819003.059875] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x003(5), publisher_id: 0x003(3)
[1716819003.062248] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x004(2), participant_id: 0x001(1)
[1716819003.062294] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x004(3), participant_id: 0x001(1)
[1716819003.062464] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x004(5), publisher_id: 0x004(3)
[1716819003.065453] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x005(2), participant_id: 0x001(1)
[1716819003.065505] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x005(3), participant_id: 0x001(1)
[1716819003.065800] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x005(5), publisher_id: 0x005(3)
[1716819003.068477] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x006(2), participant_id: 0x001(1)
[1716819003.068556] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x006(3), participant_id: 0x001(1)
[1716819003.068892] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x006(5), publisher_id: 0x006(3)
[1716819003.071338] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x007(2), participant_id: 0x001(1)
[1716819003.071367] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x007(3), participant_id: 0x001(1)
[1716819003.071514] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x007(5), publisher_id: 0x007(3)
[1716819003.074261] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x008(2), participant_id: 0x001(1)
[1716819003.074297] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x008(3), participant_id: 0x001(1)
[1716819003.074447] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x008(5), publisher_id: 0x008(3)
[1716819003.077400] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x009(2), participant_id: 0x001(1)
[1716819003.077428] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0xAAAABBBB, publisher_id: 0x009(3), participant_id: 0x001(1)
[1716819003.077519] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0xAAAABBBB, datawriter_id: 0x009(5), publisher_id: 0x009(3)
[1716819003.080399] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x00A(2), participant_id: 0x001(1)
[1716819003.080461] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0xAAAABBBB, subscriber_id: 0x00A(4), participant_id: 0x001(1)
[1716819003.080612] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0xAAAABBBB, datareader_id: 0x00A(6), subscriber_id: 0x00A(4)
[1716819003.083733] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x00B(2), participant_id: 0x001(1)
[1716819003.083788] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0xAAAABBBB, subscriber_id: 0x00B(4), participant_id: 0x001(1)
[1716819003.084000] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0xAAAABBBB, datareader_id: 0x00B(6), subscriber_id: 0x00B(4)
[1716819003.086676] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x00C(2), participant_id: 0x001(1)
[1716819003.086763] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0xAAAABBBB, subscriber_id: 0x00C(4), participant_id: 0x001(1)
[1716819003.087018] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0xAAAABBBB, datareader_id: 0x00C(6), subscriber_id: 0x00C(4)
[1716819003.089536] info | ProxyClient.cpp | create_topic | topic created | client_key: 0xAAAABBBB, topic_id: 0x00D(2), participant_id: 0x001(1)
[1716819003.089587] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0xAAAABBBB, subscriber_id: 0x00D(4), participant_id: 0x001(1)
[1716819003.089862] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0xAAAABBBB, datareader_id: 0x00D(6), subscriber_id: 0x00D(4)
[1716819003.093843] info | ProxyClient.cpp | create_replier | replier created | client_key: 0xAAAABBBB, requester_id: 0x000(7), participant_id: 0x001(1)
[1716819003.097386] info | ProxyClient.cpp | create_replier | replier created | client_key: 0xAAAABBBB, requester_id: 0x001(7), participant_id: 0x001(1)

If anybody got this working please help :slightly_smiling_face:

If all the topics match, but no nodes or topics appear in the ROS 2 CLI, check you have ROS_DOMAIN_ID set to “”.

1 Like

Hi @rfriedman
current ROS_DOMAIN_ID set to 22
Here is data from my bashrc file:

NB: Using orange cube_plus+ connected to the laptop using a USB cable

source /opt/ros/humble/setup.bash
export ROS_DOMAIN_ID=22
export ROS_LOCALHOST_ONLY=1
export PATH=$PATH:~/Micro-XRCE-DDS-Gen/scripts
export GZ_VERSION=garden
source /home/ubuntu/ardupilot/Tools/completion/completion.bash
export PATH=$PATH:~/.local/bin
export PATH=$PATH:/usr/local/lib/python3.10/dist-packages/MAVProxy

Try export ROS_DOMAIN_ID=0. Currently this choice is hardcoded in the AP_DDS library. Can you also post the output from the micro_ros_agent when run with the verbose flag (-v6).

1 Like

Hi, I got this working after setting ROS_DOMAIN_ID=0 and disconnecting from the internet while running. :blue_heart:

:~/ros2_ws$ ros2 topic list
/ap/battery/battery0
/ap/clock
/ap/cmd_gps_pose
/ap/cmd_vel
/ap/geopose/filtered
/ap/gps_global_origin/filtered
/ap/imu/experimental/data
/ap/joy
/ap/navsat/navsat0
/ap/pose/filtered
/ap/tf
/ap/tf_static
/ap/time
/ap/twist/filtered
/parameter_events
/rosout

1 Like

Hi Im trying the same in jetson orin nano with JP6.
But when i try to run I’m encountering this error anyone know why this is happening ?
it says dds_xrce_profile.xml’ file is missing !!!
But the same work perfectly in my Ubuntu 22.04

/ros2_ws/src/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent serial --baudrate 115200 --dev /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02 --refs dds_xrce_profile.xml -v6
Error: reference file ‘dds_xrce_profile.xml’ does not exist!
Usage: ‘micro_ros_agent <udp4|udp6|tcp4|tpc6|canfd|serial|multiserial|pseudoterminal> <>’
For a more detailed description about all the available arguments, please execute the agent with ‘-h/–help’ option.

My bashrc file for reference :slightly_smiling_face:
source /opt/ros/humble/setup.bash

export PATH=$PATH:/home/ceed/ros2_ws/Micro-XRCE-DDS-Gen/scripts
export PATH=$PATH:~/.local/bin
export PATH=$PATH:/usr/local/lib/python3.10/dist-packages/MAVProxy

export ROS_DOMAIN_ID=0
export ROS_LOCALHOST_ONLY=0

export GZ_VERSION=garden
source /home/ceed/ros2_ws/src/ardupilot/Tools/completion/completion.bash
export PATH=$PATH:~/.local/bin
export PATH=$PATH:/usr/local/lib/python3.10/dist-packages/MAVProxy

export PATH=“$PATH:$HOME/.local/bin”

when i manually added this dds_xrce_profile.xml
this error resolves but still communication between jetson and cube doesn’t happening!
Output:
:~/ros2_ws/src/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent serial -b 115200 -r dds_xrce_profile.xml -D /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if00
[1719469514.466439] info | TermiosAgentLinux.cpp | init | running
 | fd: 3
[1719469514.470243] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4

The need for a refs file was removed from master in AP_DDS: replace ref interface with binary interface in uxr create entity methods by srmainwaring · Pull Request #27145 · ArduPilot/ardupilot · GitHub. It is still needed for the 4.5 release, but when running master drop the --refs dds_xrce_profile.xml option as the file has been removed.

1 Like

hi @rhys thankyou 

without --refs tag it gives this error
[1719989749.355267] info | TermiosAgentLinux.cpp | init | Serial port not found. | device: /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02, error 2, waiting for connection

[1719989749.914499] info | TermiosAgentLinux.cpp | init | running
 | fd: 3
[1719989760.155230] info | Root.cpp | create_client | create | client_key: 0xAAAABBBB, session_id: 0x81
[1719989760.155644] info | SessionManager.hpp | establish_session | session established | client_key: 0xAAAABBBB, address: 0
2024-07-03 10:56:00.562 [XMLPARSER Error] Profile ‘participant_profile’ not found → Function fillParticipantAttributes

And even with --refs dds_xrce_profile.xml` the ardupilot-cube need to disconnect and connect it back again to establish connection , is there any known workaround for that as-well?

FYI
When i rebuild all ros2_ws from scratch to get new updates
then the output is : -

~/Desktop/ros2_ws/src/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent serial -b 115200 -D /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if02
[1719994442.842010] info | TermiosAgentLinux.cpp | init | running
 | fd: 3
[1719994442.842769] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4

I have tried running mavproxy.py in other terminal but still not creating topics

But when I try checking stream using command , I can see the data flowing 


~/Desktop/ros2_ws/src/ardupilot/libraries/AP_DDS$ python3 -m serial.tools.miniterm /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if00 115200 --echo --encoding hexlify— Miniterm on /dev/serial/by-id/usb-CubePilot_CubeOrange+_1A0032000D51323031393637-if00 115200,8,N,1 —
— Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
01 A7 68 88 FD 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 61 4B FD 14 00 00 EE 01 01 F1 00 00 44 BA 1A 10 00 00 00 00 C6 F2 42 3C 0F 89 D7 3C 5F 7A A9 3C EC 84 FD 29 00 00 EF 01 01 93 00 00 FF FF FF FF FF FF FF FF FF 7F EA 00 FF FF FF FF FF FF FF FF FF C9 FD 1C 00 00 F1 01 01 A3 00 00 FE 8C C6 B8 6D 7F 6F 35 C4 66 B3 B9 00 00 00 00 00 00 00 00 F6 5E 1A 3A 10 3F 89 3C 61 15 FD 0C 00 00 F2 01 01 B2 00 00 F3 AB 46 40 C6 EB 50 BC A1 D8 8C BE 07 D3 FD 1C 00 00 F3 01 01 1E 00 00 6E 20 04 00 DB 72 46 40 2A D9 C4 BA E3 E2 8B BE 77 B3 AC B8 A4 38 7C B8 7A CB D7 B9 AE FE FD 1C 00 00 F4 01 01 21 00 00 6E 20 04 00 00 00 00 00 00 00 00 00 22 06 00 00 28 06 00 00 00 00 00 00 00 00 83 86 FE 19 FD 12 00 00 F5 01 01 4A 00 00 00 00 00 00 00 00 00 00 C2 F5 C8 3F 01 AE 92 3F 58 01 96 F3 FD 1F 00 00 F6 01 01 01 00 00 0F DC 30 13 0F 00 20 12 0F 81 10 03 46 00 E6 00 


@mefrankli, I’ve added a note describing how to run a HW test on a laptop using a CP2102 USB-to-UART bridge to provide a second USB connection: Testing PPP and DDS on a desktop or laptop

1 Like

Hi there, I am trying to test the ROS2 / DDS connection on my laptop together with a KakuteH7Mini. It seems like I get everything up and running, I can see that the FC is responding to the ros2 service calls (for arming, for instance). The only thing that is not working, however, is echoing topics using ros2 topic echo, or seeing the update rate with ros2 topic hz. Any clue why this might be the case? I’ve also tried the ros2 ardupilot_dds_tests time_listener, also to no avail.
I’ve installed the ROS2 environment in a docker container according to:
https://ardupilot.org/dev/docs/ros2.html#installation-ubuntu

I have now installed ROS2 in my own workspace and tried using a .cpp subscriber to listen to topics via DDS, but again I receive no messages on the laptop.

To give further information; I’ve tried with SITL and that works fine.
With the FC, the really weird thing is that when I start the micro_ros_agent, a couple of messages are actually published and I can echo them. But after those ±5 messages have arrived, it doesn’t work anymore.

We’ll need logs. Please post a new topic for support.

@rfriedman thank you for the response. Due to time constraints we had to revert to PX4 where we had the XRCE DDS working already. If I find some time to reflash the board and do some tests with logging, I’ll create a new topic as you suggested.

I think there is an update/improvement on this.

I find this link better for a real estimate of the ROS2 Ardupilot development status
https://github.com/orgs/Ardupilot/projects/4


I have deployed DDS communication and can receive ROS2 topics:/ap/
 And service:/ap/
, But when I execute the command: ros2 service call/ap/arm_motors ardupilot-mgs/srv/AllMotors’ {arm: True} ‘, it doesn’t work and shows’ The passed service type is invalid’.
I have a micro ROS agent and ROS2 on my computer, am I missing anything? Or is it for other reasons?Please help me, thank you

I currently am having the same issue as @sstroobants.
I’m currently making a list of all the terminal commands I run for a fresh Ubuntu 22.04 install on a RPi 4. Hopefully the issue can be reproduced if you have the hardware. Otherwise, what logs will you need?