Energy efficiency in ROS communication: a comparison across programming languages and workloads

Hello folks,
I was wondering if this paper would be of interest for some people here:
“Energy efficiency in ROS communication: a comparison across programming languages and workloads”

TD;DR:
Introduction: The Robot Operating System (ROS) is a widely used framework for robotic software development, providing robust client libraries for both C++ and Python. These languages, with their differing levels of abstraction, exhibit distinct resource usage patterns, including power and energy consumption–an increasingly critical quality metric in robotics.

Methods: In this study, we evaluate the energy efficiency of ROS two nodes implemented in C++ and Python, focusing on the primary ROS communication paradigms: topics, services, and actions. Through a series of empirical experiments, with programming language, message interval, and number of clients as independent variables, we analyze the impact on energy efficiency across implementations of the three paradigms.

Results: Our data analysis demonstrates that Python consistently demands more computational resources, leading to higher power consumption compared to C++. Furthermore, we find that message frequency is a highly influential factor, while the number of clients has a more variable and less significant effect on resource usage, despite revealing unexpected architectural behaviors of underlying programming and communication layers.

6 Likes

No time to read report - Question: Did you find anything unexpected? (I could have guessed your posted result - sorry. Did you include ROS composition? (That has a big effect on computational resource usage from what I have read in processor load studies.)

Hi, @RobotDreams!

We expected Python to consume more energy, as in other general-purpose systems. However, since both languages share the same underlying layers, we expected the difference not to be that different. The paper shows that even for very simple case studies, Python, even if only on the top layers of the ROS 2 programming stack, has a considerable impact on the energy efficiency of the nodes.

I am one of the authors of that manuscript. The most unexpected behavior was a publisher consuming more energy as the number of subscribers increases. Even if slightly, such an increase, in our interpretation, tells us that some mismanagement happens when communication with the DDS layer, which should take care of replicating the message. Note that we measure the CPU and energy of the publisher process, not of the whole machine.

Another point is that the service clients reduce their energy consumption as the number of clients for a certain service increases. This only happens with Python, even with different QoS configurations. We checked the logs, and the results seem to be coherent. A guess (not investigated in the paper) is that it is related to Python threading limitations (or benefits, in this case).

About composition, we planned to first experiment with a “monolith” architecture. However, the use of composition is on our radar for our next round of experiments.

Any suggestions on what to experiment with in this sense are more than welcome!

Cheers,
Michel

5 Likes

Some of y’all don’t ready the news and it shows. :wink:

8 Likes