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

    从ros1平台迁移到ros2平台,然后将机器人模型导入gazebo时失败,gazebo无响应

    已定时 已固定 已锁定 已移动
    ROS2机器人开发:从入门到实践
    加载gazebo显示异常 launch
    2
    5
    338
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • L
      leolanqin
      最后由 编辑

      launch文件gazebo_world.launch.py

      import os
      from launch import LaunchDescription
      from launch.launch_description_sources import PythonLaunchDescriptionSource
      from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
      from launch_ros.actions import Node
      from launch.substitutions import Command , LaunchConfiguration
      from launch_ros.parameter_descriptions import ParameterValue
      from ament_index_python.packages import get_package_share_directory
      
      def generate_launch_description():
      
          urdf_package_path = get_package_share_directory('robot_description')
          default_urdf_path=os.path.join(urdf_package_path,'urdf','robot_description.urdf')
      
          action_declare_arg_model_robot = DeclareLaunchArgument('model', default_value = default_urdf_path, description = 'Model of the robot')
          substitutions_command_result = Command(['xacro ',LaunchConfiguration('model')])
          robot_description_value = ParameterValue(substitutions_command_result, value_type=str)
      
          action_declare_x_pos = DeclareLaunchArgument('x_pos', default_value='0.0', description='X position')
          action_declare_y_pos = DeclareLaunchArgument('y_pos', default_value='0.0', description='Y position')
          action_declare_z_pos = DeclareLaunchArgument('z_pos', default_value='0.0', description='Z position')
         
          action_launch_gazebo = IncludeLaunchDescription(
                      PythonLaunchDescriptionSource(
                          os.path.join(
                              get_package_share_directory('gazebo_ros'),
                              'launch',
                              'gazebo.launch.py'
                          )
                      ),
                      launch_arguments={
                          'world': os.path.join(get_package_share_directory('robot_description'), 'world', 'room.world'),
                          'paused': 'false',
                          'use_sim_time': 'true',
                          'gui': 'true',
                          'headless': 'false',
                          'debug': 'true'
                      }.items()
                  )
          
          action_robot_state_publisher = Node(
                  package='robot_state_publisher',
                  executable='robot_state_publisher',
                  output='screen',
                  parameters=[{
                      'robot_description': robot_description_value
                  }]
              )
      
          action_spawn_entity = Node(
              package='gazebo_ros',
              executable='spawn_entity.py',
              arguments=[
                  '-topic','/robot_description',
                  '-entity','Fu_robot'
              ]
          ) 
          
          return LaunchDescription([
              action_declare_x_pos,
              action_declare_y_pos,
              action_declare_z_pos,
              action_declare_arg_model_robot,
              action_robot_state_publisher,
              action_launch_gazebo,
              action_spawn_entity
          ])
      
      

      终端输入:

      ros2 launch robot_description gazebo_world.launch.py model:=/home/leolanqin/catkin_ws_ros2/src/robot_description/urdf/robot_description.urdf.xacro 
      

      终端显示:

      [INFO] [launch]: All log files can be found below /home/leolanqin/.ros/log/2024-12-24-19-48-39-601713-leolanqin-virtual-machine-137116
      [INFO] [launch]: Default logging verbosity is set to INFO
      [INFO] [robot_state_publisher-1]: process started with pid [137128]
      [INFO] [gzserver-2]: process started with pid [137130]
      [INFO] [gzclient-3]: process started with pid [137132]
      [INFO] [spawn_entity.py-4]: process started with pid [137134]
      [robot_state_publisher-1] [INFO] [1735040920.589923166] [robot_state_publisher]: got segment /ball_wheel_link
      [robot_state_publisher-1] [INFO] [1735040920.591342777] [robot_state_publisher]: got segment /base_camera_link
      [robot_state_publisher-1] [INFO] [1735040920.591364087] [robot_state_publisher]: got segment /base_footprint
      [robot_state_publisher-1] [INFO] [1735040920.591374176] [robot_state_publisher]: got segment /base_laser_link
      [robot_state_publisher-1] [INFO] [1735040920.591382682] [robot_state_publisher]: got segment /base_link
      [robot_state_publisher-1] [INFO] [1735040920.591391448] [robot_state_publisher]: got segment /imu
      [robot_state_publisher-1] [INFO] [1735040920.591401007] [robot_state_publisher]: got segment /left_wheel_link
      [robot_state_publisher-1] [INFO] [1735040920.591411176] [robot_state_publisher]: got segment /right_wheel_link
      [spawn_entity.py-4] [INFO] [1735040921.331660406] [spawn_entity]: Spawn Entity started
      [spawn_entity.py-4] [INFO] [1735040921.333053717] [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] [1735040921.338627613] [spawn_entity]: Waiting for entity xml on /robot_description
      [spawn_entity.py-4] [INFO] [1735040921.355291473] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
      [spawn_entity.py-4] [INFO] [1735040921.355721465] [spawn_entity]: Waiting for service /spawn_entity
      [gzserver-2] Error: Non-unique names detected in <link name='link'>
      [gzserver-2]   <collision name='surface'>
      [gzserver-2]     <pose>0 0 1 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <box>
      [gzserver-2]         <size>1.5 0.8 0.03</size>
      [gzserver-2]       </box>
      [gzserver-2]     </geometry>
      [gzserver-2]     <surface>
      [gzserver-2]       <friction>
      [gzserver-2]         <ode>
      [gzserver-2]           <mu>0.6</mu>
      [gzserver-2]           <mu2>0.6</mu2>
      [gzserver-2]         </ode>
      [gzserver-2]         <torsional>
      [gzserver-2]           <ode/>
      [gzserver-2]         </torsional>
      [gzserver-2]       </friction>
      [gzserver-2]       <contact>
      [gzserver-2]         <ode/>
      [gzserver-2]       </contact>
      [gzserver-2]       <bounce/>
      [gzserver-2]     </surface>
      [gzserver-2]     <max_contacts>10</max_contacts>
      [gzserver-2]   </collision>
      [gzserver-2]   <visual name='visual1'>
      [gzserver-2]     <pose>0 0 1 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <box>
      [gzserver-2]         <size>1.5 0.8 0.03</size>
      [gzserver-2]       </box>
      [gzserver-2]     </geometry>
      [gzserver-2]     <material>
      [gzserver-2]       <script>
      [gzserver-2]         <uri>file://media/materials/scripts/gazebo.material</uri>
      [gzserver-2]         <name>Gazebo/Wood</name>
      [gzserver-2]       </script>
      [gzserver-2]     </material>
      [gzserver-2]   </visual>
      [gzserver-2]   <collision name='front_left_leg'>
      [gzserver-2]     <pose>0.68 0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <max_contacts>10</max_contacts>
      [gzserver-2]     <surface>
      [gzserver-2]       <contact>
      [gzserver-2]         <ode/>
      [gzserver-2]       </contact>
      [gzserver-2]       <bounce/>
      [gzserver-2]       <friction>
      [gzserver-2]         <torsional>
      [gzserver-2]           <ode/>
      [gzserver-2]         </torsional>
      [gzserver-2]         <ode/>
      [gzserver-2]       </friction>
      [gzserver-2]     </surface>
      [gzserver-2]   </collision>
      [gzserver-2]   <visual name='front_left_leg'>
      [gzserver-2]     <pose>0.68 0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <material>
      [gzserver-2]       <script>
      [gzserver-2]         <uri>file://media/materials/scripts/gazebo.material</uri>
      [gzserver-2]         <name>Gazebo/Grey</name>
      [gzserver-2]       </script>
      [gzserver-2]     </material>
      [gzserver-2]   </visual>
      [gzserver-2]   <collision name='front_right_leg'>
      [gzserver-2]     <pose>0.68 -0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <max_contacts>10</max_contacts>
      [gzserver-2]     <surface>
      [gzserver-2]       <contact>
      [gzserver-2]         <ode/>
      [gzserver-2]       </contact>
      [gzserver-2]       <bounce/>
      [gzserver-2]       <friction>
      [gzserver-2]         <torsional>
      [gzserver-2]           <ode/>
      [gzserver-2]         </torsional>
      [gzserver-2]         <ode/>
      [gzserver-2]       </friction>
      [gzserver-2]     </surface>
      [gzserver-2]   </collision>
      [gzserver-2]   <visual name='front_right_leg'>
      [gzserver-2]     <pose>0.68 -0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <material>
      [gzserver-2]       <script>
      [gzserver-2]         <uri>file://media/materials/scripts/gazebo.material</uri>
      [gzserver-2]         <name>Gazebo/Grey</name>
      [gzserver-2]       </script>
      [gzserver-2]     </material>
      [gzserver-2]   </visual>
      [gzserver-2]   <collision name='back_right_leg'>
      [gzserver-2]     <pose>-0.68 -0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <max_contacts>10</max_contacts>
      [gzserver-2]     <surface>
      [gzserver-2]       <contact>
      [gzserver-2]         <ode/>
      [gzserver-2]       </contact>
      [gzserver-2]       <bounce/>
      [gzserver-2]       <friction>
      [gzserver-2]         <torsional>
      [gzserver-2]           <ode/>
      [gzserver-2]         </torsional>
      [gzserver-2]         <ode/>
      [gzserver-2]       </friction>
      [gzserver-2]     </surface>
      [gzserver-2]   </collision>
      [gzserver-2]   <visual name='back_right_leg'>
      [gzserver-2]     <pose>-0.68 -0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <material>
      [gzserver-2]       <script>
      [gzserver-2]         <uri>file://media/materials/scripts/gazebo.material</uri>
      [gzserver-2]         <name>Gazebo/Grey</name>
      [gzserver-2]       </script>
      [gzserver-2]     </material>
      [gzserver-2]   </visual>
      [gzserver-2]   <collision name='back_left_leg'>
      [gzserver-2]     <pose>-0.68 0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <max_contacts>10</max_contacts>
      [gzserver-2]     <surface>
      [gzserver-2]       <contact>
      [gzserver-2]         <ode/>
      [gzserver-2]       </contact>
      [gzserver-2]       <bounce/>
      [gzserver-2]       <friction>
      [gzserver-2]         <torsional>
      [gzserver-2]           <ode/>
      [gzserver-2]         </torsional>
      [gzserver-2]         <ode/>
      [gzserver-2]       </friction>
      [gzserver-2]     </surface>
      [gzserver-2]   </collision>
      [gzserver-2]   <visual name='back_left_leg'>
      [gzserver-2]     <pose>-0.68 0.38 0.5 0 -0 0</pose>
      [gzserver-2]     <geometry>
      [gzserver-2]       <cylinder>
      [gzserver-2]         <radius>0.02</radius>
      [gzserver-2]         <length>1</length>
      [gzserver-2]       </cylinder>
      [gzserver-2]     </geometry>
      [gzserver-2]     <material>
      [gzserver-2]       <script>
      [gzserver-2]         <uri>file://media/materials/scripts/gazebo.material</uri>
      [gzserver-2]         <name>Gazebo/Grey</name>
      [gzserver-2]       </script>
      [gzserver-2]     </material>
      [gzserver-2]   </visual>
      [gzserver-2]   <self_collide>0</self_collide>
      [gzserver-2]   <enable_wind>0</enable_wind>
      [gzserver-2]   <kinematic>0</kinematic>
      [gzserver-2] </link>
      [gzserver-2] 
      [spawn_entity.py-4] [INFO] [1735040922.136157557] [spawn_entity]: Calling service /spawn_entity
      [gzserver-2] Topic [default/Fu_robot//base_footprint/csi_Camera/image] is not valid.
      [gzserver-2] [INFO] [1735040922.819461672] [camera_controller]: Publishing camera info to [/csi_Camera/camera_info]
      [spawn_entity.py-4] [INFO] [1735040923.350189398] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [Fu_robot]
      [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 137134]
      
      小鱼小 2 条回复 最后回复 回复 引用 0
      • 小鱼小
        小鱼 技术大佬 @leolanqin
        最后由 编辑

        @2745914991 在 从ros1平台迁移到ros2平台,然后将机器人模型导入gazebo时失败,gazebo无响应 中说:

        Error: Non-unique names detected in <link name='link'>

        出现了重复名字的link,建议仔细检查下urdf

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

        L 1 条回复 最后回复 回复 引用 0
        • L
          leolanqin @小鱼
          最后由 编辑

          @小鱼 感谢鱼哥回复,我已经仔细检查了我的urdf文件,并没有出现重复名字的link
          这是我的urdf文件robot_description.urdf

          <robot
            name="robot_description">
          
            <link name="base_footprint"/>
          
            <joint name="base_joint" type="fixed">
              <parent link="base_footprint"/>
              <child link="base_link"/>
              <origin xyz="0.0 0.0 0.012" rpy="0 0 0"/>
            </joint>
          
            <link
              name="base_link">
              <inertial>
                <origin
                  xyz="-0.021363490239433 0.000185677952833835 0.0417013760059846"
                  rpy="0 0 0" />
                <mass
                  value="0.4442754144754" />
                <inertia
                  ixx="0.00169347433894092"
                  ixy="-2.48653191534453E-07"
                  ixz="3.6777445179091E-05"
                  iyy="0.00104562302644335"
                  iyz="-4.01932028426777E-06"
                  izz="0.00148226749250531" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/base_link.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="1 1 1 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/base_link.STL" />
                </geometry>
              </collision>
            </link>
            <link
              name="imu">
              <inertial>
                <origin
                  xyz="3.46944695195361E-18 0 -0.00353385896202057"
                  rpy="0 0 0" />
                <mass
                  value="0.000834" />
                <inertia
                  ixx="1.72751258992806E-08"
                  ixy="2.49134059713724E-24"
                  ixz="-2.52435489670724E-26"
                  iyy="1.01251258992806E-08"
                  iyz="1.8466691376894E-25"
                  izz="2.3801E-08" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/imu.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="1 1 1 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/imu.STL" />
                </geometry>
              </collision>
            </link>
            <joint
              name="imu_joint"
              type="fixed">
              <origin
                xyz="-0.056956 -0.0059543 0.072756"
                rpy="0 5.2369E-16 0" />
              <parent
                link="base_link" />
              <child
                link="imu" />
              <axis
                xyz="0 0 0" />
            </joint>
            <link
              name="base_camera_link">
              <inertial>
                <origin
                  xyz="-0.0045346942299942 1.38777878078145E-17 -0.00179125965737512"
                  rpy="0 0 0" />
                <mass
                  value="0.00100487943921971" />
                <inertia
                  ixx="7.55677391275611E-08"
                  ixy="-2.39038796583022E-24"
                  ixz="-1.37755038601046E-09"
                  iyy="3.94938932151791E-08"
                  iyz="2.43323642233816E-23"
                  izz="4.01523294449251E-08" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/base_camera_link.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="1 1 1 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/base_camera_link.STL" />
                </geometry>
              </collision>
            </link>
            <joint
              name="camera_joint"
              type="fixed">
              <origin
                xyz="0.0277 0 0.0623"
                rpy="-2.2337E-16 5.2369E-16 0" />
              <parent
                link="base_link" />
              <child
                link="base_camera_link" />
              <axis
                xyz="0 0 0" />
            </joint>
            <link
              name="base_laser_link">
              <inertial>
                <origin
                  xyz="-0.00911214120076251 0.000185677952834168 -0.0842986239940154"
                  rpy="0 0 0" />
                <mass
                  value="0.4442754144754" />
                <inertia
                  ixx="0.00169347433894092"
                  ixy="-2.4865319153732E-07"
                  ixz="3.67774451790908E-05"
                  iyy="0.00104562302644335"
                  iyz="-4.01932028426874E-06"
                  izz="0.00148226749250531" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/base_laser_link.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="1 1 1 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/base_laser_link.STL" />
                </geometry>
              </collision>
            </link>
            <joint
              name="laser_joint"
              type="fixed">
              <origin
                xyz="-0.012251 0 0.126"
                rpy="-1.6843E-15 -1.0776E-15 4.3793E-15" />
              <parent
                link="base_link" />
              <child
                link="base_laser_link" />
              <axis
                xyz="0 0 0" />
            </joint>
            <link
              name="left_wheel_link">
              <inertial>
                <origin
                  xyz="-6.93889390390723E-18 3.46944695195361E-18 0.017494370940819"
                  rpy="0 0 0" />
                <mass
                  value="0.0561341413751443" />
                <inertia
                  ixx="2.45284373382495E-05"
                  ixy="1.79487710154599E-21"
                  ixz="7.36303183829231E-18"
                  iyy="2.45284373382495E-05"
                  iyz="1.73397416098309E-17"
                  izz="4.23355136524843E-05" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/left_wheel_link.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="0.109803921568627 0.109803921568627 0.109803921568627 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/left_wheel_link.STL" />
                </geometry>
              </collision>
            </link>
            <joint
              name="left_wheel_joint"
              type="continuous">
              <origin
                xyz="0 0.0658 0.02275"
                rpy="-1.5708 5.2369E-16 8.6736E-17" />
              <parent
                link="base_link" />
              <child
                link="left_wheel_link" />
              <axis
                xyz="0 0 1" />
              <limit
                effort="100"
                velocity="100" />
            </joint>
            <link
              name="right_wheel_link">
              <inertial>
                <origin
                  xyz="3.46944695195361E-18 -1.73472347597681E-18 -0.017494370940819"
                  rpy="0 0 0" />
                <mass
                  value="0.0561341413751443" />
                <inertia
                  ixx="2.45284373382495E-05"
                  ixy="-1.10855737450343E-21"
                  ixz="-7.37237567686968E-18"
                  iyy="2.45284373382495E-05"
                  iyz="1.734064769358E-17"
                  izz="4.23355136524843E-05" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/right_wheel_link.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="0.109803921568627 0.109803921568627 0.109803921568627 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/right_wheel_link.STL" />
                </geometry>
              </collision>
            </link>
            <joint
              name="right_wheel_joint"
              type="continuous">
              <origin
                xyz="0 -0.0658 0.02275"
                rpy="1.5708 -5.2369E-16 3.1416" />
              <parent
                link="base_link" />
              <child
                link="right_wheel_link" />
              <axis
                xyz="0 0 1" />
              <limit
                effort="100"
                velocity="100" />
            </joint>
            <link
              name="ball_wheel_link">
              <inertial>
                <origin
                  xyz="-0.00805 0 0"
                  rpy="0 0 0" />
                <mass
                  value="0.00218512482182764" />
                <inertia
                  ixx="5.66406205065944E-08"
                  ixy="0"
                  ixz="0"
                  iyy="5.66406205065944E-08"
                  iyz="0"
                  izz="5.66406205065944E-08" />
              </inertial>
              <visual>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/ball_wheel_link.STL" />
                </geometry>
                <material
                  name="">
                  <color
                    rgba="1 1 1 1" />
                </material>
              </visual>
              <collision>
                <origin
                  xyz="0 0 0"
                  rpy="0 0 0" />
                <geometry>
                  <mesh
                    filename="package://robot_description/meshes/ball_wheel_link.STL" />
                </geometry>
              </collision>
            </link>
            <joint
              name="ball_wheel_joint"
              type="fixed">
              <origin
                xyz="-0.06445 0 -0.0028"
                rpy="0 5.2369E-16 0" />
              <parent
                link="base_link" />
              <child
                link="ball_wheel_link" />
              <axis
                xyz="0 0 0" />
            </joint>
          </robot>
          

          此外我输入指令

          check_urdf /home/leolanqin/catkin_ws_ros2/src/robot_description/urdf/robot_description.urdf
          

          终端显示

          robot name is: robot_description
          ---------- Successfully Parsed XML ---------------
          root Link: base_footprint has 1 child(ren)
              child(1):  base_link
                  child(1):  ball_wheel_link
                  child(2):  base_camera_link
                  child(3):  imu
                  child(4):  base_laser_link
                  child(5):  left_wheel_link
                  child(6):  right_wheel_link
          

          也没有问题,实在不知道问题出在哪里

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

            @leolanqin 在 从ros1平台迁移到ros2平台,然后将机器人模型导入gazebo时失败,gazebo无响应 中说:

            [gzserver-2] Error: Non-unique names detected in <link name='link'>
            [gzserver-2] <collision name='surface'>
            [gzserver-2] <pose>0 0 1 0 -0 0</pose>
            [gzserver-2] <geometry>
            [gzserver-2] <box>
            [gzserver-2] <size>1.5 0.8 0.03</size>
            [gzserver-2] </box>
            [gzserver-2] </geometry>
            [gzserver-2] <surface>
            [gzserver-2] <friction>
            [gzserver-2] <ode>

            world 里面有没有呢,试着加载一个空的环境

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

            L 1 条回复 最后回复 回复 引用 0
            • L
              leolanqin @小鱼
              最后由 编辑

              @小鱼 感谢鱼哥,目前问题已经解决,但又有新的问题,gazebo显示不了画面,黑屏,然后强制退出,这是终端显示的信息

              [INFO] [launch]: All log files can be found below /home/leolanqin/.ros/log/2024-12-26-15-44-58-483062-leolanqin-virtual-machine-223612
              [INFO] [launch]: Default logging verbosity is set to INFO
              [INFO] [gzserver-1]: process started with pid [223654]
              [INFO] [gzclient-2]: process started with pid [223656]
              [INFO] [robot_state_publisher-3]: process started with pid [223658]
              [INFO] [spawn_entity.py-4]: process started with pid [223660]
              [robot_state_publisher-3] [INFO] [1735199099.598223513] [robot_state_publisher]: got segment ball_wheel_link
              [robot_state_publisher-3] [INFO] [1735199099.601007247] [robot_state_publisher]: got segment base_camera_link
              [robot_state_publisher-3] [INFO] [1735199099.601024540] [robot_state_publisher]: got segment base_footprint
              [robot_state_publisher-3] [INFO] [1735199099.601035621] [robot_state_publisher]: got segment base_laser_link
              [robot_state_publisher-3] [INFO] [1735199099.601044859] [robot_state_publisher]: got segment base_link
              [robot_state_publisher-3] [INFO] [1735199099.601054096] [robot_state_publisher]: got segment imu
              [robot_state_publisher-3] [INFO] [1735199099.601062893] [robot_state_publisher]: got segment left_wheel_link
              [robot_state_publisher-3] [INFO] [1735199099.601071599] [robot_state_publisher]: got segment right_wheel_link
              [gzserver-1] Gazebo multi-robot simulator, version 11.10.2
              [gzserver-1] Copyright (C) 2012 Open Source Robotics Foundation.
              [gzserver-1] Released under the Apache 2 License.
              [gzserver-1] http://gazebosim.org
              [gzserver-1] 
              [gzclient-2] Gazebo multi-robot simulator, version 11.10.2
              [gzclient-2] Copyright (C) 2012 Open Source Robotics Foundation.
              [gzclient-2] Released under the Apache 2 License.
              [gzclient-2] http://gazebosim.org
              [gzclient-2] 
              [spawn_entity.py-4] [INFO] [1735199100.414174211] [spawn_entity]: Spawn Entity started
              [spawn_entity.py-4] [INFO] [1735199100.414795862] [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] [1735199100.421157459] [spawn_entity]: Waiting for entity xml on /robot_description
              [gzclient-2] [Msg] Waiting for master.
              [gzclient-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
              [gzclient-2] [Msg] Publicized address: 192.168.112.128
              [gzclient-2] [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in ""
              [gzclient-2] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
              [gzclient-2] context mismatch in svga_surface_destroy
              [gzclient-2] context mismatch in svga_surface_destroy
              [spawn_entity.py-4] [INFO] [1735199103.238434255] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
              [spawn_entity.py-4] [INFO] [1735199103.239025176] [spawn_entity]: Waiting for service /spawn_entity
              [spawn_entity.py-4] [INFO] [1735199103.253505089] [spawn_entity]: Calling service /spawn_entity
              [gzserver-1] [Msg] Waiting for master.
              [gzserver-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
              [gzserver-1] [Msg] Publicized address: 192.168.112.128
              [gzserver-1] [Msg] Loading world file [/home/leolanqin/catkin_ws_ros2/install/robot_description/share/robot_description/world/empty.world]
              [gzserver-1] [Wrn] [ModelDatabase.cc:340] Getting models from[http://models.gazebosim.org/]. This may take a few seconds.
              [spawn_entity.py-4] [INFO] [1735199103.404412044] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [Fu_robot]
              [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 223660]
              [ERROR] [gzclient-2]: process has died [pid 223656, exit code -9, cmd 'gzclient --verbose'].
              [gzclient-2] 
              ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
              [robot_state_publisher-3] [INFO] [1735199163.933715409] [rclcpp]: signal_handler(signum=2)
              [INFO] [robot_state_publisher-3]: process has finished cleanly [pid 223658]
              [ERROR] [gzserver-1]: process[gzserver-1] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
              [INFO] [gzserver-1]: sending signal 'SIGTERM' to process[gzserver-1]
              [gzserver-1] [INFO] [1735199168.941641236] [rclcpp]: signal_handler(signum=15)
              [ERROR] [gzserver-1]: process[gzserver-1] failed to terminate '10.0' seconds after receiving 'SIGTERM', escalating to 'SIGKILL'
              [INFO] [gzserver-1]: sending signal 'SIGKILL' to process[gzserver-1]
              [ERROR] [gzserver-1]: process has died [pid 223654, exit code -9, cmd 'gzserver /home/leolanqin/catkin_ws_ros2/install/robot_description/share/robot_description/world/empty.world --verbose -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
              [gzserver-1] 
              leolanqin@leolanqin-virtual-machine:~/catkin_ws_ros2$ colcon build
              Starting >>> robot_description
              Starting >>> robot_navigation
              Finished <<< robot_navigation [0.15s]                                                             
              Finished <<< robot_description [0.21s]                  
              
              Summary: 2 packages finished [0.66s]
              leolanqin@leolanqin-virtual-machine:~/catkin_ws_ros2$ ros2 launch robot_description gazebo_world.launch.py 
              [INFO] [launch]: All log files can be found below /home/leolanqin/.ros/log/2024-12-26-15-49-41-798423-leolanqin-virtual-machine-224566
              [INFO] [launch]: Default logging verbosity is set to INFO
              [INFO] [gzserver-1]: process started with pid [224578]
              [INFO] [gzclient-2]: process started with pid [224580]
              [INFO] [robot_state_publisher-3]: process started with pid [224582]
              [INFO] [spawn_entity.py-4]: process started with pid [224584]
              [robot_state_publisher-3] [INFO] [1735199382.861567495] [robot_state_publisher]: got segment ball_wheel_link
              [robot_state_publisher-3] [INFO] [1735199382.864334578] [robot_state_publisher]: got segment base_camera_link
              [robot_state_publisher-3] [INFO] [1735199382.864369314] [robot_state_publisher]: got segment base_footprint
              [robot_state_publisher-3] [INFO] [1735199382.864380766] [robot_state_publisher]: got segment base_laser_link
              [robot_state_publisher-3] [INFO] [1735199382.864390304] [robot_state_publisher]: got segment base_link
              [robot_state_publisher-3] [INFO] [1735199382.864398930] [robot_state_publisher]: got segment imu
              [robot_state_publisher-3] [INFO] [1735199382.864407637] [robot_state_publisher]: got segment left_wheel_link
              [robot_state_publisher-3] [INFO] [1735199382.864416413] [robot_state_publisher]: got segment right_wheel_link
              [gzserver-1] Gazebo multi-robot simulator, version 11.10.2
              [gzserver-1] Copyright (C) 2012 Open Source Robotics Foundation.
              [gzserver-1] Released under the Apache 2 License.
              [gzserver-1] http://gazebosim.org
              [gzserver-1] 
              [gzclient-2] Gazebo multi-robot simulator, version 11.10.2
              [gzclient-2] Copyright (C) 2012 Open Source Robotics Foundation.
              [gzclient-2] Released under the Apache 2 License.
              [gzclient-2] http://gazebosim.org
              [gzclient-2] 
              [spawn_entity.py-4] [INFO] [1735199383.674311030] [spawn_entity]: Spawn Entity started
              [spawn_entity.py-4] [INFO] [1735199383.674829424] [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] [1735199384.016267056] [spawn_entity]: Waiting for entity xml on /robot_description
              [spawn_entity.py-4] [INFO] [1735199384.027940196] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
              [spawn_entity.py-4] [INFO] [1735199384.028571054] [spawn_entity]: Waiting for service /spawn_entity
              [spawn_entity.py-4] [INFO] [1735199384.544525994] [spawn_entity]: Calling service /spawn_entity
              [gzserver-1] [Msg] Waiting for master.
              [gzserver-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
              [gzserver-1] [Msg] Publicized address: 192.168.112.128
              [gzserver-1] [Msg] Loading world file [/home/leolanqin/catkin_ws_ros2/install/robot_description/share/robot_description/world/empty.world]
              [gzserver-1] [Wrn] [ModelDatabase.cc:340] Getting models from[http://models.gazebosim.org/]. This may take a few seconds.
              [spawn_entity.py-4] [INFO] [1735199384.730048498] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [Fu_robot]
              [gzclient-2] [Msg] Waiting for master.
              [gzclient-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
              [gzclient-2] [Msg] Publicized address: 192.168.112.128
              [gzclient-2] [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in ""
              [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 224584]
              [gzclient-2] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
              

              由于我是在虚拟机上运行的Ubuntu,我想可能和这个原因有关系,希望鱼哥给点建议

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