小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
Ubuntu22.02 启用gazebo失败 Was Gazebo started with GazeboRosFactory?
-
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-11-20-23-24-23-788430-user-Dell-G15-5510-38654
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [launch.user]: Setting logging gazebo verbosity to error
[INFO] [robot_state_publisher-1]: process started with pid [38668]
[INFO] [gzserver-2]: process started with pid [38670]
[INFO] [gzclient-3]: process started with pid [38672]
[INFO] [spawn_entity.py-4]: process started with pid [38674]
[robot_state_publisher-1] [INFO] [1732116264.465605083] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1732116264.465738227] [robot_state_publisher]: got segment left_foot
[robot_state_publisher-1] [INFO] [1732116264.465745475] [robot_state_publisher]: got segment left_hip_base
[robot_state_publisher-1] [INFO] [1732116264.465765370] [robot_state_publisher]: got segment left_shank
[robot_state_publisher-1] [INFO] [1732116264.465768695] [robot_state_publisher]: got segment left_thigh
[robot_state_publisher-1] [INFO] [1732116264.465771839] [robot_state_publisher]: got segment right_foot
[robot_state_publisher-1] [INFO] [1732116264.465775017] [robot_state_publisher]: got segment right_hip_base
[robot_state_publisher-1] [INFO] [1732116264.465778220] [robot_state_publisher]: got segment right_shank
[robot_state_publisher-1] [INFO] [1732116264.465781369] [robot_state_publisher]: got segment right_thigh
[robot_state_publisher-1] [INFO] [1732116264.465784476] [robot_state_publisher]: got segment world
[spawn_entity.py-4] [INFO] [1732116264.774096644] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1732116264.774348788] [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] [1732116264.775528902] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1732116264.788524210] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1732116264.789360778] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [ERROR] [1732116294.843599865] [spawn_entity]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
[spawn_entity.py-4] [ERROR] [1732116294.844905741] [spawn_entity]: Spawn service failed. Exiting.
[ERROR] [spawn_entity.py-4]: process has died [pid 38674, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -topic robot_description -entity my_bot --ros-args'].从git上clone的[外骨骼](https://github.com/MaxLewter16/LLEAP)源代码,运行rviz没问题,运行gazebo出现如上报错,gazebo版本正确,求助:face_with_thermometer:
-
从你提供的日志来看,问题出在尝试使用
spawn_entity.py
脚本来在 Gazebo 中生成机器人实体时,服务/spawn_entity
不可用。这通常意味着 Gazebo 没有正确配置为使用 ROS 插件,特别是GazeboRosFactory
。这里有几个步骤可以帮助你解决这个问题:-
确认 Gazebo 是否正确安装并配置为使用 ROS:
- 确保你已经安装了 Gazebo 的 ROS 包,比如
gazebo_ros_pkgs
。 - 如果你使用的是 ROS 2 Humble,确保你安装的是与 Humble 兼容的 Gazebo 版本。
- 确保你已经安装了 Gazebo 的 ROS 包,比如
-
检查 Gazebo 启动脚本:
- 当你启动 Gazebo 时,确保你使用了 ROS 2 的启动文件或命令行参数,这样 Gazebo 才能加载 ROS 插件。
- 例如,你应该使用类似
ros2 launch gazebo_ros gazebo_ros_empty_world.launch.py
的命令来启动 Gazebo。
-
检查环境变量:
- 确保你的
ROS_DOMAIN_ID
和其他相关的 ROS 环境变量正确设置,并且在启动 Gazebo 之前已经source
了你的 ROS 2 安装目录中的setup.bash
(或相应的 shell 脚本)。
- 确保你的
-
检查 Gazebo 配置文件:
- 查看你的 Gazebo 配置文件(如
gazebo_ros_empty_world.launch.py
),确保它包含了加载 ROS 插件所需的参数。 - 特别是检查
<plugin name="gazebo_ros_init" filename="libgazebo_ros_init.so">
这样的插件是否已经被正确加载。
- 查看你的 Gazebo 配置文件(如
-
重新启动 Gazebo:
- 在做了上述更改后,完全关闭 Gazebo 和所有相关的 ROS 节点,然后重新按照上述步骤启动。
-
查看 Gazebo 的输出:
- 在启动 Gazebo 时,观察其控制台输出,看是否有任何错误或警告信息,这些信息可能会提供更多关于问题的线索。
-
检查 ROS 2 日志:
- 使用
ros2 node list
和ros2 topic list
查看当前活动的节点和主题,确保/spawn_entity
服务应该存在的节点是活动的。 - 使用
ros2 service list
查看可用的服务,确认/spawn_entity
服务是否存在。
- 使用
如果上述步骤都不能解决问题,可能需要更深入地检查你的 ROS 2 和 Gazebo 安装,或者考虑重新安装这些软件包。希望这些信息能帮助你解决问题!
以上为生成回答,仅供参考~
-