小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
学习ROS2时遇到无法运行节点文件,终端提示“ModuleNotFoundError: No module named 'mycamera.t_pub'”
-
问题描述:
我正在学习ROS2的节点与话题数据发布,但是运行节点时出现报错,我也按照教程在setup.py里面设定好了入口。但是还是无法运行节点(节点程序就是一个很简单的helloworld)ROS2版本是foxy,ubuntu20.04!
具体细节和上下文:
终端执行:
pi@yahboom:~/cartographer_ws2$ ros2 run mycamera t_pub
终端提示:
Traceback (most recent call last):
File "/home/pi/cartographer_ws2/ install/mycamera/lib/mycamera/t_pub", line 11, in <module>
load_entry_point('mycamera==0.0.0', 'console_scripts', 't_pub')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2451, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
ModuleNotFoundError: No module named 'mycamera.t_pub'下方是t_pub.py文件:
import rclpy from rclpy.node import Node from std_msgs.msg import String class PublisherNode(Node): def __init__(self, name): super().__init__(name) self.pub = self.create_publisher(String, "chatter", 10) self.timer = self.create_timer(0.5, self.timer_callback) def timer_callback(self): msg = String() msg.data = 'Hello World' self.pub.publish(msg) self.get_logger().info('Publishing: "%s"' % msg.data) def main(args=None): rclpy.init(args=args) node = PublisherNode("topic_helloworld_pub") rclpy.spin(node) node.destroy_node() rclpy.shutdown()
from setuptools import setup package_name = 'mycamera' setup( name=package_name, version='0.0.0', packages=[package_name], data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), ], install_requires=['setuptools'], zip_safe=True, maintainer='pi', maintainer_email='pi@todo.todo', description='TODO: Package description', license='TODO: License declaration', tests_require=['pytest'], entry_points={ 'console_scripts': [ 't_pub = mycamera.t_pub:main', ], },
)
尝试过的解决方法:
网上搜索了相关问题,相关的问题都是某个特定的功能包模块无法找到,所以需要pip install就能解决,我遇到的问题是我这个”mycamera.t_pub“节点文件找不到,希望各位大佬能帮忙看看,谢谢。
-
@2425004936 请仔细阅读提问要求后,按照提问模板提问:
https://fishros.org.cn/forum/topic/151/提问前必看-不符合要求的问题拒绝回答
再次强调,代码和日志不要截图。
-
此回复已被删除! -
@2425004936 我有几点疑问:
1.这里为什么会有一个空格/ i
在 学习ROS2时遇到无法运行节点文件,终端提示“ModuleNotFoundError: No module named 'mycamera.t_pub'” 中说:/ inst
2.你的 t_pub.py 文件从语法上来说是错误,可能构建不通过
3. 请补充你的packages.xml 和 构建 source 过程日志,以及文件目录结构信息 -
@小鱼
1.空格我看了一下终端那边显示没有,应该是我复制过来的时候出现的空格
2.t_pub.py文件应该没问题,因为我把小鱼的li4_pub.py代码复制进去运行,终端还是一样的提示。
3.packages.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>mycamera</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="pi@todo.todo">pi</maintainer> <license>TODO: License declaration</license> <test_depend>ament_copyright</test_depend> <test_depend>ament_flake8</test_depend> <test_depend>ament_pep257</test_depend> <test_depend>python3-pytest</test_depend> <export> <build_type>ament_python</build_type> </export> </package>
(构建 source 过程日志操作不是很会)
文件目录结构信息:
-
@2425004936 1.构建日志就是colcon build 的日志
2. 第二张图应该直接复制粘贴文字,而不是截图,我都没办法复制其中内容告诉你正确的是什么样,除非去P图了,所以请你修改上述内容,我再做回答再次强调,代码和日志不要截图,非必要,不要用图片
-
@小鱼
1.colcon build日志(我在工作空间下log文件夹里的latest_build找到了events.log,不确定是不是小鱼说的日志)
events.log:[0.000000] (-) TimerEvent: {} [0.000892] (-) JobUnselected: {'identifier': 'bringup'} [0.001303] (-) JobUnselected: {'identifier': 'cartographer'} [0.002081] (-) JobUnselected: {'identifier': 'cartographer_ros'} [0.002852] (-) JobUnselected: {'identifier': 'cartographer_ros_msgs'} [0.004336] (-) JobUnselected: {'identifier': 'image_color_lab'} [0.004573] (-) JobUnselected: {'identifier': 'oradar_lidar'} [0.004672] (-) JobUnselected: {'identifier': 'rf2o_laser_odometry'} [0.004799] (-) JobUnselected: {'identifier': 'ros2_imu_filter_madgwick'} [0.004882] (-) JobUnselected: {'identifier': 'tf_publisher'} [0.004957] (-) JobUnselected: {'identifier': 'urdf_tutorial_r2d2'} [0.005027] (-) JobUnselected: {'identifier': 'usb_camera_driver'} [0.005096] (-) JobUnselected: {'identifier': 'vanjee_driver'} [0.005164] (-) JobUnselected: {'identifier': 'vanjee_lidar'} [0.005231] (-) JobUnselected: {'identifier': 'vanjee_msgs'} [0.005300] (-) JobUnselected: {'identifier': 'voice_xgo_ctrl_run'} [0.005369] (-) JobUnselected: {'identifier': 'wit_ros2_imu'} [0.005436] (-) JobUnselected: {'identifier': 'yahboom_app_save_map'} [0.005507] (-) JobUnselected: {'identifier': 'yahboom_attitude_record_interfaces'} [0.005614] (-) JobUnselected: {'identifier': 'yahboom_base'} [0.007198] (-) JobUnselected: {'identifier': 'yahboom_bringup'} [0.008794] (-) JobUnselected: {'identifier': 'yahboom_color_identify_interfaces'} [0.008962] (-) JobUnselected: {'identifier': 'yahboom_color_identify_server'} [0.009104] (-) JobUnselected: {'identifier': 'yahboom_color_status_redis'} [0.009229] (-) JobUnselected: {'identifier': 'yahboom_color_staus_redis'} [0.009370] (-) JobUnselected: {'identifier': 'yahboom_color_tracking'} [0.009506] (-) JobUnselected: {'identifier': 'yahboom_ctrl'} [0.009630] (-) JobUnselected: {'identifier': 'yahboom_description'} [0.009745] (-) JobUnselected: {'identifier': 'yahboom_dog_joint_state'} [0.009867] (-) JobUnselected: {'identifier': 'yahboom_gait'} [0.009988] (-) JobUnselected: {'identifier': 'yahboom_image_compress'} [0.010104] (-) JobUnselected: {'identifier': 'yahboom_image_publisher_c'} [0.010220] (-) JobUnselected: {'identifier': 'yahboom_laser'} [0.010334] (-) JobUnselected: {'identifier': 'yahboom_mediapipe'} [0.010497] (-) JobUnselected: {'identifier': 'yahboom_msgs'} [0.010617] (-) JobUnselected: {'identifier': 'yahboom_point'} [0.010744] (-) JobUnselected: {'identifier': 'yahboom_qrcode'} [0.010885] (-) JobUnselected: {'identifier': 'yahboom_qrcode_tracking'} [0.011024] (-) JobUnselected: {'identifier': 'yahboom_set_attitude_record'} [0.011144] (-) JobUnselected: {'identifier': 'yahboom_set_height'} [0.011279] (-) JobUnselected: {'identifier': 'yahboom_visual'} [0.011450] (-) JobUnselected: {'identifier': 'yahboom_web_savmap_interfaces'} [0.011591] (mycamera) JobQueued: {'identifier': 'mycamera', 'dependencies': OrderedDict()} [0.011725] (mycamera) JobStarted: {'identifier': 'mycamera'} [0.098852] (-) TimerEvent: {} [0.199763] (-) TimerEvent: {} [0.300737] (-) TimerEvent: {} [0.423955] (-) TimerEvent: {} [0.524720] (-) TimerEvent: {} [0.625365] (-) TimerEvent: {} [0.726052] (-) TimerEvent: {} [0.826718] (-) TimerEvent: {} [0.927403] (-) TimerEvent: {} [1.028083] (-) TimerEvent: {} [1.128691] (-) TimerEvent: {} [1.229330] (-) TimerEvent: {} [1.330054] (-) TimerEvent: {} [1.430754] (-) TimerEvent: {} [1.531372] (-) TimerEvent: {} [1.631984] (-) TimerEvent: {} [1.732733] (-) TimerEvent: {} [1.833369] (-) TimerEvent: {} [1.934069] (-) TimerEvent: {} [2.035239] (-) TimerEvent: {} [2.135924] (-) TimerEvent: {} [2.236818] (-) TimerEvent: {} [2.337981] (-) TimerEvent: {} [2.438613] (-) TimerEvent: {} [2.539232] (-) TimerEvent: {} [2.639940] (-) TimerEvent: {} [2.741299] (-) TimerEvent: {} [2.841970] (-) TimerEvent: {} [2.942617] (-) TimerEvent: {} [3.043245] (-) TimerEvent: {} [3.143862] (-) TimerEvent: {} [3.244495] (-) TimerEvent: {} [3.345151] (-) TimerEvent: {} [3.445798] (-) TimerEvent: {} [3.546455] (-) TimerEvent: {} [3.647102] (-) TimerEvent: {} [3.747801] (-) TimerEvent: {} [3.848471] (-) TimerEvent: {} [3.949126] (-) TimerEvent: {} [4.049867] (-) TimerEvent: {} [4.150506] (-) TimerEvent: {} [4.251299] (-) TimerEvent: {} [4.352318] (-) TimerEvent: {} [4.452964] (-) TimerEvent: {} [4.553718] (-) TimerEvent: {} [4.654854] (-) TimerEvent: {} [4.755575] (-) TimerEvent: {} [4.856248] (-) TimerEvent: {} [4.957099] (-) TimerEvent: {} [5.039327] (mycamera) Command: {'cmd': ['/usr/bin/python3', 'setup.py', 'egg_info', '--egg-base', '../../build/mycamera', 'build', '--build-base', '/home/pi/cartographer_ws2/build/mycamera/build', 'install', '--prefix', '/home/pi/cartographer_ws2/install/mycamera', '--record', '/home/pi/cartographer_ws2/build/mycamera/install.log', '--single-version-externally-managed'], 'cwd': '/home/pi/cartographer_ws2/src/mycamera', 'env': {'LESSOPEN': '| /usr/bin/lesspipe %s', 'no_proxy': 'localhost,127.0.0.0/8,::1', 'USER': 'pi', 'SSH_AGENT_PID': '1690', 'XDG_SESSION_TYPE': 'x11', 'SHLVL': '1', 'LD_LIBRARY_PATH': '/home/pi/cartographer_ws2/install/yahboom_web_savmap_interfaces/lib:/home/pi/cartographer_ws2/install/yahboom_msgs/lib:/home/pi/cartographer_ws2/install/yahboom_image_publisher_c/lib:/home/pi/cartographer_ws2/install/yahboom_color_identify_interfaces/lib:/home/pi/cartographer_ws2/install/yahboom_attitude_record_interfaces/lib:/home/pi/cartographer_ws2/install/xgo_image_publisher_c/lib:/home/pi/cartographer_ws2/install/vanjee_msgs/lib:/home/pi/cartographer_ws2/install/usb_camera_driver/lib:/home/pi/cartographer_ws2/install/image_color_lab/lib:/home/pi/cartographer_ws2/install/cartographer_ros_msgs/lib:/usr/lib/aarch64-linux-gnu/gazebo-11/plugins:/opt/ros/foxy/opt/yaml_cpp_vendor/lib:/opt/ros/foxy/opt/rviz_ogre_vendor/lib:/opt/ros/foxy/lib/aarch64-linux-gnu:/opt/ros/foxy/lib', 'HOME': '/home/pi', 'OLDPWD': '/home/pi/cartographer_ws2/src', 'DESKTOP_SESSION': 'ubuntu', 'NO_PROXY': 'localhost,127.0.0.0/8,::1', 'ROS_PYTHON_VERSION': '3', 'GNOME_SHELL_SESSION_MODE': 'ubuntu', 'GTK_MODULES': 'gail:atk-bridge', 'MANAGERPID': '1443', 'DBUS_STARTER_BUS_TYPE': 'session', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus,guid=04a0f0ad1c29aabf2178528a66137026', 'COLORTERM': 'truecolor', 'IM_CONFIG_PHASE': '1', 'COLCON_PREFIX_PATH': '/home/pi/cartographer_ws2/install', 'ROS_DISTRO': 'foxy', 'LOGNAME': 'pi', 'JOURNAL_STREAM': '9:35921', '_': '/usr/bin/colcon', 'ROS_VERSION': '2', 'PKG_CONFIG_PATH': '/home/pi/cartographer_ws2/install/cartographer/lib/aarch64-linux-gnu/pkgconfig:/home/pi/cartographer_ws2/install/cartographer/lib/pkgconfig', 'XDG_SESSION_CLASS': 'user', 'USERNAME': 'pi', 'TERM': 'xterm-256color', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'ROS_LOCALHOST_ONLY': '0', 'WINDOWPATH': '2', 'PATH': '/home/pi/cartographer_ws2/install/oradar_lidar/bin:/home/pi/cartographer_ws2/install/cartographer/bin:/opt/ros/foxy/bin:/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin', 'SESSION_MANAGER': 'local/yahboom:@/tmp/.ICE-unix/1753,unix/yahboom:/tmp/.ICE-unix/1753', 'INVOCATION_ID': '5eb179def2bc444aa552b5e990cf08af', 'XDG_MENU_PREFIX': 'gnome-', 'GNOME_TERMINAL_SCREEN': '/org/gnome/Terminal/screen/f750f205_df20_40d3_b3db_c87ed9563a85', 'XDG_RUNTIME_DIR': '/run/user/1000', 'DISPLAY': ':0', 'LANG': 'en_US.UTF-8', 'XDG_CURRENT_DESKTOP': 'ubuntu:GNOME', 'XMODIFIERS': '@im=ibus', 'XDG_SESSION_DESKTOP': 'ubuntu', 'XAUTHORITY': '/run/user/1000/gdm/Xauthority', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'GNOME_TERMINAL_SERVICE': ':1.88', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'ROS_DOMAIN_ID': '16', 'AMENT_PREFIX_PATH': '/home/pi/cartographer_ws2/install/yahboom_xgo_odom:/home/pi/cartographer_ws2/install/yahboom_web_savmap_interfaces:/home/pi/cartographer_ws2/install/yahboom_visual:/home/pi/cartographer_ws2/install/yahboom_set_height:/home/pi/cartographer_ws2/install/yahboom_set_attitude_record:/home/pi/cartographer_ws2/install/yahboom_qrcode_tracking:/home/pi/cartographer_ws2/install/yahboom_qrcode:/home/pi/cartographer_ws2/install/yahboom_point:/home/pi/cartographer_ws2/install/yahboom_msgs:/home/pi/cartographer_ws2/install/yahboom_mediapipe:/home/pi/cartographer_ws2/install/yahboom_laser:/home/pi/cartographer_ws2/install/yahboom_image_publisher_c:/home/pi/cartographer_ws2/install/yahboom_image_compress:/home/pi/cartographer_ws2/install/yahboom_gait:/home/pi/cartographer_ws2/install/yahboom_dog_joint_state:/home/pi/cartographer_ws2/install/yahboom_description:/home/pi/cartographer_ws2/install/yahboom_ctrl:/home/pi/cartographer_ws2/install/yahboom_color_tracking:/home/pi/cartographer_ws2/install/yahboom_color_staus_redis:/home/pi/cartographer_ws2/install/yahboom_color_status_redis:/home/pi/cartographer_ws2/install/yahboom_color_identify_server:/home/pi/cartographer_ws2/install/yahboom_color_identify_interfaces:/home/pi/cartographer_ws2/install/yahboom_bringup:/home/pi/cartographer_ws2/install/yahboom_base:/home/pi/cartographer_ws2/install/yahboom_attitude_record_interfaces:/home/pi/cartographer_ws2/install/yahboom_app_save_map:/home/pi/cartographer_ws2/install/xgo_set_height:/home/pi/cartographer_ws2/install/xgo_set_attitude_record:/home/pi/cartographer_ws2/install/xgo_qrcode_tracking:/home/pi/cartographer_ws2/install/xgo_qrcode:/home/pi/cartographer_ws2/install/xgo_image_publisher_c:/home/pi/cartographer_ws2/install/xgo_image_compress:/home/pi/cartographer_ws2/install/xgo_gait:/home/pi/cartographer_ws2/install/xgo_description:/home/pi/cartographer_ws2/install/xgo_color_tracking:/home/pi/cartographer_ws2/install/xgo_color_staus_redis:/home/pi/cartographer_ws2/install/xgo_color_status_redis:/home/pi/cartographer_ws2/install/xgo_bringup:/home/pi/cartographer_ws2/install/wit_ros2_imu:/home/pi/cartographer_ws2/install/voice_xgo_ctrl_run:/home/pi/cartographer_ws2/install/vanjee_lidar:/home/pi/cartographer_ws2/install/vanjee_driver:/home/pi/cartographer_ws2/install/vanjee_msgs:/home/pi/cartographer_ws2/install/usb_camera_driver:/home/pi/cartographer_ws2/install/urdf_tutorial_r2d2:/home/pi/cartographer_ws2/install/tf_publisher:/home/pi/cartographer_ws2/install/ros2_imu_filter_madgwick:/home/pi/cartographer_ws2/install/rf2o_laser_odometry:/home/pi/cartographer_ws2/install/oradar_lidar:/home/pi/cartographer_ws2/install/mycamera:/home/pi/cartographer_ws2/install/image_color_lab:/home/pi/cartographer_ws2/install/cartographer_ros:/home/pi/cartographer_ws2/install/cartographer_ros_msgs:/home/pi/cartographer_ws2/install/bringup:/opt/ros/foxy', 'SHELL': '/bin/bash', 'QT_ACCESSIBILITY': '1', 'GDMSESSION': 'ubuntu', 'yahboomcar_MODEL': 'waffle_pi', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'GPG_AGENT_INFO': '/run/user/1000/gnupg/S.gpg-agent:0:1', 'QT_IM_MODULE': 'ibus', 'PWD': '/home/pi/cartographer_ws2/build/mycamera', 'LC_ALL': 'en_US.UTF-8', 'XDG_CONFIG_DIRS': '/etc/xdg/xdg-ubuntu:/etc/xdg', 'DBUS_STARTER_ADDRESS': 'unix:path=/run/user/1000/bus,guid=04a0f0ad1c29aabf2178528a66137026', 'XDG_DATA_DIRS': '/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop', 'PYTHONPATH': '/home/pi/cartographer_ws2/install/mycamera/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_xgo_odom/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_web_savmap_interfaces/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_visual/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_set_height/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_set_attitude_record/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_qrcode_tracking/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_msgs/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_mediapipe/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_laser/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_image_publisher_c/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_image_compress/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_gait/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_dog_joint_state/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_description/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_ctrl/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_color_tracking/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_color_staus_redis/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_color_status_redis/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_color_identify_server/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_color_identify_interfaces/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_bringup/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_base/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_attitude_record_interfaces/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/yahboom_app_save_map/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_set_height/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_set_attitude_record/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_qrcode_tracking/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_image_publisher_c/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_image_compress/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_gait/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_description/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_color_tracking/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_color_staus_redis/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_color_status_redis/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/xgo_bringup/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/wit_ros2_imu/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/voice_xgo_ctrl_run/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/vanjee_msgs/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/urdf_tutorial_r2d2/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/tf_publisher/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/mycamera/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/image_color_lab/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/cartographer_ros_msgs/lib/python3.8/site-packages:/home/pi/cartographer_ws2/install/bringup/lib/python3.8/site-packages:/opt/ros/foxy/lib/python3.8/site-packages', 'COLCON': '1', 'VTE_VERSION': '6003', 'CMAKE_PREFIX_PATH': '/home/pi/cartographer_ws2/install/yahboom_web_savmap_interfaces:/home/pi/cartographer_ws2/install/yahboom_qrcode:/home/pi/cartographer_ws2/install/yahboom_point:/home/pi/cartographer_ws2/install/yahboom_msgs:/home/pi/cartographer_ws2/install/yahboom_image_publisher_c:/home/pi/cartographer_ws2/install/yahboom_color_identify_interfaces:/home/pi/cartographer_ws2/install/yahboom_attitude_record_interfaces:/home/pi/cartographer_ws2/install/xgo_qrcode:/home/pi/cartographer_ws2/install/xgo_image_publisher_c:/home/pi/cartographer_ws2/install/vanjee_lidar:/home/pi/cartographer_ws2/install/vanjee_driver:/home/pi/cartographer_ws2/install/vanjee_msgs:/home/pi/cartographer_ws2/install/usb_camera_driver:/home/pi/cartographer_ws2/install/ros2_imu_filter_madgwick:/home/pi/cartographer_ws2/install/rf2o_laser_odometry:/home/pi/cartographer_ws2/install/oradar_lidar:/home/pi/cartographer_ws2/install/image_color_lab:/home/pi/cartographer_ws2/install/cartographer_ros:/home/pi/cartographer_ws2/install/cartographer_ros_msgs:/home/pi/cartographer_ws2/install/cartographer'}, 'shell': False} [5.058272] (-) TimerEvent: {} [5.165494] (-) TimerEvent: {} [5.266156] (-) TimerEvent: {} [5.367030] (-) TimerEvent: {} [5.467761] (-) TimerEvent: {} [5.568443] (-) TimerEvent: {} [5.669285] (-) TimerEvent: {} [5.770003] (-) TimerEvent: {} [5.870716] (-) TimerEvent: {} [5.971426] (-) TimerEvent: {} [6.072260] (-) TimerEvent: {} [6.172885] (-) TimerEvent: {} [6.273571] (-) TimerEvent: {} [6.374229] (-) TimerEvent: {} [6.474875] (-) TimerEvent: {} [6.575499] (-) TimerEvent: {} [6.676134] (-) TimerEvent: {} [6.751567] (mycamera) StdoutLine: {'line': b'running egg_info\n'} [6.754022] (mycamera) StdoutLine: {'line': b'writing ../../build/mycamera/mycamera.egg-info/PKG-INFO\n'} [6.756111] (mycamera) StdoutLine: {'line': b'writing dependency_links to ../../build/mycamera/mycamera.egg-info/dependency_links.txt\n'} [6.756998] (mycamera) StdoutLine: {'line': b'writing entry points to ../../build/mycamera/mycamera.egg-info/entry_points.txt\n'} [6.757713] (mycamera) StdoutLine: {'line': b'writing requirements to ../../build/mycamera/mycamera.egg-info/requires.txt\n'} [6.758323] (mycamera) StdoutLine: {'line': b'writing top-level names to ../../build/mycamera/mycamera.egg-info/top_level.txt\n'} [6.776268] (-) TimerEvent: {} [6.876999] (-) TimerEvent: {} [6.922696] (mycamera) StdoutLine: {'line': b"reading manifest file '../../build/mycamera/mycamera.egg-info/SOURCES.txt'\n"} [6.927013] (mycamera) StdoutLine: {'line': b"writing manifest file '../../build/mycamera/mycamera.egg-info/SOURCES.txt'\n"} [6.927837] (mycamera) StdoutLine: {'line': b'running build\n'} [6.928418] (mycamera) StdoutLine: {'line': b'running build_py\n'} [6.930533] (mycamera) StdoutLine: {'line': b'running install\n'} [6.935534] (mycamera) StdoutLine: {'line': b'running install_lib\n'} [6.944879] (mycamera) StdoutLine: {'line': b'running install_data\n'} [6.947850] (mycamera) StdoutLine: {'line': b'running install_egg_info\n'} [6.958968] (mycamera) StdoutLine: {'line': b"removing '/home/pi/cartographer_ws2/install/mycamera/lib/python3.8/site-packages/mycamera-0.0.0-py3.8.egg-info' (and everything under it)\n"} [6.960455] (mycamera) StdoutLine: {'line': b'Copying ../../build/mycamera/mycamera.egg-info to /home/pi/cartographer_ws2/install/mycamera/lib/python3.8/site-packages/mycamera-0.0.0-py3.8.egg-info\n'} [6.965611] (mycamera) StdoutLine: {'line': b'running install_scripts\n'} [6.977118] (-) TimerEvent: {} [7.048514] (mycamera) StdoutLine: {'line': b'Installing t_pub script to /home/pi/cartographer_ws2/install/mycamera/lib/mycamera\n'} [7.050415] (mycamera) StdoutLine: {'line': b'Installing t_sub script to /home/pi/cartographer_ws2/install/mycamera/lib/mycamera\n'} [7.051348] (mycamera) StdoutLine: {'line': b'Installing topic_camera_pub script to /home/pi/cartographer_ws2/install/mycamera/lib/mycamera\n'} [7.052274] (mycamera) StdoutLine: {'line': b'Installing topic_camera_sub script to /home/pi/cartographer_ws2/install/mycamera/lib/mycamera\n'} [7.055151] (mycamera) StdoutLine: {'line': b"writing list of installed files to '/home/pi/cartographer_ws2/build/mycamera/install.log'\n"} [7.077437] (-) TimerEvent: {} [7.162148] (mycamera) CommandEnded: {'returncode': 0} [7.177644] (-) TimerEvent: {} [7.264252] (mycamera) JobEnded: {'identifier': 'mycamera', 'rc': 0} [7.267466] (-) EventReactorShutdown: {}
2.文件目录结构信息:
mycamera |---mycamera | |--- __init__.py |---package.xml |---resource | |---mycamera |---setup.cfg |---setup.py |---test | |---test_copyright.py | |---test_flake8.py | |---test_pep257.py |---topic_camera_pub.py |---topic_camera_sub.py |---t_pub.py |---t_sub.py
-
@小鱼 小鱼,问题解决了,问题真的出现在文件目录结构上面,应该把t_pub这些代码放在/src/mycamera/mycarema下面,我之前是直接放在/src/mycamera下面的。这个问题确实很细节
-
@2425004936 所以才要求尽可能的提供更多信息,如果你一开始就把目录结构,每个相关的代码指令都给出来,一眼就可以给出你答案。
这里说的colcon build 日志指的是输入 colcon build 后,终端的打印内容。
最后感谢再次你的提问,希望能够帮助更多小伙伴。