使用urdf语言编写差速机器人模型
时间: 2023-05-28 12:07:45 浏览: 85
以下是一个差速机器人的urdf模型例子:
```xml
<?xml version="1.0"?>
<robot name="diff_robot">
<link name="base_link">
<visual>
<geometry>
<box size="0.5 0.5 0.2" />
</geometry>
<material name="silver">
<color rgba="0.75 0.75 0.75 1" />
</material>
</visual>
</link>
<joint name="left_wheel_joint" type="continuous">
<parent link="base_link" />
<child link="left_wheel_link" />
<origin xyz="0.25 -0.25 0" rpy="0 0 0" />
<axis xyz="0 0 1" />
</joint>
<link name="left_wheel_link">
<visual>
<geometry>
<cylinder length="0.05" radius="0.15" />
</geometry>
<material name="black">
<color rgba="0 0 0 1" />
</material>
</visual>
<collision>
<geometry>
<cylinder length="0.05" radius="0.15" />
</geometry>
</collision>
<inertial>
<mass value="0.1" />
<inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001" />
</inertial>
</link>
<joint name="right_wheel_joint" type="continuous">
<parent link="base_link" />
<child link="right_wheel_link" />
<origin xyz="0.25 0.25 0" rpy="0 0 0" />
<axis xyz="0 0 1" />
</joint>
<link name="right_wheel_link">
<visual>
<geometry>
<cylinder length="0.05" radius="0.15" />
</geometry>
<material name="black">
<color rgba="0 0 0 1" />
</material>
</visual>
<collision>
<geometry>
<cylinder length="0.05" radius="0.15" />
</geometry>
</collision>
<inertial>
<mass value="0.1" />
<inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001" />
</inertial>
</link>
<transmission name="left_wheel_transmission">
<type>transmission_interface/SimpleTransmission</type>
<joint name="left_wheel_joint">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="left_wheel_motor">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="right_wheel_transmission">
<type>transmission_interface/SimpleTransmission</type>
<joint name="right_wheel_joint">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="right_wheel_motor">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<gazebo reference="base_link">
<material>Gazebo/Black</material>
<mu1>1000</mu1>
<mu2>1000</mu2>
<kp>1000000.0</kp>
<kd>100.0</kd>
<maxVel>100.0</maxVel>
<minDepth>0.001</minDepth>
<maxContacts>20</maxContacts>
</gazebo>
</robot>
```
其中, `<link>` 标签定义了机器人的每个链接, `<joint>` 标签定义了链接之间的关节, `<transmission>` 标签定义了驱动链接的传动。此外, `<gazebo>` 标签定义了机器人在Gazebo仿真环境中的物理属性。
阅读全文