鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    gazebo导入机器人模型urdf文件后闪退

    已定时 已固定 已锁定 已移动 未解决
    综合问题
    gazebo 闪退
    3
    4
    466
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 2
      2640471469
      最后由 2640471469 编辑

      bash输入命令gazebo --verbose -s libgazebo_ros_init.so -s libgazebo_ros_factory.so 启动gazebo后会返回警告
      [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.
      [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
      此时若通过rqt调用服务/spawn_entity在gazebo生成机器人后gazebo就会闪退
      求求各位大佬指点一下为什么会出现这个情况,我该如何解决
      下面是我加载模型的urdf文件内容,里面有一个相机camera模块,如果添加gazebo就会闪退,删除后导入就不会。

      <?xml version="1.0"?>
      <robot name="rosmaster_x3">
      
          <link name="base_footprint"/>
      
          <!-- base_link inertia needs modified -->
          <link name="base_link">
              <visual>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                      <box size="0.238 0.1386 0.159"/>
                  </geometry>
                  <material name="white">
            	        <color rgba="1 1 1 0.9" /> 
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                      <box size="0.238 0.1386 0.159"/>
                  </geometry>
                  <material name="white">
            	        <color rgba="1 1 1 0.9" /> 
                  </material>
              </collision>
              <inertial>
                  <mass value="4.6"/>
                  <inertia ixx="0.0122666" ixy="0" ixz="0" iyy="0.0122666" iyz="0" izz="0.02"/>
              </inertial>
          </link>
          
          <joint name="base_joint" type="fixed">
              <parent link="base_footprint"/>
              <child link="base_link"/>
              <origin xyz="0.0 0.0 0.1145" rpy="0 0 0"/>
          </joint>
      
          <link name="laser_link">
              <visual>
                  <origin xyz="0 0 0" rpy="0 0 0"/>
                  <geometry>
                      <cylinder length="0.025" radius="0.035"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0" rpy="0 0 0"/>
                  <geometry>
                      <cylinder length="0.025" radius="0.035"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </collision>
          </link>
        
          <joint name="laser_joint" type="fixed">
              <parent link="base_link" />
              <child link="laser_link" />
              <origin xyz="0.084 0 0.0795" />
          </joint>
      
          <link name="camera_link">
        	    <visual>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
      		        <box size="0.065 0.165 0.03"/>
                  </geometry>
                  <material name="black">
                      <color rgba="1.0 1.0 1.0 1.0"/>
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
      		        <box size="0.04 0.165 0.03"/>
                  </geometry>
                  <material name="black">
                      <color rgba="1.0 1.0 1.0 1.0"/>
                  </material>
              </collision>
          </link>
      
          <joint name="camera_joint" type="fixed">
              <parent link="base_link" />
              <child link="camera_link" />
              <origin xyz="0.119 0 0.03" />
          </joint>
      
          <link name="imu_link">
              <visual>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                      <box size="0.01 0.01 0.01"/>
                  </geometry>
                  <material name="blue">
                      <color rgba="0.5 0.5 1 0.8" /> 
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0.0" rpy="0 0 0"/>
                  <geometry>
                      <box size="0.01 0.01 0.01"/>
                  </geometry>
                  <material name="blue">
            	        <color rgba="0.5 0.5 1 0.8" /> 
                  </material>
              </collision>
          </link>
      
          <joint name="imu_joint" type="fixed">
              <parent link="base_link"/>
              <child link="imu_link"/>
              <origin xyz="0.0 0.0 0.0" rpy="0 0 0"/>
          </joint>
      
      <!-- wheels inertia needs modified -->
          <link name="front_left_wheel_link">
              <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                      <geometry>
                          <cylinder length="0.0304" radius="0.0325"/>
                      </geometry>
                      <material name="black">
                          <color rgba="0.0 0.0 0.0 0.5" /> 
                      </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                     <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </collision>
              <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
              </inertial>
          </link>
          
          <joint name="front_left_wheel_joint" type="continuous">
              <parent link="base_link" />
              <child link="front_left_wheel_link" />
              <origin xyz="-0.08 0.0289 -0.0795" />
              <axis xyz="0 1 0" />
          </joint>
      
          <link name="front_right_wheel_link">
              <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                      <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                      <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </collision>
              <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
              </inertial>
          </link>
          
          <joint name="front_right_wheel_joint" type="continuous">
              <parent link="base_link" />
              <child link="front_right_wheel_link" />
              <origin xyz="0.08 0.0289 -0.0795" />
              <axis xyz="0 1 0" />
          </joint>
              
          <link name="rear_left_wheel_link">
              <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                      <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                      <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </collision>
              <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
              </inertial>
          </link>
              
          <joint name="rear_left_wheel_joint" type="continuous">
              <parent link="base_link" />
              <child link="rear_left_wheel_link" />
              <origin xyz="-0.08 -0.0289 -0.0795" />
              <axis xyz="0 1 0" />
          </joint>
      
          <link name="rear_right_wheel_link">
              <visual>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                      <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </visual>
              <collision>
                  <origin xyz="0 0 0" rpy="1.57079 0 0"/>
                  <geometry>
                      <cylinder length="0.0304" radius="0.0325"/>
                  </geometry>
                  <material name="black">
                      <color rgba="0.0 0.0 0.0 0.5" /> 
                  </material>
              </collision>
              <inertial>
                  <mass value="0.2"/>
                  <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/>
              </inertial>
          </link>
              
          <joint name="rear_right_wheel_joint" type="continuous">
              <parent link="base_link" />
              <child link="rear_right_wheel_link" />
              <origin xyz="0.08 -0.0289 -0.0795" />
              <axis xyz="0 1 0" />
          </joint>
      
                  <gazebo>
              <plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'>
                  <ros>
                      <namespace>/</namespace>
                      <remapping>cmd_vel:=cmd_vel</remapping>
                      <remapping>odom:=odom</remapping>
                  </ros>
                  <update_rate>5</update_rate>
                  <!-- wheels -->
                  <left_joint>front_left_wheel_joint</left_joint>
                  <right_joint>front_right_wheel_joint</right_joint>
                  <!-- kinematics -->
                  <wheel_separation>0.2</wheel_separation>
                  <wheel_diameter>0.065</wheel_diameter>
                  <!-- limits -->
                  <max_wheel_torque>20</max_wheel_torque>
                  <max_wheel_acceleration>1.0</max_wheel_acceleration>
                  <!-- output -->
                  <publish_odom>true</publish_odom>
                  <publish_odom_tf>true</publish_odom_tf>
                  <publish_wheel_tf>false</publish_wheel_tf>
                  <odometry_frame>odom</odometry_frame>
                  <robot_base_frame>base_footprint</robot_base_frame>
              </plugin>
      
              <plugin name="joint_state" filename="libgazebo_ros_joint_state_publisher.so">
                  <ros>
                  <remapping>~/out:=joint_states</remapping>
                  </ros>
                  <update_rate>5</update_rate>
                  <joint_name>front_left_wheel_joint</joint_name>
                  <joint_name>front_right_wheel_joint</joint_name>
                  <joint_name>rear_left_wheel_joint</joint_name>
                  <joint_name>rear_right_wheel_joint</joint_name>
              </plugin>    
          </gazebo> 
      
              <gazebo reference="laser_link">
                  <material>Gazebo/Black</material>
              </gazebo>
              
              <gazebo reference="imu_link">
              <sensor name="imu_sensor" type="imu">
              <plugin filename="libgazebo_ros_imu_sensor.so" name="imu_plugin">
                  <ros>
                      <namespace>/</namespace>
                      <remapping>~/out:=imu</remapping>
                  </ros>
                  <initial_orientation_as_reference>false</initial_orientation_as_reference>
                  </plugin>
                  <always_on>true</always_on>
                  <update_rate>5</update_rate>
                  <visualize>true</visualize>
                  <imu>
                  <angular_velocity>
                      <x>
                      <noise type="gaussian">
                          <mean>0.0</mean>
                          <stddev>2e-4</stddev>
                          <bias_mean>0.0000075</bias_mean>
                          <bias_stddev>0.0000008</bias_stddev>
                      </noise>
                      </x>
                      <y>
                      <noise type="gaussian">
                          <mean>0.0</mean>
                          <stddev>2e-4</stddev>
                          <bias_mean>0.0000075</bias_mean>
                          <bias_stddev>0.0000008</bias_stddev>
                      </noise>
                      </y>
                      <z>
                      <noise type="gaussian">
                          <mean>0.0</mean>
                          <stddev>2e-4</stddev>
                          <bias_mean>0.0000075</bias_mean>
                          <bias_stddev>0.0000008</bias_stddev>
                      </noise>
                      </z>
                  </angular_velocity>
                  <linear_acceleration>
                      <x>
                      <noise type="gaussian">
                          <mean>0.0</mean>
                          <stddev>1.7e-2</stddev>
                          <bias_mean>0.1</bias_mean>
                          <bias_stddev>0.001</bias_stddev>
                      </noise>
                      </x>
                      <y>
                      <noise type="gaussian">
                          <mean>0.0</mean>
                          <stddev>1.7e-2</stddev>
                          <bias_mean>0.1</bias_mean>
                          <bias_stddev>0.001</bias_stddev>
                      </noise>
                      </y>
                      <z>
                      <noise type="gaussian">
                          <mean>0.0</mean>
                          <stddev>1.7e-2</stddev>
                          <bias_mean>0.1</bias_mean>
                          <bias_stddev>0.001</bias_stddev>
                      </noise>
                      </z>
                  </linear_acceleration>
                  </imu>
              </sensor>
              </gazebo>
      
          <gazebo reference="laser_link">
              <sensor name="laser_sensor" type="ray">
              <always_on>true</always_on>
              <visualize>false</visualize>
              <update_rate>5</update_rate>
              <pose>0 0 0.075 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>3.5</max>
                      <resolution>0.015000</resolution>
                  </range>
                  <noise>
                      <type>gaussian</type>
                      <mean>0.0</mean>
                      <stddev>0.01</stddev>
                  </noise>
              </ray>
      
              <plugin name="laserscan" filename="libgazebo_ros_ray_sensor.so">
                  <ros>
                  <remapping>~/out:=scan</remapping>
                  </ros>
                  <output_type>sensor_msgs/LaserScan</output_type>
                  <frame_name>laser_link</frame_name>
              </plugin>
              </sensor>
          </gazebo>
      
      
          <gazebo reference="camera_link">
              <sensor type="camera" name="camera_sensor">
                  <update_rate>10</update_rate> 
                  <camera name="camera_link">
                      <horizontal_fov>1.3</horizontal_fov> 
                      <image>
                          <width>640</width> 
                          <height>480</height> 
                          <format>R8G8B8</format> 
                      </image>
                      <clip>
                          <near>0.02</near> 
                          <far>300</far> 
                      </clip>
                  </camera>
                  <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
                      <alwaysOn>true</alwaysOn>
                      <updateRate>0.0</updateRate>
                      <cameraName>/my_robot/camera</cameraName>
                      <imageTopicName>image_raw</imageTopicName>
                      <cameraInfoTopicName>camera_info</cameraInfoTopicName>
                      <frameName>camera_link</frameName>
                      <hackBaseline>0.07</hackBaseline>
                      <distortionK1>0.0</distortionK1>
                      <distortionK2>0.0</distortionK2>
                      <distortionK3>0.0</distortionK3>
                      <distortionT1>0.0</distortionT1>
                      <distortionT2>0.0</distortionT2>
                      <CxPrime>0.0</CxPrime>
                      <Cx>320.0</Cx>
                      <Cy>240.0</Cy>
                      <focalLength>0.0</focalLength>
                  </plugin>
              </sensor>
          </gazebo>
      
      </robot>
          
      
      小鱼小 1 条回复 最后回复 回复 引用 0
      • 小伊小
        机器人小伊
        最后由 编辑

        Gazebo闪退问题可能由多种原因引起,特别是当涉及到ROS(Robot Operating System)和Gazebo的集成时。以下是一些可能的解决步骤和建议,帮助你诊断和解决问题:

        1. 检查Gazebo和ROS的版本兼容性:
          确保你安装的Gazebo和ROS版本相互兼容。不同版本的ROS和Gazebo之间可能存在不兼容的问题。你可以查看官方文档或社区论坛来获取兼容性信息。

        2. 查看详细的日志信息:
          使用--verbose选项启动Gazebo已经是一个好的开始,但这可能还不够。你可以尝试在启动Gazebo之前设置环境变量GAZEBO_VERBOSE=true和GAZEBO_RESOURCE_PATH(指向你的模型和资源文件所在的目录),这样可以获得更详细的输出信息。

        3. 检查模型文件:
          如果问题是在加载特定模型时出现的,检查该模型文件(通常是.sdf或.urdf格式)是否有错误。确保所有的路径和依赖项都是正确的,特别是涉及到资源(如纹理、物理属性等)的路径。

        4. 检查内存和CPU使用情况:
          闪退可能是由于资源不足(如内存或CPU过载)引起的。使用工具如top或htop监控Gazebo运行时的资源使用情况。

        5. 尝试简化场景:
          如果可能,尝试简化你的Gazebo场景,只加载最基本的元素(如地面和机器人),看看问题是否仍然存在。这有助于确定问题是否与特定的模型或环境设置有关。

        6. 更新和重新安装:
          确保你的系统和所有相关软件包都是最新的。有时,简单的更新或重新安装Gazebo和ROS可以解决问题。

        7. 查看社区和论坛:
          搜索Gazebo和ROS的社区论坛,看看是否有其他人遇到并解决了类似的问题。

        8. 使用GDB进行调试:
          如果上述步骤都没有帮助,你可以尝试使用GDB(GNU调试器)来调试Gazebo。运行gdb gazebo,然后设置断点并检查在闪退时Gazebo的状态。

        9. 检查ROS服务调用:
          由于你是在调用/spawn_entity服务时遇到问题的,确保该服务被正确配置和响应。检查相关的ROS节点和脚本,确保它们没有错误。

        通过这些步骤,你应该能够更接近问题的根源,并找到解决Gazebo闪退的方法。如果问题仍然存在,可能需要更详细的系统日志或具体的错误消息来进一步分析。


        以上为生成回答,仅供参考~

        我是小伊,已接入ChatGpt,所有回复,仅供参考~

        1 条回复 最后回复 回复 引用 0
        • 小鱼小
          小鱼 技术大佬 @2640471469
          最后由 编辑

          @2640471469 看新教程

          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

          1 条回复 最后回复 回复 引用 0
          • 2
            2640471469
            最后由 2640471469 编辑

            问题目前半解决了。
            按照小鱼新出的深度相机教程更新了urdf文件,但是仍会出现闪退的情况。后重装了gazebo依赖的ORGE和Qt等依赖图形库gazebo不会闪退了,不过在启动gazebo的时候还会有警告
            [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.
            [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once.
            [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
            这条警告在我打开gazebo后没有导入世界和无人机都会立即发出,关机重启后再打开gazebo也会发出。因此我猜想这个问题可能是由于硬件导致的。
            我不知道我的猜想是否正确,也不知道后续怎么完全解决这个问题,还请各位大佬们指点一下。

            1 条回复 最后回复 回复 引用 0
            • 第一个帖子
              最后一个帖子
            皖ICP备16016415号-7
            Powered by NodeBB | 鱼香ROS