紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
Failed to load entry point 'launch': No module named 'launch.launch_description_sources'
-
各位好,我初学ROS2,现在碰到了一个问题,向大家请教一下:
- 按照ros2官网的创建launch文件教程,在终端输入:
cd ~ws/src mkdir launch touch simple.launch.py
- 编辑好launch文件:
from launch import LaunchDescription from launch_ros.actions import Node def generate_launch_description(): return LaunchDescription([ Node( package='learning_topic', executable='helloworld_topicpub_node', ), Node( package='learning_topic', executable='helloword_topicsub_node', ), ])
- 使用launch文件启动节点(以上两个节点我单独启动过,均没有问题):
cd ~/ws/src/launch ros2 launch simple.launch.py
会提示报错:
Failed to load entry point 'launch': No module named 'launch.launch_description_sources' Traceback (most recent call last): File "/opt/ros/humble/bin/ros2", line 33, in <module> sys.exit(load_entry_point('ros2cli==0.18.7', 'console_scripts', 'ros2')()) File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 50, in main add_subparsers_on_demand( File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/command/__init__.py", line 237, in add_subparsers_on_demand extension = command_extensions[name] KeyError: 'launch'
我更换了工作空间也不行,但是之前下载的一个课程文件(也是一个单独的工作空间)中的launch文件却能正常启动,一直找不到原因,请各位赐教。
附上我话题的setup文件:
from setuptools import find_packages, setup package_name = 'learning_topic' setup( name=package_name, version='0.0.0', packages=find_packages(exclude=['test']), data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), ], install_requires=['setuptools'], zip_safe=True, maintainer='huang', maintainer_email='huang@todo.todo', description='TODO: Package description', license='TODO: License declaration', tests_require=['pytest'], entry_points={ 'console_scripts': [ 'helloworld_topicpub_node = learning_topic.topic_publish:main', 'helloworld_topicsub_node = learning_topic.topic_subscribe:main', ], }, )