6.4.5添加激光雷达失败
-
鱼哥帮我看看这是什么原因呀,在gazebo添加激光雷达插件后运行gazebo会概率性报错崩溃,激光雷达不生效,以下是完整日志:
chen@chen-virtual-machine:~/Program/test_car/test_car_ws$ ros2 launch car_description gazebo_sim.launch.py [INFO] [launch]: All log files can be found below /home/chen/.ros/log/2025-03-03-16-07-16-874166-chen-virtual-machine-7374 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [7376] [INFO] [gzserver-2]: process started with pid [7378] [INFO] [gzclient-3]: process started with pid [7380] [INFO] [spawn_entity.py-4]: process started with pid [7382] [INFO] [joint_state_publisher-5]: process started with pid [7384] [robot_state_publisher-1] [INFO] [1740989237.394305769] [robot_state_publisher]: got segment base_footprint_link [robot_state_publisher-1] [INFO] [1740989237.394658450] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1740989237.394672166] [robot_state_publisher]: got segment base_up_link [robot_state_publisher-1] [INFO] [1740989237.394681183] [robot_state_publisher]: got segment camera_link [robot_state_publisher-1] [INFO] [1740989237.394688216] [robot_state_publisher]: got segment camera_optical_link [robot_state_publisher-1] [INFO] [1740989237.394694828] [robot_state_publisher]: got segment holderfirst_link [robot_state_publisher-1] [INFO] [1740989237.394701200] [robot_state_publisher]: got segment holderfourth_link [robot_state_publisher-1] [INFO] [1740989237.394708244] [robot_state_publisher]: got segment holdersecond_link [robot_state_publisher-1] [INFO] [1740989237.394715647] [robot_state_publisher]: got segment holderthird_link [robot_state_publisher-1] [INFO] [1740989237.394722711] [robot_state_publisher]: got segment imu_link [robot_state_publisher-1] [INFO] [1740989237.394729944] [robot_state_publisher]: got segment laser_link [robot_state_publisher-1] [INFO] [1740989237.394736637] [robot_state_publisher]: got segment left_passivewheel_link [robot_state_publisher-1] [INFO] [1740989237.394743760] [robot_state_publisher]: got segment left_wheel_link [robot_state_publisher-1] [INFO] [1740989237.394751414] [robot_state_publisher]: got segment right_passivewheel_link [robot_state_publisher-1] [INFO] [1740989237.394759199] [robot_state_publisher]: got segment right_wheel_link [robot_state_publisher-1] [INFO] [1740989237.394766322] [robot_state_publisher]: got segment trackleft_link [robot_state_publisher-1] [INFO] [1740989237.394773235] [robot_state_publisher]: got segment trackright_link [joint_state_publisher-5] [INFO] [1740989237.619566241] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic... [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] [1740989237.756249140] [spawn_entity]: Spawn Entity started [spawn_entity.py-4] [INFO] [1740989237.757216273] [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] [1740989237.760391988] [spawn_entity]: Waiting for entity xml on /robot_description [spawn_entity.py-4] [INFO] [1740989237.776414899] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1740989237.777898892] [spawn_entity]: Waiting for service /spawn_entity [spawn_entity.py-4] [INFO] [1740989238.950572748] [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: 192.168.142.134 [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/chen/Program/test_car/test_car_ws/install/car_description/share/ament_index" [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/chen/Program/test_car/test_car_ws/install/car_description/share/car_description" [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/chen/Program/test_car/test_car_ws/install/car_description/share/colcon-core" [gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [gzserver-2] [INFO] [1740989239.759986464] [depth_camera]: Publishing camera info to [/camera_sensor/camera_info] [gzserver-2] [INFO] [1740989239.761402219] [depth_camera]: Publishing depth camera info to [/camera_sensor/depth/camera_info] [gzserver-2] [INFO] [1740989239.762138249] [depth_camera]: Publishing pointcloud to [/camera_sensor/points] [spawn_entity.py-4] [INFO] [1740989239.960007971] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [track_car] [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 7382] [ERROR] [gzserver-2]: process has died [pid 7378, exit code -11, cmd 'gzserver /home/chen/Program/test_car/test_car_ws/install/car_description/share/car_description/world/custom_room.world --verbose -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
应该和Missing model.config没有关系,如果不添加激光雷达插件gazebo就不会崩溃,但是有时候又有激光雷达插件又能够成功运行,激光插件也生效,不会有这一条报错[ERROR] [gzserver-2]: process has died [pid 7378, exit code -11, cmd 'gzserver /home/chen/Program/test_car/test_car_ws/install/car_description/share/car_description/world/custom_room.world --verbose -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
以下是添加及激光雷达传感器的详细代码
<gazebo reference="laser_link"> --> <sensor name="laserscan" type="ray"> --> <plugin name="laserscan" filename="libgazebo_ros_ray_sensor.so"> <ros> <namespace>laser</namespace> <remapping>~/out:=scan</remapping> </ros> <topic_name>scan</topic_name> <output_type>sensor_msgs/LaserScan</output_type> <frame_name>laser_link</frame_name> </plugin> <always_on>true</always_on> <visualize>true</visualize> <update_rate>30</update_rate> <pose>0 0 0 0 0 0</pose> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1.000000</resolution> <min_angle>0.000000</min_angle> <max_angle>6.280000</max_angle> </horizontal> </scan> <range> <min>0.120000</min> <max>8.0</max> <resolution>0.1000</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> </sensor> </gazebo>
-
从你提供的日志和配置信息来看,有几个可能的原因导致添加激光雷达插件后Gazebo崩溃:
-
插件版本不兼容:
- 你使用的Gazebo版本是11.10.2,而ROS 2 Humble通常与Gazebo 11的更新版本或者Gazebo 12更兼容。请确认
libgazebo_ros_ray_sensor.so
插件是否是为你的Gazebo版本编译的。如果插件是为不同版本的Gazebo编译的,它可能会导致崩溃。
- 你使用的Gazebo版本是11.10.2,而ROS 2 Humble通常与Gazebo 11的更新版本或者Gazebo 12更兼容。请确认
-
内存或资源限制:
- 激光雷达传感器配置为高分辨率(360个样本),这在某些系统上可能会消耗大量资源。尝试减少样本数量或降低更新频率,看看是否能稳定运行。
-
错误的XML配置:
- 你的XML配置看起来是格式正确的,但有时候细微的错误或者缺失的标签也可能导致问题。确保所有的标签都正确闭合,并且没有多余的字符或格式错误。
-
其他插件或软件冲突:
- 检查是否有其他插件或软件包与激光雷达插件冲突。例如,其他传感器插件或物理引擎插件可能与激光雷达插件不兼容。
-
日志中的警告和错误:
- 日志中提到的关于
model.config
的错误通常与模型文件无关,但它们可能是由于环境设置不当或路径问题导致的。确保所有相关的路径和环境变量都设置正确。 Deleting a connection right after creation
警告可能指示某个组件在初始化后立即被销毁,这可能是由插件或Gazebo内部的bug引起的。
- 日志中提到的关于
-
调试步骤:
- 增加日志级别:尝试在启动Gazebo时增加日志级别,以获取更详细的错误信息。可以通过在启动命令中添加
--verbose
标志来实现。 - 使用GDB调试:如果可能,使用GDB或其他调试工具来运行
gzserver
,以便在崩溃时获取堆栈跟踪。这可以帮助确定是哪一行代码导致了崩溃。 - 简化配置:尝试移除或简化其他非必要的传感器或组件,以确定是否其他组件干扰了激光雷达插件。
- 增加日志级别:尝试在启动Gazebo时增加日志级别,以获取更详细的错误信息。可以通过在启动命令中添加
-
更新或回退软件:
- 考虑更新Gazebo到一个与ROS 2 Humble更兼容的版本,或者如果当前版本是最新的,尝试回退到之前的稳定版本。
通过这些步骤,你应该能够更接近确定导致问题的根本原因,并找到解决方案。如果问题依旧存在,可能需要更深入地查看具体的插件代码或寻求来自Gazebo或ROS社区的帮助。
以上为生成回答,仅供参考~
-
-
@小伊 gazebo11.10.2库里有libgazebo_ros_ray_sensor.so这个动态链接库,我尝试过把采样频率降低,但是还是经常崩溃
-
针对您提到的Gazebo 11.10.2中
libgazebo_ros_ray_sensor.so
动态链接库导致的崩溃问题,尽管降低采样频率可能有助于减轻系统负载,但显然这并不是一个根本的解决方案。以下是一些建议,希望能帮助您解决这个问题:-
检查依赖关系:
- 确保所有必要的依赖库都已正确安装,并且与Gazebo 11.10.2版本兼容。
- 使用包管理器(如apt-get)检查并安装任何缺失的依赖项。
-
更新和修补:
- 检查是否有可用的Gazebo更新或补丁,这些更新可能修复了与
libgazebo_ros_ray_sensor.so
相关的已知问题。 - 访问Gazebo的官方GitHub仓库或相关论坛,了解是否有其他用户报告了类似问题以及可能的解决方案。
- 检查是否有可用的Gazebo更新或补丁,这些更新可能修复了与
-
资源限制:
- 监控Gazebo运行时的CPU和内存使用情况,确保系统资源不是导致崩溃的原因。
- 如果资源使用接近极限,考虑增加硬件资源或优化仿真设置。
-
日志和调试:
- 查看Gazebo的日志文件,了解崩溃前后的系统状态和错误信息。
- 使用调试工具(如gdb)对Gazebo进行调试,以获取更详细的崩溃信息。
-
配置和环境:
- 检查Gazebo的配置文件,确保所有设置都是正确的,特别是与传感器和仿真环境相关的设置。
- 确保Gazebo运行在一个稳定且配置正确的ROS环境中。
-
社区和论坛:
- 访问ROS和Gazebo的社区论坛,寻求其他用户的帮助和建议。
- 分享您的崩溃日志和配置文件,以便其他用户能更好地理解问题并提供帮助。
-
考虑替代方案:
- 如果问题持续存在,考虑使用其他版本的Gazebo或不同的传感器插件。
- 评估其他仿真平台或工具是否更适合您的需求。
请注意,由于Gazebo是一个复杂的仿真环境,崩溃问题可能由多种因素引起。因此,解决这类问题可能需要一些时间和耐心。在尝试上述建议时,请确保您有足够的系统备份和恢复计划,以防万一出现不可预见的问题。
以上为生成回答,仅供参考~
-
-
尝试了几次后,现在直接gazebo直接卡在启动界面了,日志也和之前有一些不一样
chen@chen-virtual-machine:~/Program/test_car/test_car_ws$ colcon build Starting >>> car_description Finished <<< car_description [0.14s] Summary: 1 package finished [0.41s] chen@chen-virtual-machine:~/Program/test_car/test_car_ws$ sourec install/setup.bash sourec:未找到命令 chen@chen-virtual-machine:~/Program/test_car/test_car_ws$ source install/setup.bash chen@chen-virtual-machine:~/Program/test_car/test_car_ws$ ros2 launch car_description gazebo_sim.launch.py [INFO] [launch]: All log files can be found below /home/chen/.ros/log/2025-03-03-17-59-07-717052-chen-virtual-machine-3873 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [3875] [INFO] [gzserver-2]: process started with pid [3877] [INFO] [gzclient-3]: process started with pid [3879] [INFO] [spawn_entity.py-4]: process started with pid [3881] [INFO] [joint_state_publisher-5]: process started with pid [3883] [robot_state_publisher-1] [INFO] [1740995948.251949005] [robot_state_publisher]: got segment base_footprint_link [robot_state_publisher-1] [INFO] [1740995948.252182270] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1740995948.252193030] [robot_state_publisher]: got segment base_up_link [robot_state_publisher-1] [INFO] [1740995948.252199152] [robot_state_publisher]: got segment camera_link [robot_state_publisher-1] [INFO] [1740995948.252204201] [robot_state_publisher]: got segment camera_optical_link [robot_state_publisher-1] [INFO] [1740995948.252208950] [robot_state_publisher]: got segment holderfirst_link [robot_state_publisher-1] [INFO] [1740995948.252213339] [robot_state_publisher]: got segment holderfourth_link [robot_state_publisher-1] [INFO] [1740995948.252217807] [robot_state_publisher]: got segment holdersecond_link [robot_state_publisher-1] [INFO] [1740995948.252222276] [robot_state_publisher]: got segment holderthird_link [robot_state_publisher-1] [INFO] [1740995948.252226634] [robot_state_publisher]: got segment imu_link [robot_state_publisher-1] [INFO] [1740995948.252231133] [robot_state_publisher]: got segment laser_link [robot_state_publisher-1] [INFO] [1740995948.252235581] [robot_state_publisher]: got segment left_passivewheel_link [robot_state_publisher-1] [INFO] [1740995948.252240491] [robot_state_publisher]: got segment left_wheel_link [robot_state_publisher-1] [INFO] [1740995948.252245310] [robot_state_publisher]: got segment right_passivewheel_link [robot_state_publisher-1] [INFO] [1740995948.252249748] [robot_state_publisher]: got segment right_wheel_link [robot_state_publisher-1] [INFO] [1740995948.252254016] [robot_state_publisher]: got segment trackleft_link [robot_state_publisher-1] [INFO] [1740995948.252258305] [robot_state_publisher]: got segment trackright_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] [joint_state_publisher-5] [INFO] [1740995948.506909023] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic... [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] [1740995948.620220423] [spawn_entity]: Spawn Entity started [spawn_entity.py-4] [INFO] [1740995948.622548963] [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] [1740995948.627491577] [spawn_entity]: Waiting for entity xml on /robot_description [spawn_entity.py-4] [INFO] [1740995948.644838611] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1740995948.645381787] [spawn_entity]: Waiting for service /spawn_entity [spawn_entity.py-4] [INFO] [1740995949.403105183] [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: 192.168.142.134 [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/chen/Program/test_car/test_car_ws/install/car_description/share/ament_index" [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/chen/Program/test_car/test_car_ws/install/car_description/share/car_description" [gzclient-3] [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/chen/Program/test_car/test_car_ws/install/car_description/share/colcon-core" [gzserver-2] [INFO] [1740995950.186192323] [depth_camera]: Publishing camera info to [/camera_sensor/camera_info] [gzserver-2] [INFO] [1740995950.187911694] [depth_camera]: Publishing depth camera info to [/camera_sensor/depth/camera_info] [gzserver-2] [INFO] [1740995950.189006163] [depth_camera]: Publishing pointcloud to [/camera_sensor/points] [gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [spawn_entity.py-4] [INFO] [1740995950.305917939] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [track_car] [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 3881] [gzclient-3] [Err] [Connection.cc:547] Connection[17] Closed during Read [gzclient-3] [Err] [TransportIface.cc:385] Unable to read from master [ERROR] [gzserver-2]: process has died [pid 3877, exit code -11, cmd 'gzserver /home/chen/Program/test_car/test_car_ws/install/car_description/share/car_description/world/custom_room.world --verbose -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so']. [gzclient-3] [Err] [GLWidget.cc:900] Unable to connect to a running Gazebo master. [gzclient-3] [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once. ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) [robot_state_publisher-1] [INFO] [1740996081.753914506] [rclcpp]: signal_handler(signum=2) [gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [INFO] [robot_state_publisher-1]: process has finished cleanly [pid 3875] [INFO] [joint_state_publisher-5]: process has finished cleanly [pid 3883] [INFO] [gzclient-3]: process has finished cleanly [pid 3879] [gzclient-3] [gzclient-3]
但是一移除激光雷达插件又能正常启动