Is it possible to test XRCE DDS on real HW?

…my problem solved, micro_ros_agent running properly, it works correctly only if I’m connected at the same time and running “mavproxy” on another serial port…
In order to cause the problem, with the same configuration, just turn off mavproxy and reboot CubeOrange.
My current CubeOrange settings are “serial5-mavlink2-921600”(for MAVPROXY) and “serial1-DDS_XRCE-921600”(for AP_DDS).
SBC AGX Orin uses “/dev/ttyUSB0” for (micro_ros_agent) and “/dev/ttyUSB1” for (MAVPROXY).

Hello,

I have a question, why do I have to have “mavproxy” running for my AP_DDS connection to work?
If I don’t currently have “mavproxy” connected to CubeOrange via serial1 port and “DDS_XRCE” via serial2 port to SBC AGX Orin, I don’t have data from AP_DDS.
Is there any reason for such dependence on the current connection?

Thx
Lada

I was not aware of the dependency, and can test on my side to see if I can reproduce itit. They should be independent.

It’s simple, if “mavproxy” is not connected to Cube Orange, micro ros client in Cube Orange does not work and micro_ros_agent in SBC does not receive anything.
So just run micro_ros connect and stop or disconnect “mavproxy”.
That’s why the person who used the SITL scheme didn’t have a problem, because he had to have “mavproxy” enabled, but I don’t need it for anything at all, so all my first tests were doomed to failure. Now until there is a fix, I will run “mavproxy” and I can finally try to create my services for ROS2.

Thanks
Lada

…new refresh about this problem :slight_smile:
“mavproxy” must be connected only for the first start of “micro_ros”.
After the successful connection of “micro_ros”, it is possible to close “mavproxy” and “micro_ros” continues to run perfectly correctly without any problems.
It is also possible to close “micro_ros_agent” and start it again and it runs correctly again without any problems.
What really surprised me was the behavior after the OrangeCube reboot, if I don’t end the “micro_ros_agent” run on the SBC and then “reboot” the CubeOrange, the communication starts again correctly even without the “mavproxy” run.
The difference occurs if I close “micro_ros_agent” on the SBC and perform a “reboot” of CubeOrange without running “mavproxy” and start the “micro_ros_agent” again on the SBC, the ROS2 communication is without data.
So only for the first correct start of “micro_ros_agent” a functional “mavproxy” connection is required, then “mavproxy” can be terminated.
Hopefully this contribution will help everyone who is now trying to start ROS2 communication with ADUPILOT in real conditions without SITL simulation.

Thanks for watching

Lada

1 Like

Thanks for the info, we can use this to chase down the issue. DDS should be able to work without the MAVLink connection.

Thanks for the reply, I have continued to better identify the given problem.
The main obstacle turned out to be the need to reboot “CubeOrange” after starting “micro_ros_agent” on the SBC. Otherwise, data transfer from “micro_ros_client” to “CubeOrange” simply does not work.
It never works without this.
A possible problem is that I turn on SBC and “CubeOrange” at the same time, SBC is online significantly later than “Cube…”.
So when the “Cube…” is started, the online “micro_ros_agent” is never present on the SBC.
It is interesting that if I have successfully connected the first “micro_ros” and ended the “micro_ros_agent” on the SBC, the restart will take place without the need to reboot the “Cube…”.
This behavior does not depend on the “mavros” or “MP” connection status.
In order for it to always start properly after the first “micro_ros” connection, I must be the first active “micro_ros_agent” before starting “Cube…”, during the next connection (if I do not turn off “Cube…”) a reboot is not necessary.
I am attaching the connection diagram on which I am testing.
I use the “mavros” connection for the ROS2 node and as a UDPCI proxy for “MP”.
I reboot via the “MP” reboot button in the compass settings section.

I have to thank everyone who did the ROS2 implementation for a really good job, I really like it.

And if it is still possible to solve the initialization of “micro_ros” without depending on the order of launch, it will be great.

Thanks for watching

Lada

Hi, I am working on a Ros2 Project * I am working on a ROS2 project. In this project I am trying to connect a companion computer to an ardupilot flight controller using XRCE-DDS.

  • This is my first time working with xrce dds. I am running into problems regarding the communication and accessing sensor data and publishing it. It will be a great help if you can guide me on this and also how to look into these kinds of issues.
    What I did was , With the help of gen tool and .idl file I was able to generate a C code. After that I compiled it and made the file to an executable. So after this when I try to run the code in the terminal, It is taking some time and returning " error in creating a session".
    Also am i going through the right procedure?

Hello @Karthik_B, I’d recommend working through the ArduPilot wiki pages for ArduPilot & ROS 2, and note the pre-requisites in ardupilot/Tools/ros2/README.md.

This describes how to get set up with currently supported messages and there are notes in the library README about how to add further messages (if you are running your own fork of ArduPilot).

1 Like

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