自定义接口RCLPY ModuleNotFoundError
-
[标题: No module named 'example_ros2_interfaces']
问题描述:
运行时无法找到example_ros2_interfaces此模块具体细节和上下文:
使用以下命令:
cat@lubancat:~/ros/d2lros2/chapt3/chapt3_ws$ ros2 run example_interfaces_rclpy example_interfaces_robot_02报错内容:
cat@lubancat:~/ros/d2lros2/chapt3/chapt3_ws$ ros2 run example_interfaces_rclpy example_interfaces_robot_02
Traceback (most recent call last):
File "/home/cat/ros/d2lros2/chapt3/chapt3_ws/install/example_interfaces_rclpy/lib/example_interfaces_rclpy/example_interfaces_robot_02", line 33, in <module>
sys.exit(load_entry_point('example-interfaces-rclpy==0.0.0', 'console_scripts', 'example_interfaces_robot_02')())
File "/home/cat/ros/d2lros2/chapt3/chapt3_ws/install/example_interfaces_rclpy/lib/example_interfaces_rclpy/example_interfaces_robot_02", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.10/importlib/metadata/init.py", line 171, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/cat/ros/d2lros2/chapt3/chapt3_ws/install/example_interfaces_rclpy/lib/python3.10/site-packages/example_interfaces_rclpy/example_interfaces_robot_02.py", line 4, in <module>
from example_ros2_interfaces.msg import RobotStatus
ModuleNotFoundError: No module named 'example_ros2_interfaces'
[ros2run]: Process exited with failure 1问题补充:
使用的是python3.10
系统是Ubuntu 22.04