ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

HAROS v4 and IROS 2021 Tutorial

Hello, everyone!

HAROS is a set of tools for quality assurance of ROS systems. It reads your ROS source code and detects a number of issues. It is also capable of automatically extracting the Computation Graph from the source code (with some limitations), and verify properties (with some limitations) by generating runtime monitors or tests, for instance.

HAROS currently sits at version 3.10.3, which is likely one of the last versions supporting only ROS1. We are organizing a tutorial at IROS 2021, in late september, targeting this version.
Details on this tutorial can be found on this page.

On another note, I am starting the design and development of the next major version, v4, which, among other things, aims at:

  • supporting ROS2, in addition to ROS;
  • improving source code parsing capabilities;
  • redesigning the visualizer, offering new ways of exploring reports and models;
  • making the tool more user-friendly, overall.

Since this is a free and open source tool, I have no clue who its users are and how to reach them effectively. So, I take this opportunity to share a small survey on Google Forms, aiming to collect user feedback and help me decide on how to better invest my time, in ways that are actually useful for the ROS community.

I know people generally do not like surveys, but, in my defense, there’s only a handful of required questions, so it can be done in about two minutes of your time. It is also anonymous, I am not requiring emails or sign-ins of any kind.

Let me know if you are interested in any of these topics!


Amazing, looking for a version supporting ros2 :blush:


As a first step: Noetic support would be nice.

Could you be more specific, @Timple ? Is there anything in Noetic that you have found not to be working?

Ah, I assumed this was a known issue: Add Python 3 support Β· Issue #26 Β· git-afsantos/haros Β· GitHub

I tried the installation instructions and they failed for python3 (the default for ubuntu 20.04 and ROS Noetic).

$ pip install --user haros
Collecting haros
  Downloading haros-3.10.4.tar.gz (323 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 323 kB 2.2 MB/s 
Collecting bonsai-code<1.0.0,>=0.5.0
  Using cached bonsai-code-0.6.3.tar.gz (39 kB)
Collecting haros-plugins<2.0.0,>=1.0.3
  Using cached haros_plugins-1.1.4.tar.gz (83 kB)
Collecting hpl-specs
  Using cached hpl-specs-0.2.1.tar.gz (26 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8i3_w97t/hpl-specs/'"'"'; __file__='"'"'/tmp/pip-install-8i3_w97t/hpl-specs/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-8i3_w97t/hpl-specs/pip-egg-info
         cwd: /tmp/pip-install-8i3_w97t/hpl-specs/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-8i3_w97t/hpl-specs/", line 24, in <module>
        requirements = [r for r in read("requirements.txt").splitlines() if r]
      File "/tmp/pip-install-8i3_w97t/hpl-specs/", line 18, in read
        with open(os.path.join(os.path.dirname(__file__), fname)) as f:
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-8i3_w97t/hpl-specs/requirements.txt'
ERROR: Command errored out with exit status 1: python egg_info Check the logs for full command output.

This led me to the issues page where I found the python3 incompatibility.

PS. Noetic is also missing in the installation instructions.

1 Like

Thanks for reporting the issue. As per the GitHub discussion, the installation error should be fixed.

I have also merged the previously pending changes to HAROS that add support for Python3 and close the issue you linked to.

With that, I believe it should be working (at least minimally) with Noetic.
In the next few days I will be running more tests and fixing further issues that may pop up, as I am putting together a Noetic Docker image with HAROS for the tutorial session I mentioned in the original post.

1 Like

Great! I’ll give it a go again next week!

Hi, I tested the tool yesterday and I think I also have some python2/python3 problems as the tested packages include some scripts in python2 and some in python3. I have managed to test some of the packages which are completely python3 without a problem, but for others I get such errors:

  File "/home/fgrcar/.local/lib/python3.6/site-packages/haros/", line 741, in set_file_stats
    for line in handle:
  File "/usr/lib/python3.6/", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 1: invalid continuation byte

Also one thing I noticed is about the package.xml where I had <maintainer email="" /> instead of <maintainer email="">Name Surname</maintainer> which the catkin linter does not point out as an error but the Haros crashed with an error:

  File "/home/fgrcar/.local/lib/python3.6/site-packages/haros/", line 828, in _parse_metadata
    name = el.text.strip() or "?"
AttributeError: 'NoneType' object has no attribute 'strip'

I’ve installed Haros with pip3 on the Ubuntu 18 (ROS melodic).

So regarding the first error I would like to know if you think that the problem is the mixture of python2 and python3 scripts and if so, is it anyhow possible to use the Haros for such packages?
Regarding the second problem I would kind of expect that the problem is pointed out but not that the process crashes, so I am interested in your opinion about this :slight_smile:

Hi, @fgrcar. Thanks for reporting the errors!
I am still experimenting with Python3, so it is possible that some bugs are not yet fixed.

Regarding your first report:

Can you confirm that all analysed files are encoded in UTF-8? The error might be due to, for example, files in Latin-1. If this is not the problem, or to continue the discussion, let us use the issue tracker.

Regarding your second report:

Nice catch, I had not anticipated that such tags were accepted in the first place.
It has been fixed in version 3.10.7 (available with pip).

Hi, you are right, the reason is the encoding but not of the source code files. I realized that the pyc files are Latin-1 encoded and I think there is no need to even look at this files. Maybe there could be some filter so that only specific file types would be analyzed as from my perspective there can be various types of files found in the ROS packages that shouldn’t be looked at (compiled code, binaries etc.).
Anyway thank you for your fast response yesterday :slight_smile:

Absolutely right, @fgrcar . The tool was ignoring .pyc files produced with Python3, that are placed under a __pycache__ directory, but not .pyc files produced with Python2, which are placed alongside the scripts. When trying to read a non-UTF-8 file, it crashed.

I have fixed the issue; your .pyc files should be ignored during analysis now.

1 Like

Small update on this topic, that should be of interest to a handful of people.

The first batch of step by step, hands-on exercises is available on GitHub:

And there are a few 10-15 minute videos following these instructions and exercises on YouTube:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.