Hello,
I am trying to use my own custom ros messages in a publisher that I run on the Script Editor in Omniverse Isaac Sim, but I keep getting the following error:
2022-03-24 14:29:11 [18,583ms] [Error] [asyncio] [/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/python/lib/python3.7/asyncio/base_events.py:1619] Task exception was never retrieved
future: <Task finished coro=<my_task() done, defined at executing: Python 0...:32> exception=UnsupportedTypeSupport("Could not import 'rosidl_typesupport_c' for package 'my_test_msgs'")>
Traceback (most recent call last):
File "/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.ros2_bridge/omni/isaac/rclpy/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support
return importlib.import_module(module_name, package=pkg_name)
File "/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'my_test_msgs.my_test_msgs_s__rosidl_typesupport_c'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "executing: Python 0...", line 34, in my_task
File "/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.ros2_bridge/omni/isaac/rclpy/rclpy/node.py", line 1140, in create_publisher
check_for_type_support(msg_type)
File "/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.ros2_bridge/omni/isaac/rclpy/rclpy/type_support.py", line 29, in check_for_type_support
msg_type.__class__.__import_type_support__()
File "/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.ros2_bridge/omni/isaac/rclpy/my_test_msgs/msg/_num.py", line 27, in __import_type_support__
module = import_type_support('my_test_msgs')
File "/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.ros2_bridge/omni/isaac/rclpy/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_support
raise UnsupportedTypeSupport(pkg_name)
rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'my_test_msgs'
These are the steps that I followed:
I created a package with a custom message following the tutorial here.
Here’s my CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
project(dsd_test_msgs)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rosidl_default_generators REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/Num.msg"
)
ament_package()
And my package.xml:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>dsd_test_msgs</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="***">user</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<build_depend>rosidl_default_generators</build_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
and I created a test message in /msg/Num.msg that looks like this:
int64 num
I then build the package from my workspace with:
colcon build --packages-select my_test_msgs
I then copy the contents from
$ROS_WORKSPACE/install/my_test_msgs/lib/python3.8/site-packages/my_test_msgs
to
/home/user/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.ros2_bridge/omni/isaac/rclpy/my_test_msgs
After that I go to the Script Editor in Isaac Sim and I try to run this async ros publisher:
import asyncio
import rclpy
import omni
import numpy as np
from my_test_msgs.msg import Num
try:
rclpy.init()
except:
print("rclpy has already been initialized, do nothing.")
async def my_task():
node = rclpy.create_node('my_publisher')
pub = node.create_publisher(Num, 'chatter', 10)
msg = Num()
while rclpy.ok():
msg.num = (1).astype(np.int64)
pub.publish(msg)
await asyncio.sleep(1.0)
pub.unregister()
pub = None
asyncio.ensure_future(my_task())
And I keep getting the UnsupportedTypeSupport error message form above.
What am I missing?