@唔希迪希 我已解决!
solution:
查看自己的gazebo是哪个版本的
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ ls /usr/share | grep gazebo
gazebo
gazebo-11
然后修改环境变量
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH:/usr/share/gazebo-11
查看一下有没有修改成功
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ printenv | grep GAZEBO_RESOURCE_PATH
GAZEBO_RESOURCE_PATH=:/usr/share/gazebo-11
再运行
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ ros2 launch fishbot_description gazebo_sim.launch.py
成功在gazebo中打开模型并且无报错!
完整过程:
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ ls /usr/share | grep gazebo
gazebo
gazebo-11
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ printenv | grep GAZEBO_RESOURCE_PATH
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH:/usr/share/gazebo-11
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ printenv | grep GAZEBO_RESOURCE_PATH
GAZEBO_RESOURCE_PATH=:/usr/share/gazebo-11
daisy@daisy-VirtualBox:~/chapt6/chapt6_ws$ ros2 launch fishbot_description gazebo_sim.launch.py
[INFO] [launch]: All log files can be found below /home/daisy/.ros/log/2024-11-13-17-05-21-173897-daisy-VirtualBox-5684
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [5686]
[INFO] [gzserver-2]: process started with pid [5688]
[INFO] [gzclient-3]: process started with pid [5690]
[robot_state_publisher-1] [INFO] [1731488721.944877604] [robot_state_publisher]: got segment back_caster_link
[robot_state_publisher-1] [INFO] [1731488721.947460442] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1731488721.947480484] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1731488721.947484598] [robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1731488721.947488090] [robot_state_publisher]: got segment front_caster_link
[robot_state_publisher-1] [INFO] [1731488721.947491439] [robot_state_publisher]: got segment imu_link
[robot_state_publisher-1] [INFO] [1731488721.947494741] [robot_state_publisher]: got segment laser_cylinder_link
[robot_state_publisher-1] [INFO] [1731488721.947498114] [robot_state_publisher]: got segment laser_link
[robot_state_publisher-1] [INFO] [1731488721.947501197] [robot_state_publisher]: got segment left_wheel_link
[robot_state_publisher-1] [INFO] [1731488721.947504493] [robot_state_publisher]: got segment right_wheel_link
[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]
[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] [Msg] Waiting for master.
[gzserver-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gzserver-2] [Msg] Publicized address: 172.20.10.12
[gzserver-2] [Msg] Loading world file [/home/daisy/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world]
[gzserver-2] [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/physics/contacts, deleting message. This warning is printed only once.
[gzclient-3] [Msg] Waiting for master.
[gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gzclient-3] [Msg] Publicized address: 172.20.10.12
[gzclient-3] [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in ""
[gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
[gzclient-3] context mismatch in svga_surface_destroy
[gzclient-3] context mismatch in svga_surface_destroy
[gzclient-3] [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.