ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Could not import 'rosidl_typesupport_c' for package <packagename>

asked 2021-01-09 10:38:44 -0500

maslovay gravatar image

I'm trying to create my own action, as an example i'm using official repo https://github.com/ros2/demos/tree/ma...

It works wells from the box.

After I just change the name of the package and action name i recived:

 rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package '.<package name>'

What I'm doing wrong?

the whole error text is:

Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support
    return importlib.import_module(module_name, package=pkg_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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rb_actions.rb_actions_s__rosidl_typesupport_c'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "rb_action_server.py", line 32, in <module>
    main()
  File "rb_action_server.py", line 26, in main
    Fb_action_server = FbActionServer()
  File "rb_action_server.py", line 11, in __init__
    self._action_server = ActionServer(
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/action/server.py", line 249, in __init__
    check_for_type_support(action_type)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/type_support.py", line 29, in check_for_type_support
    msg_type.__class__.__import_type_support__()
  File "/home/maslov/ros2_ws/install/rb_actions/lib/python3.7/site-packages/rb_actions/action/_fb.py", line 1205, in __import_type_support__
    module = import_type_support('rb_actions')
  File "/opt/ros/foxy/lib/python3.8/site-packages/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 'rb_actions'
Exception ignored in: <function ActionServer.__del__ at 0x7f453eca14c0>
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/action/server.py", line 625, in __del__
    self.destroy()
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/action/server.py", line 612, in destroy
    if self._handle is None:
AttributeError: 'ActionServer' object has no attribute '_handle'

When i just call the python script like in the tutorial. https://index.ros.org/doc/ros2/Tutori...

edit retag flag offensive close merge delete

Comments

I face the same problem, did you solved that?

sph gravatar image sph  ( 2021-03-19 04:14:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-05-30 00:34:20 -0500

Not sure if the same cause but I also got the same error. When you add a new msg type in the interface definition, you also need to add the dependency in the CMakeLists.txt file. Check this source code for example: link text

Specifically, add the dependencies of your msg after: rosidl_generate_interfaces( ... DEPENDENCIES geometry_msgs etc...)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-01-09 10:38:44 -0500

Seen: 850 times

Last updated: Jan 09 '21