<?xml version="1.0" encoding="utf-8"?>
<!-- 转换自 URDF 的 XACRO 文件，保留原模型参数并简化重复结构 -->
<robot name="hive_core_bot0" xmlns:xacro="http://www.ros.org/wiki/xacro">

  <xacro:include filename="$(find hive_core_r0)/urdf/generic_link.xacro" />
  <xacro:include filename="$(find hive_core_r0)/urdf/generic_joint.xacro" />

  

  <!-- 1. 基础链接（base_link） -->
  <xacro:generic_link 
    link_name="base_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/base_link.STL"
    mass="0.4247767"
    inertia_ixx="0.1131876" inertia_ixy="0.0000008" inertia_ixz="0.0001546"
    inertia_iyy="0.0858545" inertia_iyz="0.0000006" inertia_izz="0.0325040"
    origin_xyz="-0.0598891820748674 5.31626531352636E-07 0.164869219254393"
    origin_rpy="0 0 0"
    color_rgba="0.666666666666667 0.666666666666667 0.666666666666667 1"
    enable_collision="false"
  />

  <!-- <link name="world">
    <inertial>
      <mass value="0.0"/>
      <inertia ixx="0.0" ixy="0.0" ixz="0.0"
               iyy="0.0" iyz="0.0"
               izz="0.0"/>
    </inertial>
  </link>
  <joint name="base_link_to_world_joint" type="fixed">
    <origin xyz="0 0 0" rpy="0 0 0" /> 
    <parent link="world" /> 
    <child link="base_link" /> 
  </joint> -->


  <!-- 2. 左髋关节及腿部（left_hip/leg/wheel） -->
  <!-- 2.1 左髋链接 -->
  <xacro:generic_link 
    link_name="left_hip_pitch_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_hip_pitch_link.STL"
    mass="0.6475263"
    inertia_ixx="0.0182516" inertia_ixy="0.0000058" inertia_ixz="0.0001729"
    inertia_iyy="0.0181748" inertia_iyz="-0.0006055" inertia_izz="0.0003913"
    origin_xyz="3.93767161736252E-06 0.161490126813208 0.0158567790568734"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 2.2 左髋关节 -->
  <xacro:generic_joint 
    joint_name="left_hip_pitch_joint"
    type="revolute"
    parent="base_link"
    child="left_hip_pitch_link"
    origin_xyz="-0.06 -0.1358 -0.037269"
    origin_rpy="-1.5708 0.523 0.0"
    axis="0 0 -1"
    limit_lower="-1.57"
    limit_upper="1.57"
    effort="2"
    velocity="3"
  />

  <!-- 2.3 左腿链接 -->
  <xacro:generic_link 
    link_name="left_leg_pitch_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_leg_pitch_link.STL"
    mass="0.5126336"
    inertia_ixx="0.0135141" inertia_ixy="0.0000005" inertia_ixz="-0.0000325"
    inertia_iyy="0.0135986" inertia_iyz="0.0001480" inertia_izz="0.0002025"
    origin_xyz="-2.63464180747426E-05 0.197159145100908 0.000498203326348359"
    origin_rpy="0 0 0"
    color_rgba="1 0.372549019607843 0.294117647058824 1"
    enable_collision="false"
  />

  <!-- 2.4 左腿关节 -->
  <xacro:generic_joint 
    joint_name="left_leg_pitch_joint"
    type="revolute"
    parent="left_hip_pitch_link"
    child="left_leg_pitch_link"
    origin_xyz="0 0 -0.0295"
    origin_rpy="0 0 -1.046"
    axis="0 0 1"
    limit_lower="-1.57"
    limit_upper="1.57"
    effort="2"
    velocity="3"
  />

  <!-- 2.5 左车轮2链接 -->
  <xacro:generic_link 
    link_name="left_wheel2_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_wheel2_link.STL"
    mass="0.745"
    inertia_ixx="0.0004716" inertia_ixy="0" inertia_ixz="0"
    inertia_iyy="0.0007945" inertia_iyz="0.0000001" inertia_izz="0.0004716"
    origin_xyz="4.1585564079967E-08 -5.47447156262759E-06 0.0187838263233595"
    origin_rpy="0 0 0"
    color_rgba="0.780392156862745 0.780392156862745 0.780392156862745 1"
    enable_collision="true"
  />

  <!-- 2.6 左车轮2关节 -->
  <xacro:generic_joint 
    joint_name="left_wheel2_joint"
    type="revolute"
    parent="left_leg_pitch_link"
    child="left_wheel2_link"
    origin_xyz="0 0.4805 0.004"
    origin_rpy="-3.1416 0 -0.0024764"
    axis="0 0 1"
    limit_lower="-1000"
    limit_upper="1000"
    effort="2"
    velocity="3"
  />

  <!-- 2.7 左车轮1链接 -->
  <xacro:generic_link 
    link_name="left_wheel1_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_wheel1_link.STL"
    mass="0.745"
    inertia_ixx="0.0004716" inertia_ixy="0" inertia_ixz="0"
    inertia_iyy="0.0007945" inertia_iyz="0.0000001" inertia_izz="0.0004716"
    origin_xyz="1.97042367054093E-06 5.10773910927798E-06 0.0187838263233595"
    origin_rpy="0 0 0"
    color_rgba="0.780392156862745 0.780392156862745 0.780392156862745 1"
    enable_collision="true"
  />

  <!-- 2.8 左车轮1关节 -->
  <xacro:generic_joint 
    joint_name="left_wheel1_joint"
    type="revolute"
    parent="left_hip_pitch_link"
    child="left_wheel1_link"
    origin_xyz="0 0.48 0.01"
    origin_rpy="0 0 0.0095732"
    axis="0 0 1"
    limit_lower="-1000"
    limit_upper="1000"
    effort="2"
    velocity="3"
  />


  <!-- 3. 右髋关节及腿部（right_hip/leg/wheel） -->
  <!-- 3.1 右髋链接 -->
  <xacro:generic_link 
    link_name="right_hip_pitch_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_hip_pitch_link.STL"
    mass="0.6475263"
    inertia_ixx="0.0182531" inertia_ixy="-0.0000017" inertia_ixz="0.0000501"
    inertia_iyy="0.0181748" inertia_iyz="0.0006055" inertia_izz="0.0003897"
    origin_xyz="-3.97209815898069E-06 -0.161490067811833 0.0158567790568734"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 3.2 右髋关节 -->
  <xacro:generic_joint 
    joint_name="right_hip_pitch_joint"
    type="revolute"
    parent="base_link"
    child="right_hip_pitch_link"
    origin_xyz="-0.06 0.1358 -0.037269"
    origin_rpy="1.5708 0.523 0"
    axis="0 0 -1"
    limit_lower="-1.57"
    limit_upper="1.57"
    effort="2"
    velocity="3"
  />

  <!-- 3.3 右腿链接 -->
  <xacro:generic_link 
    link_name="right_leg_pitch_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_leg_pitch_link.STL"
    mass="0.5126336"
    inertia_ixx="0.0135142" inertia_ixy="0.0000001" inertia_ixz="0.0000001"
    inertia_iyy="0.0135986" inertia_iyz="-0.0001480" inertia_izz="0.0002024"
    origin_xyz="3.43008600186093E-05 -0.197159143801203 0.000498203308628542"
    origin_rpy="0 0 0"
    color_rgba="0.647058823529412 0.619607843137255 0.588235294117647 1"
    enable_collision="false"
  />

  <!-- 3.4 右腿关节 -->
  <xacro:generic_joint 
    joint_name="right_leg_pitch_joint"
    type="revolute"
    parent="right_hip_pitch_link"
    child="right_leg_pitch_link"
    origin_xyz="0 0 -0.0295"
    origin_rpy="0 0 1.046"
    axis="0 0 1"
    limit_lower="-1.57"
    limit_upper="1.57"
    effort="2"
    velocity="3"
  />

  <!-- 3.5 右车轮2链接 -->
  <xacro:generic_link 
    link_name="right_wheel2_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_wheel2_link.STL"
    mass="0.745"
    inertia_ixx="0.0004716" inertia_ixy="0" inertia_ixz="0"
    inertia_iyy="0.0007945" inertia_iyz="0.0000001" inertia_izz="0.0004716"
    origin_xyz="-5.49216228909084E-08 5.47435401360152E-06 0.0187838263233596"
    origin_rpy="0 0 0"
    color_rgba="0.780392156862745 0.780392156862745 0.780392156862745 1"
    enable_collision="true"
  />

  <!-- 3.6 右车轮2关节 -->
  <xacro:generic_joint 
    joint_name="right_wheel2_joint"
    type="revolute"
    parent="right_leg_pitch_link"
    child="right_wheel2_link"
    origin_xyz="1.9386E-05 -0.4805 0.004"
    origin_rpy="3.1416 0 0"
    axis="0 0 1"
    limit_lower="-1000"
    limit_upper="1000"
    effort="2"
    velocity="3"
  />

  <!-- 3.7 右车轮1链接 -->
  <xacro:generic_link 
    link_name="right_wheel1_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_wheel1_link.STL"
    mass="0.745"
    inertia_ixx="0.0004716" inertia_ixy="0" inertia_ixz="0"
    inertia_iyy="0.0007945" inertia_iyz="0.0000001" inertia_izz="0.0004716"
    origin_xyz="-1.90651569380871E-06 -5.13193590762073E-06 0.0187838263233596"
    origin_rpy="0 0 0"
    color_rgba="0.780392156862745 0.780392156862745 0.780392156862745 1"
    enable_collision="true"
  />

  <!-- 3.8 右车轮1关节 -->
  <xacro:generic_joint 
    joint_name="right_wheel1_joint"
    type="revolute"
    parent="right_hip_pitch_link"
    child="right_wheel1_link"
    origin_xyz="0 -0.48 0.01"
    origin_rpy="0 0 -0.0029091"
    axis="0 0 1"
    limit_lower="-1000"
    limit_upper="1000"
    effort="2"
    velocity="3"
  />


  <!-- 4. 左手臂（left_shoulder/arm） -->
  <!-- 4.1 左肩链接 -->
  <xacro:generic_link 
    link_name="left_shoulder_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_shoulder_link.STL"
    mass="0.0131461"
    inertia_ixx="0.0000070" inertia_ixy="0" inertia_ixz="0.0000017"
    inertia_iyy="0.0000071" inertia_iyz="0" inertia_izz="0.0000045"
    origin_xyz="-0.0144837915216556 0.000108169744531657 0.0209530786562939"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 4.2 左肩关节 -->
  <xacro:generic_joint 
    joint_name="left_shoulder_joint"
    type="revolute"
    parent="base_link"
    child="left_shoulder_link"
    origin_xyz="-0.06 -0.0878 0.36288"
    origin_rpy="0 0 0"
    axis="0 0 1"
    limit_lower="-1.57"
    limit_upper="1.57"
    effort="2"
    velocity="3"
  />

  <!-- 4.3 左手臂1链接 -->
  <xacro:generic_link 
    link_name="left_arm1_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_arm1_link.STL"
    mass="0.5854363"
    inertia_ixx="0.0008783" inertia_ixy="-0.0000561" inertia_ixz="0.0000086"
    inertia_iyy="0.0002821" inertia_iyz="-0.0000017" inertia_izz="0.0009299"
    origin_xyz="-0.00228631297282665 -0.000694770956028379 0.0248681244469774"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 4.4 左手臂1关节 -->
  <xacro:generic_joint 
    joint_name="left_arm1_joint"
    type="revolute"
    parent="left_shoulder_link"
    child="left_arm1_link"
    origin_xyz="0 0 0.0385"
    origin_rpy="1.5708 0 -0.0074682"
    axis="-1 0 0"
    limit_lower="-1.5"
    limit_upper="1.5"
    effort="2"
    velocity="3"
  />

  <!-- 4.5 左手臂2链接 -->
  <xacro:generic_link 
    link_name="left_arm2_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/left_arm2_link.STL"
    mass="0.7955302"
    inertia_ixx="0.0035648" inertia_ixy="-0.0000258" inertia_ixz="0.0000009"
    inertia_iyy="0.0002355" inertia_iyz="-0.0001213" inertia_izz="0.0036543"
    origin_xyz="-0.0237485342372672 -0.0546317049801525 1.0877545797372E-05"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 4.6 左手臂2关节 -->
  <xacro:generic_joint 
    joint_name="left_arm2_joint"
    type="revolute"
    parent="left_arm1_link"
    child="left_arm2_link"
    origin_xyz="0.020127 0.0040341 0.17817"
    origin_rpy="-1.6062 0.0074682 0"
    axis="-0.99997 0.0074634 0.0002647"
    limit_lower="-1.5"
    limit_upper="1.5"
    effort="2"
    velocity="3"
  />


  <!-- 5. 右手臂（right_shoulder/arm） -->
  <!-- 5.1 右肩链接 -->
  <xacro:generic_link 
    link_name="right_shoulder_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_shoulder_link.STL"
    mass="0.0131461"
    inertia_ixx="0.0000070" inertia_ixy="0" inertia_ixz="0.0000017"
    inertia_iyy="0.0000071" inertia_iyz="0" inertia_izz="0.0000045"
    origin_xyz="-0.0144831349305154 -0.000175271563297497 0.0209530786562937"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 5.2 右肩关节 -->
  <xacro:generic_joint 
    joint_name="right_shoulder_joint"
    type="revolute"
    parent="base_link"
    child="right_shoulder_link"
    origin_xyz="-0.06 0.0878 0.36288"
    origin_rpy="0 0 0"
    axis="0 0 1"
    limit_lower="-1.57"
    limit_upper="1.57"
    effort="2"
    velocity="3"
  />

  <!-- 5.3 右手臂1链接 -->
  <xacro:generic_link 
    link_name="right_arm1_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_arm1_link.STL"
    mass="0.5854363"
    inertia_ixx="0.0008778" inertia_ixy="0.0000592" inertia_ixz="-0.0000064"
    inertia_iyy="0.0002836" inertia_iyz="-0.0000262" inertia_izz="0.0009288"
    origin_xyz="-0.00258654183724675 0.00163071193731268 -0.0247948407356193"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 5.4 右手臂1关节 -->
  <xacro:generic_joint 
    joint_name="right_arm1_joint"
    type="revolute"
    parent="right_shoulder_link"
    child="right_arm1_link"
    origin_xyz="0 0 0.0385"
    origin_rpy="1.5708 0 0"
    axis="1 0 0"
    limit_lower="-1.5"
    limit_upper="1.5"
    effort="2"
    velocity="3"
  />

  <!-- 5.5 右手臂2链接 -->
  <xacro:generic_link 
    link_name="right_arm2_link"
    mesh_file="file://$(find hive_core_r0)/urdf/meshes/right_arm2_link.STL"
    mass="0.7955302"
    inertia_ixx="0.0035728" inertia_ixy="0.0000412" inertia_ixz="-0.0000004"
    inertia_iyy="0.0002317" inertia_iyz="0.0000292" inertia_izz="0.0036666"
    origin_xyz="-0.0240175529876588 0.0558375631647781 2.11385309717427E-06"
    origin_rpy="0 0 0"
    color_rgba="1 1 1 1"
    enable_collision="false"
  />

  <!-- 5.6 右手臂2关节 -->
  <xacro:generic_joint 
    joint_name="right_arm2_joint"
    type="revolute"
    parent="right_arm1_link"
    child="right_arm2_link"
    origin_xyz="0.017969 0.0026972 -0.17843"
    origin_rpy="-1.5793 0 0"
    axis="-0.99993 -0.0121 -0.00010316"
    limit_lower="-1.5"
    limit_upper="1.5"
    effort="2"
    velocity="3"
  />

  <xacro:include filename="$(find hive_core_r0)/urdf/bot0.ros2_control.xacro" />
  <xacro:bot0_ros2_control />

</robot>
