Is it possible to test XRCE DDS on real HW?

Hello,

i have ready to test my ArduRover for connect ROS2(HW = AGX Orin on JP6, Cube Orange, custom build Rover and SW Ubuntu 22.04, ROS Humble, last dev firmware for ArduRover).
AGX Orin is connected to Cube Orange by two serial ports (USB FTDI 232 converters), the first provides MAVROS connection for Mission Planner via WiFi and the second is set for DDS XRCE), both are at 921600 Bd speed and functional. After install Ardupilot ROS2 packages , I tried the first connection via XRCE DDS, unfortunately it was unsuccessful, with an error that I don’t understand “Serial port not found.(error 2)”
The run command looked like this “ros2 run micro_ros_agent micro_ros_agent serial --baudrate 921600 --dev ./dev/ttyUSB1”.
If I set this port “ttyUSB1” for Mavlink 2 it works without problem.
It’s my first attempt to use XRCE DDS and I’m not a big expert on ROS2, it’s my hobby, where the goal is autonomous exploration of an unknown environment.
Is it reasonable to physically test this now, considering the stage of development?

Thanks
Lada

…the result is test yes but without 100% success, DDS Client on OrangeCube would not send data serial port…
I will document the results for illustration.


…test miniterm…

…test this serial port after switch to MAVLINK2 protocol…

…info from build master…
info_build_master.txt (116.5 KB)
…second attempt , build from source Ryan55F…
info_build_RyanF55.txt (116.5 KB)

…Thanks for watching…
Lada

Did you disconnect mission planner before attempting to open the connection.

Did you set SERIALx_PROTOCOL to 45 and SERIALx_BAUD?

I’d try with a lower baud like 115k.

Yes, i set DDS_ENABLE=1 and tested protocol typ 45 on SERIAL1-5, speed 57600-921600.
When i build fw for CubeOrange, i get this warning:

