紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
ROS2机器人开发书籍中6.4.4不发布话题的问题
-
-
是启动这个launch文件吗
an@911:~/ros2bookcode/chapt6$ ros2 launch fishbot_description gazebo_sim.launch.py [INFO] [launch]: All log files can be found below /home/an/.ros/log/2024-09-13-16-06-39-026307-911-4420 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [4422] [INFO] [gzserver-2]: process started with pid [4424] [INFO] [gzclient-3]: process started with pid [4426] [INFO] [spawn_entity.py-4]: process started with pid [4428] [robot_state_publisher-1] [INFO] [1726214799.434220248] [robot_state_publisher]: got segment back_caster_link [robot_state_publisher-1] [INFO] [1726214799.434303381] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-1] [INFO] [1726214799.434308766] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1726214799.434311465] [robot_state_publisher]: got segment camera_link [robot_state_publisher-1] [INFO] [1726214799.434314019] [robot_state_publisher]: got segment camera_optical_link [robot_state_publisher-1] [INFO] [1726214799.434316513] [robot_state_publisher]: got segment front_caster_link [robot_state_publisher-1] [INFO] [1726214799.434318834] [robot_state_publisher]: got segment imu_link [robot_state_publisher-1] [INFO] [1726214799.434321177] [robot_state_publisher]: got segment laser_cylinder_link [robot_state_publisher-1] [INFO] [1726214799.434323514] [robot_state_publisher]: got segment laser_link [robot_state_publisher-1] [INFO] [1726214799.434325751] [robot_state_publisher]: got segment left_wheel_link [robot_state_publisher-1] [INFO] [1726214799.434328088] [robot_state_publisher]: got segment right_wheel_link [gzclient-3] Gazebo multi-robot simulator, version 11.10.2 [gzclient-3] Copyright (C) 2012 Open Source Robotics Foundation. [gzclient-3] Released under the Apache 2 License. [gzclient-3] http://gazebosim.org [gzclient-3] [gzserver-2] Gazebo multi-robot simulator, version 11.10.2 [gzserver-2] Copyright (C) 2012 Open Source Robotics Foundation. [gzserver-2] Released under the Apache 2 License. [gzserver-2] http://gazebosim.org [gzserver-2] [spawn_entity.py-4] [INFO] [1726214799.722044380] [spawn_entity]: Spawn Entity started [spawn_entity.py-4] [INFO] [1726214799.722312098] [spawn_entity]: Loading entity published on topic /robot_description [spawn_entity.py-4] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead. [spawn_entity.py-4] warnings.warn( [spawn_entity.py-4] [INFO] [1726214799.723847055] [spawn_entity]: Waiting for entity xml on /robot_description [spawn_entity.py-4] [INFO] [1726214799.735158585] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1726214799.735467999] [spawn_entity]: Waiting for service /spawn_entity [spawn_entity.py-4] [INFO] [1726214800.492925943] [spawn_entity]: Calling service /spawn_entity [gzclient-3] [Msg] Waiting for master. [gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [gzclient-3] [Msg] Publicized address: 10.139.109.189 [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/an/.gazebo/models/.git" [gzserver-2] [Msg] Waiting for master. [gzserver-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [gzserver-2] [Msg] Publicized address: 10.139.109.189 [gzserver-2] [Msg] Loading world file [/home/an/ros2bookcode/chapt6/install/fishbot_description/share/fishbot_description/world/custom_room.world] [gzserver-2] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [gzserver-2] [INFO] [1726214801.132406165] [depth_camera]: Publishing camera info to [/camera_sensor/camera_info] [gzserver-2] [INFO] [1726214801.132921282] [depth_camera]: Publishing depth camera info to [/camera_sensor/depth/camera_info] [gzserver-2] [INFO] [1726214801.133263243] [depth_camera]: Publishing pointcloud to [/camera_sensor/points] [spawn_entity.py-4] [INFO] [1726214801.196537173] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [fishbot] [gzserver-2] [Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros2_control.so: libgazebo_ros2_control.so: cannot open shared object file: No such file or directory [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 4428] [INFO] [ros2-5]: process started with pid [4632] [ros2-5] usage: ros2 [-h] [--use-python-default-buffering] [ros2-5] Call `ros2 <command> -h` for more detailed usage. ... [ros2-5] ros2: error: argument Call `ros2 <command> -h` for more detailed usage.: invalid choice: 'control' (choose from 'action', 'bag', 'component', 'daemon', 'doctor', 'extension_points', 'extensions', 'interface', 'launch', 'lifecycle', 'multicast', 'node', 'param', 'pkg', 'run', 'security', 'service', 'topic', 'wtf') [ERROR] [ros2-5]: process has died [pid 4632, exit code 2, cmd 'ros2 control load_controller --set-state active fishbot_joint_state_broadcaster']. [INFO] [ros2-6]: process started with pid [4634] [ros2-6] usage: ros2 [-h] [--use-python-default-buffering] [ros2-6] Call `ros2 <command> -h` for more detailed usage. ... [ros2-6] ros2: error: argument Call `ros2 <command> -h` for more detailed usage.: invalid choice: 'control' (choose from 'action', 'bag', 'component', 'daemon', 'doctor', 'extension_points', 'extensions', 'interface', 'launch', 'lifecycle', 'multicast', 'node', 'param', 'pkg', 'run', 'security', 'service', 'topic', 'wtf') [ERROR] [ros2-6]: process has died [pid 4634, exit code 2, cmd 'ros2 control load_controller --set-state active fishbot_diff_drive_controller']. [gzserver-2] [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once.
现在是这样的
an@911:~$ ros2 topic list /camera_sensor/camera_info /camera_sensor/depth/camera_info /camera_sensor/depth/image_raw /camera_sensor/image_raw /camera_sensor/points /clicked_point /clock /goal_pose /imu /initialpose /joint_states /parameter_events /performance_metrics /robot_description /rosout /scan /tf /tf_static
-
@1286588184 你是跳着看的书吗,前面的装依赖之类的是不是没看和操作
-
我又试了一下,把这里的注释取消掉就正常出现cmd和odem话题了
<!-- Gazebo 插件 --> <xacro:include filename="$(find fishbot_description)/urdf/fishbot/plugins/gazebo_control_plugin.xacro" /> <!-- <xacro:gazebo_control_plugin /> -->
an@911:~$ ros2 topic list /camera_sensor/camera_info /camera_sensor/depth/camera_info /camera_sensor/depth/image_raw /camera_sensor/image_raw /camera_sensor/points /clock /cmd_vel /imu /joint_states /odom /parameter_events /performance_metrics /robot_description /rosout /scan /tf /tf_static
不太明白这里为什么被注释了
这个代码我是直接下载的,一开始就是带注释的 -
@1286588184 在 ROS2机器人开发书籍中6.4.4不发布话题的问题 中说:
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_ros2_control.so: libgazebo_ros2_control.so: cannot open shared object file: No such file or directory
这里的报错很明显了,没有安装依赖
-
@1286588184 建议跟着书操作,了解下代码为什么这么写和注释
-
@小鱼 我发现了这个,但书里没找到关于这个依赖的安装信息,只在6.4.2中提到安装gazebo依赖
n@911:~$ sudo apt install ros-humble-gazebo-ros-pkgs 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 ros-humble-gazebo-ros-pkgs 已经是最新版 (3.7.0-1jammy.20240820.174040)。 下列软件包是自动安装的并且现在不需要了: libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python-pkg-resources python-setuptools python2 python2-minimal python2.7 python2.7-minimal 使用'sudo apt autoremove'来卸载它(它们)。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 103 个软件包未被升级。
我安装了这个,上面报错显示的那个包我在文件夹里找到了,但就是不起作用,有什么办法吗,或者说书里具体哪里有讲这个
我是从第六章开始学的,之前一直跟着视频课的动手学ros2,正好学到机器人gazebo仿真出问题了,然后就从这本书的第六章开始学的
-
@1286588184 不是这个,书中应该还提到了ros2_control依赖
-
@1286588184 代码对应的是这章结束的代码,不是刚好6.4的,你运行的代码出现了第六章最后面才出现的内容
-
@小鱼 好的 感谢小鱼老师 我找到了 这章的代码我打算重新去理解编写 一步一步按书上来