HARD_LIVELINESS_CHECK in micro-ROS

A micro-ROS mechanism for checking the status of the middleware link between the micro-ROS agent and the client has been added.

This new feature has been requested by the community here.

Many micro-ROS use cases are based on nodes that are continuously sending or receiving data or commands via ROS 2 interfaces.

The HARD_LIVELINESS_CHECK mechanism allows the micro-ROS client to tell the agent that its liveliness must be ensured. This way, the micro-ROS agent will take care of ensuring that the micro-ROS client is alive and will destroy the established micro-ROS session if a certain timeout happens with any response from the client side. This means that the nodes, publishers, subscribers (and any other entity) created by the client will be removed from the ROS 2 graph.

This new mechanism ensures that the micro-ROS client and agent will be automatically checking their status. The liveliness checking period can be configured in milliseconds.

The HARD_LIVELINESS_CHECK mechanism is enabled by default in the micro-ROS Agent and must be enabled by means of a CMake argument in the micro-ROS client.

This new mechanism helps to ensure a reliable connection between micro-ROS client and micro-ROS agent and let the user know when the embedded side of the ROS 2 application is no longer available because of a firmware fault or a link issue.

PR are already available in the micro-ROS default middleware (Micro XRCE-DDS) library:

6 Likes

Hi, we are trying to use microROS for a STM32 embedded system with ROS2 on the host side. On micro-ROS galactic, one problem that we noticed was that the if the microcontroller is already plugged in and publishing data, and then the agent is started afterwards on the host PC, the the microcontroller needs to be reset for the agent to detect it and communicate with it. Does the HARD_LIVELINESS_CHECK feature solver this problem as well?

Hello @Aditya_Agarwal, not really. You are looking for the ping feature in micro-ROS. Here you have an example: micro_ros_arduino/micro-ros_reconnection_example.ino at humble · micro-ROS/micro_ros_arduino · GitHub

Thanks! This is helpful. We are using zephyr with stm32, so I am assuming this is the corresponding example - zephyr_apps/main.c at humble · micro-ROS/zephyr_apps · GitHub?

Yes, let us know if you have any issues.

Hi, my colleague tried the example but faced an issue described here - Ping does not work after `rclc_support_init` is called · Issue #65 · micro-ROS/zephyr_apps · GitHub. Would be great if we could get some feedback on it.

@pablogs Is there any documentation on how to turn on/off liveliness check on the agent and also how to configure the timeout? Or does it get this information from the client?

Hello @Aditya_Agarwal, it is enabled by default on the Agent side. It is the Client side that request this feature during session creation. Just use your colcon.meta to tune those CMake flags.