ROS2 启动节点后使用 ros2 topic list 命令看不到所有 topic 的解决方法
ROS2 启动节点后使用 ros2 topic list 命令看不到所有 topic 的解决方法
在 Ubuntu 系统上使用 ROS2 启动 Continental ARS408 激光雷达节点后, 你可能会遇到使用 ros2 topic list 命令看不到所有预期的 topic 的情况。例如, 你运行了以下命令:
ubuntu@THNCHL-1:~/lslidar_ws$ ros2 launch /home/ubuntu/lslidar_ws/install/pe_ars408_ros/share/pe_ars408_ros/launch/continental_ars408_socket_can.launch.xml
你看到了节点启动的信息:
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2023-04-11-12-54-19-640725-THNCHL-1-10402
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [socket_can_receiver_node_exe-1]: process started with pid [10414]
[INFO] [pe_ars408_node-2]: process started with pid [10416]
[socket_can_receiver_node_exe-1] [INFO] [1681188859.838754918] [socket_can_receiver]: interface: can0
[socket_can_receiver_node_exe-1] [INFO] [1681188859.838954767] [socket_can_receiver]: interval(s): 0.010000
[socket_can_receiver_node_exe-1] [INFO] [1681188859.838970124] [socket_can_receiver]: use bus time: 0
但是当你运行 ros2 topic list 时,你只看到了部分 topic:
ros2 topic list
/clicked_point
/from_can_bus
/goal_pose
/initialpose
/objects
/parameter_events
/rosout
/scan
/socket_can_receiver/transition_event
/tf
/tf_static
原因:
这是因为 ros2 topic list 列出的是当前存在的所有 topic,而 ros2 launch 命令启动的节点可能需要一些时间才能初始化并发布/订阅 topic。
解决方法:
建议等待一段时间后再次运行 ros2 topic list。 你可以尝试等待几秒钟,然后再次运行该命令。如果仍然看不到所有预期的 topic,请检查你的启动文件和节点代码,确保它们正确配置了 topic 的发布和订阅。
原文地址: https://www.cveoy.top/t/topic/jze5 著作权归作者所有。请勿转载和采集!