
简介最近在b站观看古月居视频学习ros2但是在学习到Gazebo使用以及Rviz时屡屡出现启动问题导致学习无法继续现已找到解决办法。方法介绍1.前提根据视频内指令安装好gazebo。链接如下18.Gazebo三维物理仿真平台_哔哩哔哩_bilibili打开终端输入如下指令sudo aptinstallros-humble-gazebo-*2.启动gazeboros2 launch gazebo_ros gazebo.launch.py如果gazebo打开那么一切顺利。但是主播一直会报如下错误qiukoqiuko-virtual-machine:~$ ros2 launch gazebo_ros gazebo.launch.py[INFO] [launch]: All log files can be found below /home/qiuko/.ros/log/2025-09-03-10-11-38-464731-qiuko-virtual-machine-16717[INFO] [launch]: Default logging verbosity is set to INFO[INFO] [gzserver-1]: process started with pid [16718][INFO] [gzclient-2]: process started with pid [16720] [gzclient-2] gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:728: typename boost::detail::sp_member_accessT::type boost::shared_ptrT::operator-() const [with T gazebo::rendering::Camera; typename boost::detail::sp_member_accessT::type gazebo::rendering::Camera*]: Assertion px ! 0 failed.[ERROR] [gzclient-2]: process has died [pid 16720, exit code -6, cmd gzclient --gui-client-pluginlibgazebo_ros_eol_gui.so].gzclient 进程启动后崩溃了并且报告了一个断言失败的错误。3.解决办法终端中输入如下指令打开.bashrc文件nano ~/.bashrc进入到如下图界面点击键盘⬇️按键或移动滚轮到最末行添加如下指令source /usr/share/gazebo/setup.sh按ctrlx保存按y确定按enter退出。最后运行如下指令重新加载.bashrc文件使修改生效source ~/.bashrc再次运行ros2 launch gazebo_ros gazebo.launch.py就可以顺利进入gazebo界面了。