course2_ws/my_robot1_description/urdf/common_properties.xacro
2024-12-18 19:49:29 -05:00

49 lines
1.4 KiB
XML

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<material name="blue">
<color rgba="0 0 0.5 1"/>
</material>
<material name="gray">
<color rgba="0.5 0.5 0.5 1.0"/>
</material>
<material name="orange">
<color rgba="0.95 0.647 0.388 1"/>
</material>
<material name="yellow">
<color rgba="0.95 1 0.388 1" />
</material>
<xacro:macro name="box_inertia" params="m l w h xyz rpy">
<inertial>
<mass value="${m}"/>
<origin xyz="${xyz}" rpy="${rpy}"/>
<inertia ixx="${(m/12) * (h*h + l*l)}" ixy="0" ixz="0"
iyy="${(m/12) * (w*w + l*l)}" iyz="0"
izz="${(m/12) * (w*w + h*h)}" />
</inertial>
</xacro:macro>
<xacro:macro name="cylinder_inertia" params="m r h xyz rpy">
<inertial>
<mass value="${m}"/>
<origin xyz="${xyz}" rpy="${rpy}"/>
<inertia ixx="${(m/12) * (3*r*r + h*h)}" ixy="0" ixz="0"
iyy="${(m/12) * (3*r*r + h*h)}" iyz="0"
izz="${(2/m) * (r*r)}" />
</inertial>
</xacro:macro>
<xacro:macro name="sphere_inertia" params="m r xyz rpy">
<inertial>
<mass value="${m}"/>
<origin xyz="${xyz}" rpy="${rpy}"/>
<inertia ixx="${(2/5) * m * r * r}" ixy="0" ixz="0"
iyy="${(2/5) * m * r * r}" iyz="0"
izz="${(2/5) * m * r * r}" />
</inertial>
</xacro:macro>
</robot>