Gazebo仿真gazebo转ROS2消息基本配置Ubuntu 22.04ROS2 humbleGazebo Harmonic 版本 8.14.0实现转换基于ROS软件ros_gz_bridgesudoaptinstallros-humble-ros-gz-bridgePython实现fromlaunchimportLaunchDescriptionfromlaunch_ros.actionsimportNodedefgenerate_launch_description():gz_bridgeNode(packageros_gz_bridge,executableparameter_bridge,namesimple_lidar_bridge,arguments[gz的点云消息sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked],outputscreen,)gz_imu_bridgeNode(packageros_gz_bridge,executableparameter_bridge,namesimple_imu_bridge,arguments[gz的IMU消息sensor_msgs/msg/Imu[gz.msgs.IMU],outputscreen,)gz_clock_bridgeNode(packageros_gz_bridge,executableparameter_bridge,namesimple_clock_bridge,arguments[/clockrosgraph_msgs/msg/Clock[gz.msgs.Clock],outputscreen,)returnLaunchDescription([gz_bridge,gz_imu_bridge,gz_clock_bridge])启动gazebo仿真后执行ros2 launch 脚本ROS2消息没有数据ros-humble-ros-gz-bridge 是基于旧的 Ignition 消息库编译的而gz-sim8使用的是新的 Gazebo 消息库。虽然两者都注册了 gz.msgs.* 类型但底层的transport 层在序列化/反序列化时类型描述符不兼容导致 Unknown message type 错误。安装与 gz-sim8 匹配的 harmonic 版本桥接器sudoaptinstallros-humble-ros-gzharmonic-bridge