749/1137] Compiling build/CubeOrange/libraries/AP_DDS/generated/geometry_msgs/msg/Point.c
…/…/modules/Micro-XRCE-DDS-Client/src/c/core/session/session.c:642:6: warning: no previous declaration for ‘uxr_run_session_until_pong’ [-Wmissing-declarations]
642 | bool uxr_run_session_until_pong(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
[ 775/1137] Compiling build/CubeOrange/libraries/AP_DDS/generated/sensor_msgs/msg/NavSatStatus.c
…/…/modules/Micro-XRCE-DDS-Client/src/c/profile/transport/stream_framing/stream_framing_protocol.c:125:6: warning: no previous declaration for ‘uxr_framing_write_transport’ [-Wmissing-declarations]
125 | bool uxr_framing_write_transport(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
…/…/modules/Micro-XRCE-DDS-Client/src/c/profile/transport/stream_framing/stream_framing_protocol.c:214:8: warning: no previous declaration for ‘uxr_framing_read_transport’ [-Wmissing-declarations]
214 | size_t uxr_framing_read_transport(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
[ 782/1137] Compiling modules/DroneCAN/libcanard/canard.c
…/…/modules/Micro-XRCE-DDS-Client/src/c/util/time.c: In function ‘uxr_nanos’:
…/…/modules/Micro-XRCE-DDS-Client/src/c/util/time.c:60:5: warning: implicit declaration of function ‘clock_gettime’ [-Wimplicit-function-declaration]
60 | clock_gettime(CLOCK_REALTIME, &ts);
| ^~~~~~~~~~~~~
[ 785/1137] Compiling libraries/AP_PiccoloCAN/piccolo_protocol/ServoProtocol.c
…/…/modules/Micro-XRCE-DDS-Client/src/c/core/session/write_access.c:148:6: warning: no previous declaration for ‘on_full_output_buffer_fragmented’ [-Wmissing-declarations]
148 | bool on_full_output_buffer_fragmented(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is it normal?

THX
Lada

Yea compile warnings are expected till upstream library changes are made to allow weak references. It shouldn’t impact the behavior. Looks like you did everything else fine. Did you see libraries/AP_DDS/README.md, there is a section on the bottom about deploying to a Pixhawk6X. You can adapt it easily to Cube Orange or other hardware. As explained in the README, it’s easiest to test DDS on USB Serial because you don’t have to worry if you messed up wiring.

Thanks for reply,
SERIAL1-5 i tested via Mavlink2 protocol(test connect to MP), build with settings “./waf configure ==board OrangeCube ==enable-dds”(by upload FW i get “DDS_ENABLE=1” in parameters).
On OrangeCube this FW works fine without internal microros client.
I tested actual master branch and you fork branch from github, both had the same behavior.
Is there any other idea why there is this error?

Lada

Hi @lalal2017, just seen this referenced from another thread. Not sure if you have resolved, if so please ignore.

It’s not clear from your terminal output and commands in text which USB ports you have assigned. The text uses /dev/ttyUSB1 and the terminal screenshot /dev/ttyUSB0.

Connect a mavproxy session to the port assigned to SERIAL0 and monitor the output. This should show the status of the DDS connection, whether it is initialised and the status of each of the topics as they are created.

mavproxy.py --master /dev/ttyUSB0` 

assuming /dev/ttyUSB0 is SERIAL0.

Then run the micro-ROS agent

cd ~/ardupilot/library/AP_DDS
ros2 run micro_ros_agent micro_ros_agent serial --baudrate 921600 --dev /dev/ttyUSB1 --refs dds_xrce_profile.xml -v6

Then reboot from within mavproxy

MANUAL> reboot

What to you see in each of the terminals? (paste the command and output as text into your reply, exactly as they occur).

Hello Rhys,
thank you for your interest in solving the problem, but I am constantly testing this, then without clear success.
Anyway, I compiled a new build from master again with “CubeOrange” and “enable-dds” parameters, I used “serial1” from pixhawk (USB connected to AGX Orin, I tested via “mavlink” with success and then switched to “DDS_XRCE” as follows performed a reboot). Unfortunately, the situation is the same, no packet from pixhawk. The result is on the attached picture.

THX Lada

@lalal2017 - I suspect that you are trying to connect the micro-ROS agent to the serial port outputting mavlink. You need to document exactly what you’re doing though for us to help.

  1. What serial ports from the cube orange are connected to the companion computer
  2. What are the device names of the ports
  3. What parameters are configured for the serial ports
  4. Command line used to start mavproxy
  5. Output from mavproxy when the flight controller is rebooted
  6. Command line used to start micro-ROS
  7. Output from the micro-ROS terminal

Don’t provide screen shots of the terminals, instead capture the terminal text and past and format as:

mavproxy.py --master /dev/ttyUSB0 --console

STABLILIZE> param diff
....

etc. A screen shot of the mavproxy console will show the DDS initialisation.

OK :slight_smile: ,

schema serial connect: CubeOrange “serial1” <> AGX Orin “/dev/ttyUSB0”

set serial CubeOrange:
SERIAL1_BAUD,921
SERIAL1_OPTIONS,0
SERIAL1_PROTOCOL,45
DDS_ENABLE,1

set serial AGX Orin Ubuntu 22.04:
/dev/ttyUSB0

cmd line input:
lada@RoverAGX:~/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent serial --baudrate 921600 --dev /dev/ttyUSB0 --refs dds_xrce_profile.xml -v6
cmd line output:
[1708160814.932816] info | TermiosAgentLinux.cpp | init | running… | fd: 3
[1708160814.934334] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6

…have source problem, micro_ros_agent not working !!!without running mavproxy!!!

THX
Lada

Still missing information:

  • What device is the console / mavlink mapped to? (/dev/ttyUSB1 ?)
  • What is the output from mavproxy when connected to the console serial device?
  • You should lower the baud rate to 115200 as has been suggested above.

Have you tried connecting the flight controller to your PC, and getting it set up on an standard Ubuntu machine (i.e. remove possible config issues with the companion computer)?

…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