Use parrot-olympe in ROS foxy package

Hello,

I have created a ROS workspace and package which uses the olympe library.
I have installed olympe via pip on python 3.8.10 and test the installation by running

import olympe

from the python terminal and works fine.
When I build my ROS package and run it, it fails to find the ‘parrot.protobuf’ module.
The exception traceback can be seen below:

No module named 'parrot.protobuf'
ModuleLoader unhandled exception
Traceback (most recent call last):
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/proto.py", line 628, in parse_proto
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/tmprfo7ojxe/arsdk/led_pb2.py", line 17, in <module>
ModuleNotFoundError: No module named 'parrot.protobuf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/module_loader.py", line 70, in add_package_root
    self.enums[root] = ArsdkEnums.get(root)
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/enums.py", line 438, in get
    ret = ArsdkEnums(root)
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/enums.py", line 448, in __init__
    self._proto = ArsdkProto.get(root)
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/proto.py", line 201, in get
    ret = ArsdkProto(root)
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/proto.py", line 257, in __init__
    self.parse_protos()
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/proto.py", line 542, in parse_protos
    _, feature = self.parse_proto(
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/proto.py", line 633, in parse_proto
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/tmprfo7ojxe/arsdk/led_pb2.py", line 17, in <module>
ModuleNotFoundError: No module named 'parrot.protobuf'
Traceback (most recent call last):
  File "/home/gcid/agro4/install/parrot/lib/parrot/parrot_drone", line 11, in <module>
    load_entry_point('parrot==0.0.0', 'console_scripts', 'parrot_drone')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/gcid/agro4/install/parrot/lib/python3.8/site-packages/parrot/parrot_drone.py", line 20, in <module>
    import olympe
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/__init__.py", line 32, in <module>
    from .controller import Drone, SkyController
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/controller.py", line 32, in <module>
    from .arsdkng.cmd_itf import Connect, Disconnect, Connected, Disconnected  # noqa
  File "/home/gcid/.local/lib/python3.8/site-packages/olympe/arsdkng/cmd_itf.py", line 41, in <module>
    from olympe.enums import drone_manager as drone_manager_enums
ModuleNotFoundError: No module named 'olympe.enums'

The error will be thrown only AFTER I source the package’s source files by running
. install/setup.bash

Before running the above command the olympe module is imported just fine without any errors.

I have tried installing and import olympe by following the steps suggested by ROS here, through a virtual environment inside the workspace, but it still doesn’t work.

On a side note, the IDE I am using (VSCode) shows that the messages sub-module cannot be found, but all the other sub-modules and classes are fine.

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