Error creating ROS2 Node with rclpy for Isaac Omniverse

Hi,

I’m trying to build an application where via ROS2 Topics a Target point is transmitted to IsaacSIM where the trajectory planing should take place.
The relevant code looks as follows:

import rclpy
...
node = rclpy.create_node("simNode")

When building the node the following error occurs:

Traceback (most recent call last):
  File "/home/isy/workspace/src/ISY-Project_UR5e/ur_isaacsim/ur_isaacsim.py", line 70, in <module>
    simNode = rclpy.create_node("SimNode")
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py", line 140, in create_node
    from rclpy.node import Node  # noqa: F811
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 42, in <module>
    from rclpy.client import Client
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/client.py", line 22, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/implementation_singleton.py", line 31, in <module>
    rclpy_implementation = _import('._rclpy')
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/__init__.py", line 28, in _import
    return importlib.import_module(name, package='rclpy')
  File "/home/isy/.local/share/ov/pkg/isaac_sim-2022.1.1/kit/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'rclpy._rclpy'
The C extension '/opt/ros/foxy/lib/python3.8/site-packages/rclpy/_rclpy.cpython-37m-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/Installation-Troubleshooting/#import-failing-without-library-present-on-the-system' for possible solutions

So far I’ve tried to rebuild the ros2_workspace but even that couldn’t be done successfully.
The following error occurs:

Starting >>> carter_description
Starting >>> carter_navigation
Starting >>> isaac_moveit
Starting >>> isaac_ros2_messages
Starting >>> isaac_ros_navigation_goal
Starting >>> isaac_tutorials
/home/isy/.local/lib/python3.8/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'script-dir' will not be supported in future versions. Please use the underscore name 'script_dir' instead
  warnings.warn(
/home/isy/.local/lib/python3.8/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'install-scripts' will not be supported in future versions. Please use the underscore name 'install_scripts' instead
  warnings.warn(
--- stderr: isaac_ros2_messages                                                                                                                                                                           
make[2]: *** No rule to make target '/opt/ros/foxy/lib/libfastrtps.so.2.1.1', needed by 'libisaac_ros2_messages__rosidl_typesupport_fastrtps_cpp.so'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:358: CMakeFiles/isaac_ros2_messages__rosidl_typesupport_fastrtps_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:141: all] Error 2
---
Failed   <<< isaac_ros2_messages [0.37s, exited with code 2]
Aborted  <<< carter_navigation [0.39s]
Aborted  <<< isaac_moveit [0.38s]
Aborted  <<< carter_description [0.41s]
Aborted  <<< isaac_tutorials [0.35s]
Aborted  <<< isaac_ros_navigation_goal [0.75s

This seems odd to me because I thought that ROS2 is build correctly due to a working ROS2 Bridge and publishing Topics via an ActionGraph which is build with the script.

Any suggestions how to fix this error?

Many thanks in advance!

Meanwhile I found my error.

Every time I opened a terminal I sourced ROS2 Foxy and the ros2_workspace by default via the .zshrc (.bashrc).
This led to the unwanted behavior.
When opening a terminal to launch the IsaacSIM script I now source:

source ~/.local/share/ov/pkg/isaac_sim-2022.1.1/ros2_workspace/install/local_setup.zsh

And when I open the second terminal to run the ROS2 Nodes I source:

source /opt/ros/foxy/setup.zsh
source ~/workspace/install/setup.zsh 

Now everything works as intended

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