cps_loki_description/urdf/diffbot_description.urdf.xacro

243 lines
8.0 KiB
Plaintext
Raw Normal View History

2023-06-01 08:05:36 +00:00
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
2023-06-01 09:08:40 +00:00
<xacro:macro name="diffbot" params="prefix">
<!-- Constants for robot dimensions -->
2023-06-06 08:53:36 +00:00
<xacro:property name="PI" value="3.1415926535897931" />
2023-06-01 09:08:40 +00:00
<xacro:property name="base_mass" value="0.3" /> <!-- arbitrary value for base mass -->
<xacro:property name="base_width" value="0.25" /> <!-- Updated wheel spacing to 25cm -->
<xacro:property name="base_length" value="0.34" />
<xacro:property name="base_height" value="0.1" />
<xacro:property name="wheel_mass" value="0.3" /> <!-- arbitrary value for wheel mass -->
<xacro:property name="wheel_len" value="0.020" />
<xacro:property name="wheel_radius" value="0.0625" />
2023-06-06 08:53:36 +00:00
<xacro:property name="caster_wheel_mass" value="0.1" /> <!-- arbitrary value for caster wheel
mass -->
2023-06-01 09:08:40 +00:00
<xacro:property name="caster_wheel_radius" value="0.04" />
2023-06-06 08:53:36 +00:00
<xacro:property name="z_offset" value="-${base_height/2}" /> <!-- Space btw top of beam and the
each joint -->
2023-06-01 09:08:40 +00:00
2023-06-05 11:47:24 +00:00
<!-- dummy link - used for ros2 control so it stops complaining? -->
<link name="${prefix}dummy">
2023-06-05 11:47:24 +00:00
</link>
<joint name="${prefix}dummy_joint" type="fixed">
2023-06-06 08:53:36 +00:00
<parent link="${prefix}dummy" />
<child link="${prefix}base_link" />
2023-06-05 11:47:24 +00:00
</joint>
2023-06-01 09:08:40 +00:00
<!-- Base Link -->
<link name="${prefix}base_link">
<collision>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="0 0 0" />
2023-06-01 09:08:40 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<box size="${base_length} ${base_width} ${base_height}" /> <!-- Updated base dimensions -->
2023-06-01 09:08:40 +00:00
</geometry>
</collision>
<visual>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 ${base_height/2}" rpy="0 0 0" />
2023-06-01 09:08:40 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<box size="${base_length} ${base_width} ${base_height}" /> <!-- Updated base dimensions -->
2023-06-01 09:08:40 +00:00
</geometry>
2023-06-06 08:53:36 +00:00
<material name="orange" />
2023-06-01 09:08:40 +00:00
</visual>
<inertial>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="${base_mass}" />
2023-06-01 09:08:40 +00:00
<inertia
2023-06-06 08:53:36 +00:00
ixx="${base_mass / 12.0 * (base_length*base_length + base_height*base_height)}" ixy="0.0"
ixz="0.0"
2023-06-01 09:08:40 +00:00
iyy="${base_mass / 12.0 * (base_height*base_height + base_width*base_width)}" iyz="0.0"
2023-06-06 08:53:36 +00:00
izz="${base_mass / 12.0 * (base_width*base_width + base_length*base_length)}" />
2023-06-01 08:05:36 +00:00
</inertial>
</link>
<joint name="${prefix}left_wheel_joint" type="continuous">
2023-06-06 08:53:36 +00:00
<parent link="${prefix}base_link" />
<child link="${prefix}left_wheel" />
<origin xyz="${base_length/2} 0 ${z_offset}" rpy="0 0 0" /> <!-- Updated wheel position -->
<axis xyz="0 1 0" />
<dynamics damping="0.2" />
2023-06-01 08:05:36 +00:00
</joint>
2023-06-06 08:53:36 +00:00
<!-- BASE_FOOTPRINT LINK (Used for SLAM: Should be oin the ground beneath the robo like the
shadow) -->
<joint name="${prefix}base_footprint_joint" type="fixed">
2023-06-06 08:53:36 +00:00
<parent link="${prefix}base_link" />
<child link="${prefix}base_footprint" />
<origin xyz="0 0 0" rpy="0 0 0" />
</joint>
2023-06-06 08:53:36 +00:00
<link name="${prefix}base_footprint">
</link>
2023-06-01 08:05:36 +00:00
<!-- left wheel Link -->
<link name="${prefix}left_wheel">
<collision>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="${PI/2} 0 0" />
2023-06-01 08:05:36 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<cylinder length="${wheel_len}" radius="${wheel_radius}" />
2023-06-01 08:05:36 +00:00
</geometry>
</collision>
<visual>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="${PI/2} 0 0" />
2023-06-01 08:05:36 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<cylinder length="${wheel_len}" radius="${wheel_radius}" />
2023-06-01 08:05:36 +00:00
</geometry>
2023-06-06 08:53:36 +00:00
<material name="black" />
2023-06-01 08:05:36 +00:00
</visual>
<inertial>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<mass value="${wheel_mass}" />
2023-06-01 08:05:36 +00:00
<inertia
ixx="${wheel_mass / 12.0 * (3*wheel_radius + wheel_len*wheel_len)}" ixy="0.0" ixz="0.0"
iyy="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" iyz="0.0"
2023-06-06 08:53:36 +00:00
izz="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" />
2023-06-01 09:08:40 +00:00
</inertial>
</link>
2023-06-01 08:05:36 +00:00
<joint name="${prefix}right_wheel_joint" type="continuous">
2023-06-06 08:53:36 +00:00
<parent link="${prefix}base_link" />
<child link="${prefix}right_wheel" />
<origin xyz="${base_length/2} 0 ${z_offset}" rpy="0 0 0" /> <!-- Updated wheel position -->
<axis xyz="0 -1 0" />
<dynamics damping="0.2" />
2023-06-01 08:05:36 +00:00
</joint>
<!-- right wheel Link -->
<link name="${prefix}right_wheel">
<collision>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="${PI/2} 0 0" />
2023-06-01 08:05:36 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<cylinder length="${wheel_len}" radius="${wheel_radius}" />
2023-06-01 08:05:36 +00:00
</geometry>
</collision>
<visual>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="${PI/2} 0 0" />
2023-06-01 08:05:36 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<cylinder length="${wheel_len}" radius="${wheel_radius}" />
2023-06-01 08:05:36 +00:00
</geometry>
2023-06-06 08:53:36 +00:00
<material name="black" />
2023-06-01 08:05:36 +00:00
</visual>
<inertial>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<mass value="${wheel_mass}" />
2023-06-01 08:05:36 +00:00
<inertia
ixx="${wheel_mass / 12.0 * (3*wheel_radius + wheel_len*wheel_len)}" ixy="0.0" ixz="0.0"
iyy="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" iyz="0.0"
2023-06-06 08:53:36 +00:00
izz="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" />
2023-06-01 09:08:40 +00:00
</inertial>
</link>
2023-06-01 08:05:36 +00:00
2023-06-01 09:08:40 +00:00
<joint name="${prefix}caster_wheel_joint" type="fixed">
2023-06-06 08:53:36 +00:00
<parent link="${prefix}base_link" />
<child link="${prefix}caster_wheel" />
<origin xyz="${-base_length/2} 0 ${z_offset}" rpy="0 0 0" /> <!-- Updated caster wheel position -->
2023-06-01 08:05:36 +00:00
</joint>
2023-06-01 09:08:40 +00:00
<!-- caster wheel Link -->
<link name="${prefix}caster_wheel">
2023-06-01 08:05:36 +00:00
<collision>
2023-06-06 08:53:36 +00:00
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="${caster_wheel_radius}" />
</geometry>
</collision>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="${caster_wheel_radius}" />
</geometry>
<material name="white" />
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="${caster_wheel_mass}" />
<inertia
ixx="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}"
ixy="0.0" ixz="0.0"
iyy="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}"
iyz="0.0"
izz="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}" />
</inertial>
</link>
<!-- laser_link -->
<link name="${prefix}laser_link">
<collision>
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
<geometry>
<box size="0.1 0.1 0.1" />
</geometry>
</collision>
<visual>
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
<geometry>
<box size="0.1 0.1 0.1" />
</geometry>
<material name="green" />
</visual>
<inertial>
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
<mass value="0.1" />
<inertia
ixx="0.001" ixy="0.0" ixz="0.0"
iyy="0.001" iyz="0.0"
izz="0.001" />
</inertial>
</link>
<!-- camera_link -->
<link name="${prefix}camera_link">
<collision>
<origin xyz="${base_length/2} 0 0" rpy="0 0 0" />
2023-06-01 08:05:36 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<box size="0.1 0.1 0.1" />
2023-06-01 08:05:36 +00:00
</geometry>
</collision>
<visual>
2023-06-06 08:53:36 +00:00
<origin xyz="${base_length/2} 0 0" rpy="0 0 0" />
2023-06-01 08:05:36 +00:00
<geometry>
2023-06-06 08:53:36 +00:00
<box size="0.1 0.1 0.1" />
2023-06-01 08:05:36 +00:00
</geometry>
2023-06-06 08:53:36 +00:00
<material name="blue" />
2023-06-01 08:05:36 +00:00
</visual>
<inertial>
2023-06-06 08:53:36 +00:00
<origin xyz="${base_length/2} 0 0" rpy="0 0 0" />
<mass value="0.1" />
2023-06-01 08:05:36 +00:00
<inertia
2023-06-06 08:53:36 +00:00
ixx="0.001" ixy="0.0" ixz="0.0"
iyy="0.001" iyz="0.0"
izz="0.001" />
2023-06-01 09:08:40 +00:00
</inertial>
2023-06-06 08:53:36 +00:00
</link>
<!-- Base Joint -->
<joint name="${prefix}base_joint" type="fixed">
<parent link="${prefix}base_link" />
<child link="${prefix}laser_link" />
<origin xyz="0 0 ${base_height}" rpy="0 0 0" />
</joint>
<!-- Front Joint -->
<joint name="${prefix}front_joint" type="fixed">
<parent link="${prefix}laser_link" />
<child link="${prefix}camera_link" />
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
</joint>
2023-06-01 08:30:59 +00:00
2023-06-01 09:08:40 +00:00
</xacro:macro>
2023-06-06 08:53:36 +00:00
</robot>