<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
  <!-- 宏定义：ros2_control硬件接口配置（适配位置控制器和轮子速度控制器） -->
  <xacro:macro name="bot1_ros2_control">
    <!-- 1. ros2_control系统配置：定义所有关节的控制接口 -->
    <ros2_control name="Bot1GazeboSystem" type="system">
      <!-- 硬件插件：关联Gazebo仿真 -->
      <hardware>
        <plugin>gazebo_ros2_control/GazeboSystem</plugin>
      </hardware>

        <!-- 所有关节的接口配置 -->
        <!-- 腿部关节 -->
        <joint name="left_leg1_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="left_leg2_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="right_leg1_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="right_leg2_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <!-- 轮子关节 -->
        <joint name="left_wheel1_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="left_wheel2_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="right_wheel1_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="right_wheel2_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <!-- 身体关节 -->
        <joint name="pitch_body_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <!-- 左臂关节 -->
        <joint name="left_shoulder_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="left_arm1_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="left_arm2_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <!-- 右臂关节 -->
        <joint name="right_shoulder_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="right_arm1_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>

        <joint name="right_arm2_joint">
        <command_interface name="position"/>
        <state_interface name="position"/>
        <state_interface name="velocity"/>
        </joint>
    </ros2_control>

    <!-- 4. Gazebo插件配置：关联控制器参数文件 -->
    <gazebo>
        <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
        <!-- 加载控制器配置文件（路径需替换为你的实际路径） -->
        <parameters>$(find hive_core_r0)/config/bot1_ros2_controller.yaml</parameters>
        </plugin>
    </gazebo>
    </xacro:macro>
</robot>
    