micro-ROS/micro-ROS-Agent

Client is deleted with mRo Control Zero H7

gorghino opened this issue · 2 comments

Hi,
I flashed the latest PX4 repo in my mRo Control Zero H7.
I'm actually synced with this PR (PX4/PX4-Autopilot#20812) that fixes a problem with nuttx, otherwise the latest working PX4 version is the commit before 21 Nov (PX4/PX4-Autopilot#20793).

In my SD card I put microdds_client start -t serial -d /dev/ttyS1 -b 115200 in extras.txt.

On my Nvidia NX (Jetpack 5.0.2 - Ubuntu 20.04) I installed ROS2 humble by sources and I cloned micro-ROS-Agent in my workspace. No errors with compiling everything.

When I run ./build/micro_ros_agent/micro_ros_agent serial -D /dev/ttyTHS1 -b 115200 I can see it starting and subscribing the topics from PX4 but after 2/3sec the client is deleted and the session is closed. Then the session is either established or re-established.

[1672233093.421832] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1672233093.422874] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 4
[1672233104.307837] info     | Root.cpp           | create_client            | create                 | client_key: 0x00000001, session_id: 0x81
[1672233104.308323] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x00000001, address: 1
[1672233104.395390] info     | ProxyClient.cpp    | create_participant       | participant created    | client_key: 0x00000001, participant_id: 0x001(1)
[1672233104.414770] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3E8(2), participant_id: 0x001(1)
[1672233104.415100] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3E8(4), participant_id: 0x001(1)
[1672233104.416100] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3E8(6), subscriber_id: 0x3E8(4)
[1672233104.439207] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3E9(2), participant_id: 0x001(1)
[1672233104.439447] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3E9(4), participant_id: 0x001(1)
[1672233104.440339] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3E9(6), subscriber_id: 0x3E9(4)
[1672233104.463996] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3EA(2), participant_id: 0x001(1)
[1672233104.464295] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3EA(4), participant_id: 0x001(1)
[1672233104.465774] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3EA(6), subscriber_id: 0x3EA(4)
[1672233104.487957] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3EB(2), participant_id: 0x001(1)
[1672233104.488238] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3EB(4), participant_id: 0x001(1)
[1672233104.489680] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3EB(6), subscriber_id: 0x3EB(4)
[1672233104.517728] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x0A1(2), participant_id: 0x001(1)
[1672233104.518132] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0x00000001, publisher_id: 0x0A1(3), participant_id: 0x001(1)
[1672233104.519725] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0x00000001, datawriter_id: 0x0A1(5), publisher_id: 0x0A1(3)
[1672233104.544851] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x0A8(2), participant_id: 0x001(1)
[1672233104.545183] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0x00000001, publisher_id: 0x0A8(3), participant_id: 0x001(1)
[1672233104.546852] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0x00000001, datawriter_id: 0x0A8(5), publisher_id: 0x0A8(3)
[1672233104.572646] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x009(2), participant_id: 0x001(1)
[1672233104.573022] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0x00000001, publisher_id: 0x009(3), participant_id: 0x001(1)
[1672233104.574964] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0x00000001, datawriter_id: 0x009(5), publisher_id: 0x009(3)
[1672233104.866546] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x0AC(2), participant_id: 0x001(1)
[1672233104.867773] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0x00000001, publisher_id: 0x0AC(3), participant_id: 0x001(1)
[1672233104.873510] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0x00000001, datawriter_id: 0x0AC(5), publisher_id: 0x0AC(3)
[1672233106.198530] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x0DE(2), participant_id: 0x001(1)
[1672233106.199584] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0x00000001, publisher_id: 0x0DE(3), participant_id: 0x001(1)
[1672233106.204974] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0x00000001, datawriter_id: 0x0DE(5), publisher_id: 0x0DE(3)
[1672233106.438109] info     | Root.cpp           | delete_client            | delete                 | client_key: 0x00000001
[1672233106.438547] info     | SessionManager.hpp | destroy_session          | session closed         | client_key: 0x00000001, address: 1
[1672233106.439388] info     | Root.cpp           | create_client            | create                 | client_key: 0x00000001, session_id: 0x81
[1672233106.439504] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x00000001, address: 1
[1672233106.491187] info     | ProxyClient.cpp    | create_participant       | participant created    | client_key: 0x00000001, participant_id: 0x001(1)
[1672233106.510310] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3E8(2), participant_id: 0x001(1)
[1672233106.510564] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3E8(4), participant_id: 0x001(1)
[1672233106.511468] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3E8(6), subscriber_id: 0x3E8(4)
[1672233106.536030] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3E9(2), participant_id: 0x001(1)
[1672233106.537162] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3E9(4), participant_id: 0x001(1)
[1672233106.539827] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3E9(6), subscriber_id: 0x3E9(4)
[1672233106.561140] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3EA(2), participant_id: 0x001(1)
[1672233106.561386] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3EA(4), participant_id: 0x001(1)
[1672233106.562351] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3EA(6), subscriber_id: 0x3EA(4)
[1672233106.585070] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3EB(2), participant_id: 0x001(1)
[1672233106.585313] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3EB(4), participant_id: 0x001(1)
[1672233106.586209] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3EB(6), subscriber_id: 0x3EB(4)
[1672233108.606311] info     | Root.cpp           | delete_client            | delete                 | client_key: 0x00000001
[1672233108.606759] info     | SessionManager.hpp | destroy_session          | session closed         | client_key: 0x00000001, address: 1
[1672233109.619715] info     | Root.cpp           | create_client            | create                 | client_key: 0x00000001, session_id: 0x81
[1672233109.619825] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x00000001, address: 1
[1672233109.647632] info     | ProxyClient.cpp    | create_participant       | participant created    | client_key: 0x00000001, participant_id: 0x001(1)
[1672233109.666947] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3E8(2), participant_id: 0x001(1)
[1672233109.667222] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3E8(4), participant_id: 0x001(1)
[1672233109.668187] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3E8(6), subscriber_id: 0x3E8(4)
[1672233109.692823] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3E9(2), participant_id: 0x001(1)
[1672233109.693063] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3E9(4), participant_id: 0x001(1)
[1672233109.694111] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3E9(6), subscriber_id: 0x3E9(4)
[1672233109.717239] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3EA(2), participant_id: 0x001(1)
[1672233109.717469] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3EA(4), participant_id: 0x001(1)
[1672233109.718598] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3EA(6), subscriber_id: 0x3EA(4)
[1672233109.741280] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x00000001, topic_id: 0x3EB(2), participant_id: 0x001(1)
[1672233109.741535] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x00000001, subscriber_id: 0x3EB(4), participant_id: 0x001(1)
[1672233109.742528] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x00000001, datareader_id: 0x3EB(6), subscriber_id: 0x3EB(4)

