您当前的位置: 首页 > 

鱼香ROS

暂无认证

  • 3浏览

    0关注

    498博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

记录一次ROS2消息BUG ImportError rosidl_generator_c.so: undefined symbol

鱼香ROS 发布时间:2021-08-13 13:24:04 ,浏览量:3

我是小鱼,欢迎关注公众号鱼香ROS,一起学习机器人。

BUG表现如下 自定义消息,编译不报错,运行就出错
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 "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 975, in _find_and_load_unlocked
  File "", line 657, in _load_unlocked
  File "", line 556, in module_from_spec
  File "", line 1166, in create_module
  File "", line 219, in _call_with_frames_removed
ImportError: /home/ros2/code/town_ws/install/village_interfaces/lib/libvillage_interfaces__rosidl_generator_c.so: undefined symbol: sensor_msgs__msg__Image__init

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ros2/code/town_ws/install/village_li/lib/village_li/li4_node", line 11, in 
    load_entry_point('village-li==0.0.0', 'console_scripts', 'li4_node')()
  File "/home/ros2/code/town_ws/install/village_li/lib/python3.8/site-packages/village_li/li4.py", line 46, in main
    node = Li4Node()  # 新建一个节点
  File "/home/ros2/code/town_ws/install/village_li/lib/python3.8/site-packages/village_li/li4.py", line 23, in __init__
    self.borrow_server = self.create_service(BorrowMoney,"borrow_money",self.borrow_money_callback)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1295, in create_service
    check_for_type_support(srv_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/ros2/code/town_ws/install/village_interfaces/lib/python3.8/site-packages/village_interfaces/srv/_borrow_money.py", line 316, in __import_type_support__
    module = import_type_support('village_interfaces')
  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 'village_interfaces'
原因:

自定义消息未添加对其他消息的依赖

解决办法,添加依赖在CMakeists.txt中
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
  #---msg---
  "msg/Novel.msg"
  #---srv---
  "srv/BorrowMoney.srv"
  "srv/SellNovel.srv"
   DEPENDENCIES std_msgs sensor_msgs
 )
关注
打赏
1666092100
查看更多评论
立即登录/注册

微信扫码登录

0.0424s