The flight controller is powered via an external bench power supply (5V 1A).
I tried a Pixhawke 6C with latest PX4 (cloned by main repo), and the session is not closed and micro-ros-agent works.

I tried the same mRo FC with a second NVIDIA NX, same OS where we installed ROS2 Foxy by binaries. I have the same behavior with micro-ROS-Agent (latest commit with foxy branch).

To Reproduce
Steps to reproduce the behaviour:

  1. Get a mRo Control Zero H7
  2. Clone latest PX4 and apply the PR:
make mro_ctrl-zero-h7-oem
  1. Flash mro_ctrl-zero-h7-oem_default.px4 with QGroundControl or similar
  2. Add microdds_client start -t serial -d /dev/ttyS1 -b 115200 in SD's /etc/extras.txt.
  3. Wire the mRO to a UART (Ubuntu 20.04)
  4. Compile micro-ros-agent (according to your ROS2)
    git clone -b humble https://github.com/micro-ROS/micro-ROS-Agent && rosdep update && rosdep install --from-paths src --ignore-src -y && colcon build --packages-select micro_ros_agent
  5. Run micro-ros-agent after sourcing ROS2 and your workspace
    . ~/ros2_humble/install/setup.bash
    . install/setup.bash
    ./build/micro_ros_agent/micro_ros_agent serial -D /dev/ttyTHS1 -b 115200

Expected behaviour
micro-ros-agent shall start, subcribe the topics and never lose/delete the session

System information (please complete the following information):

  • OS: Ubuntu 20.04 - NVIDIA NX (Carrier board) - Jetpack 5.0.2
  • ROS 2 Humble (Tested also with Foxy)
  • Version: 0e41ea6

LOG with v6 flag:
micro-ros-agent-v6-mro.log

I chcked the logging module on the mro and apparently micro-ros-agent is complaining about a missing ping:

image

Checking PX4 code along with my Agent v6 debug, I think that

[1672235108.800513] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x00000001, len: 16, data: 
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00

is the PING requested by dds_client.
After that I have a 4 DDS write and then two send_message

[1672235108.801955] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x00000001, len: 32, data: 
0000: 81 00 00 00 0F 01 18 00 64 48 AC 63 55 6A CA 2F 64 48 AC 63 95 69 CA 2F 02 00 00 00 88 E8 14 16
[1672235108.802859] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x00000001, len: 36, data: 
0000: 81 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00

I don't know how to decode them though. Aren't they ok as PONG?

I guess that this shall be moved to PX4 client.