This commit is contained in:
Björn Ellensohn 2023-06-06 10:53:36 +02:00
parent e1be35f4a4
commit 467fb49a8c
5 changed files with 144 additions and 140 deletions

View File

@ -6,35 +6,35 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
<robot> <robot>
<material name="black"> <material name="black">
<color rgba="0.0 0.0 0.0 1.0"/> <color rgba="0.0 0.0 0.0 1.0" />
</material> </material>
<material name="blue"> <material name="blue">
<color rgba="0.0 0.0 0.8 1.0"/> <color rgba="0.0 0.0 0.8 1.0" />
</material> </material>
<material name="green"> <material name="green">
<color rgba="0.0 0.8 0.0 1.0"/> <color rgba="0.0 0.8 0.0 1.0" />
</material> </material>
<material name="grey"> <material name="grey">
<color rgba="0.2 0.2 0.2 1.0"/> <color rgba="0.2 0.2 0.2 1.0" />
</material> </material>
<material name="orange"> <material name="orange">
<color rgba="${255/255} ${108/255} ${10/255} 1.0"/> <color rgba="${255/255} ${108/255} ${10/255} 1.0" />
</material> </material>
<material name="brown"> <material name="brown">
<color rgba="${222/255} ${207/255} ${195/255} 1.0"/> <color rgba="${222/255} ${207/255} ${195/255} 1.0" />
</material> </material>
<material name="red"> <material name="red">
<color rgba="0.8 0.0 0.0 1.0"/> <color rgba="0.8 0.0 0.0 1.0" />
</material> </material>
<material name="white"> <material name="white">
<color rgba="1.0 1.0 1.0 1.0"/> <color rgba="1.0 1.0 1.0 1.0" />
</material> </material>
</robot> </robot>

View File

@ -4,7 +4,7 @@
<xacro:macro name="diffbot" params="prefix"> <xacro:macro name="diffbot" params="prefix">
<!-- Constants for robot dimensions --> <!-- Constants for robot dimensions -->
<xacro:property name="PI" value="3.1415926535897931"/> <xacro:property name="PI" value="3.1415926535897931" />
<xacro:property name="base_mass" value="0.3" /> <!-- arbitrary value for base mass --> <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_width" value="0.25" /> <!-- Updated wheel spacing to 25cm -->
<xacro:property name="base_length" value="0.34" /> <xacro:property name="base_length" value="0.34" />
@ -12,59 +12,63 @@
<xacro:property name="wheel_mass" value="0.3" /> <!-- arbitrary value for wheel mass --> <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_len" value="0.020" />
<xacro:property name="wheel_radius" value="0.0625" /> <xacro:property name="wheel_radius" value="0.0625" />
<xacro:property name="caster_wheel_mass" value="0.1" /> <!-- arbitrary value for caster wheel mass --> <xacro:property name="caster_wheel_mass" value="0.1" /> <!-- arbitrary value for caster wheel
mass -->
<xacro:property name="caster_wheel_radius" value="0.04" /> <xacro:property name="caster_wheel_radius" value="0.04" />
<xacro:property name="z_offset" value="-${base_height/2}" /> <!-- Space btw top of beam and the each joint --> <xacro:property name="z_offset" value="-${base_height/2}" /> <!-- Space btw top of beam and the
each joint -->
<!-- dummy link - used for ros2 control so it stops complaining? --> <!-- dummy link - used for ros2 control so it stops complaining? -->
<link name="${prefix}dummy"> <link name="${prefix}dummy">
</link> </link>
<joint name="${prefix}dummy_joint" type="fixed"> <joint name="${prefix}dummy_joint" type="fixed">
<parent link="${prefix}dummy"/> <parent link="${prefix}dummy" />
<child link="${prefix}base_link"/> <child link="${prefix}base_link" />
</joint> </joint>
<!-- Base Link --> <!-- Base Link -->
<link name="${prefix}base_link"> <link name="${prefix}base_link">
<collision> <collision>
<origin xyz="0 0 0" rpy="0 0 0"/> <origin xyz="0 0 0" rpy="0 0 0" />
<geometry> <geometry>
<box size="${base_length} ${base_width} ${base_height}"/> <!-- Updated base dimensions --> <box size="${base_length} ${base_width} ${base_height}" /> <!-- Updated base dimensions -->
</geometry> </geometry>
</collision> </collision>
<visual> <visual>
<origin xyz="0 0 ${base_height/2}" rpy="0 0 0"/> <origin xyz="0 0 ${base_height/2}" rpy="0 0 0" />
<geometry> <geometry>
<box size="${base_length} ${base_width} ${base_height}"/> <!-- Updated base dimensions --> <box size="${base_length} ${base_width} ${base_height}" /> <!-- Updated base dimensions -->
</geometry> </geometry>
<material name="orange"/> <material name="orange" />
</visual> </visual>
<inertial> <inertial>
<origin xyz="0 0 0" rpy="0 0 0"/> <origin xyz="0 0 0" rpy="0 0 0" />
<mass value="${base_mass}"/> <mass value="${base_mass}" />
<inertia <inertia
ixx="${base_mass / 12.0 * (base_length*base_length + base_height*base_height)}" ixy="0.0" ixz="0.0" ixx="${base_mass / 12.0 * (base_length*base_length + base_height*base_height)}" ixy="0.0"
ixz="0.0"
iyy="${base_mass / 12.0 * (base_height*base_height + base_width*base_width)}" iyz="0.0" iyy="${base_mass / 12.0 * (base_height*base_height + base_width*base_width)}" iyz="0.0"
izz="${base_mass / 12.0 * (base_width*base_width + base_length*base_length)}"/> izz="${base_mass / 12.0 * (base_width*base_width + base_length*base_length)}" />
</inertial> </inertial>
</link> </link>
<joint name="${prefix}left_wheel_joint" type="continuous"> <joint name="${prefix}left_wheel_joint" type="continuous">
<parent link="${prefix}base_link"/> <parent link="${prefix}base_link" />
<child link="${prefix}left_wheel"/> <child link="${prefix}left_wheel" />
<origin xyz="${base_length/2} 0 ${z_offset}" rpy="0 0 0"/> <!-- Updated wheel position --> <origin xyz="${base_length/2} 0 ${z_offset}" rpy="0 0 0" /> <!-- Updated wheel position -->
<axis xyz="0 1 0"/> <axis xyz="0 1 0" />
<dynamics damping="0.2"/> <dynamics damping="0.2" />
</joint> </joint>
<!-- BASE_FOOTPRINT LINK (Used for SLAM: Should be oin the ground beneath the robo like the shadow) --> <!-- 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"> <joint name="${prefix}base_footprint_joint" type="fixed">
<parent link="${prefix}base_link"/> <parent link="${prefix}base_link" />
<child link="${prefix}base_footprint"/> <child link="${prefix}base_footprint" />
<origin xyz="0 0 0" rpy="0 0 0"/> <origin xyz="0 0 0" rpy="0 0 0" />
</joint> </joint>
<link name="${prefix}base_footprint"> <link name="${prefix}base_footprint">
@ -73,166 +77,166 @@
<!-- left wheel Link --> <!-- left wheel Link -->
<link name="${prefix}left_wheel"> <link name="${prefix}left_wheel">
<collision> <collision>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/> <origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<geometry> <geometry>
<cylinder length="${wheel_len}" radius="${wheel_radius}"/> <cylinder length="${wheel_len}" radius="${wheel_radius}" />
</geometry> </geometry>
</collision> </collision>
<visual> <visual>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/> <origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<geometry> <geometry>
<cylinder length="${wheel_len}" radius="${wheel_radius}"/> <cylinder length="${wheel_len}" radius="${wheel_radius}" />
</geometry> </geometry>
<material name="black"/> <material name="black" />
</visual> </visual>
<inertial> <inertial>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/> <origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<mass value="${wheel_mass}"/> <mass value="${wheel_mass}" />
<inertia <inertia
ixx="${wheel_mass / 12.0 * (3*wheel_radius + wheel_len*wheel_len)}" ixy="0.0" ixz="0.0" 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" iyy="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" iyz="0.0"
izz="${wheel_mass / 12.0 * wheel_radius*wheel_radius}"/> izz="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" />
</inertial> </inertial>
</link> </link>
<joint name="${prefix}right_wheel_joint" type="continuous"> <joint name="${prefix}right_wheel_joint" type="continuous">
<parent link="${prefix}base_link"/> <parent link="${prefix}base_link" />
<child link="${prefix}right_wheel"/> <child link="${prefix}right_wheel" />
<origin xyz="${base_length/2} 0 ${z_offset}" rpy="0 0 0"/> <!-- Updated wheel position --> <origin xyz="${base_length/2} 0 ${z_offset}" rpy="0 0 0" /> <!-- Updated wheel position -->
<axis xyz="0 -1 0"/> <axis xyz="0 -1 0" />
<dynamics damping="0.2"/> <dynamics damping="0.2" />
</joint> </joint>
<!-- right wheel Link --> <!-- right wheel Link -->
<link name="${prefix}right_wheel"> <link name="${prefix}right_wheel">
<collision> <collision>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/> <origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<geometry> <geometry>
<cylinder length="${wheel_len}" radius="${wheel_radius}"/> <cylinder length="${wheel_len}" radius="${wheel_radius}" />
</geometry> </geometry>
</collision> </collision>
<visual> <visual>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/> <origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<geometry> <geometry>
<cylinder length="${wheel_len}" radius="${wheel_radius}"/> <cylinder length="${wheel_len}" radius="${wheel_radius}" />
</geometry> </geometry>
<material name="black"/> <material name="black" />
</visual> </visual>
<inertial> <inertial>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/> <origin xyz="0 0 0" rpy="${PI/2} 0 0" />
<mass value="${wheel_mass}"/> <mass value="${wheel_mass}" />
<inertia <inertia
ixx="${wheel_mass / 12.0 * (3*wheel_radius + wheel_len*wheel_len)}" ixy="0.0" ixz="0.0" 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" iyy="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" iyz="0.0"
izz="${wheel_mass / 12.0 * wheel_radius*wheel_radius}"/> izz="${wheel_mass / 12.0 * wheel_radius*wheel_radius}" />
</inertial> </inertial>
</link> </link>
<joint name="${prefix}caster_wheel_joint" type="fixed"> <joint name="${prefix}caster_wheel_joint" type="fixed">
<parent link="${prefix}base_link"/> <parent link="${prefix}base_link" />
<child link="${prefix}caster_wheel"/> <child link="${prefix}caster_wheel" />
<origin xyz="${-base_length/2} 0 ${z_offset}" rpy="0 0 0"/> <!-- Updated caster wheel position --> <origin xyz="${-base_length/2} 0 ${z_offset}" rpy="0 0 0" /> <!-- Updated caster wheel position -->
</joint> </joint>
<!-- caster wheel Link --> <!-- caster wheel Link -->
<link name="${prefix}caster_wheel"> <link name="${prefix}caster_wheel">
<collision> <collision>
<origin xyz="0 0 0" rpy="0 0 0"/> <origin xyz="0 0 0" rpy="0 0 0" />
<geometry> <geometry>
<sphere radius="${caster_wheel_radius}"/> <sphere radius="${caster_wheel_radius}" />
</geometry> </geometry>
</collision> </collision>
<visual> <visual>
<origin xyz="0 0 0" rpy="0 0 0"/> <origin xyz="0 0 0" rpy="0 0 0" />
<geometry> <geometry>
<sphere radius="${caster_wheel_radius}"/> <sphere radius="${caster_wheel_radius}" />
</geometry> </geometry>
<material name="white"/> <material name="white" />
</visual> </visual>
<inertial> <inertial>
<origin xyz="0 0 0" rpy="0 0 0"/> <origin xyz="0 0 0" rpy="0 0 0" />
<mass value="${caster_wheel_mass}"/> <mass value="${caster_wheel_mass}" />
<inertia <inertia
ixx="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}" ixx="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}"
ixy="0.0" ixz="0.0" ixy="0.0" ixz="0.0"
iyy="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}" iyy="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}"
iyz="0.0" iyz="0.0"
izz="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}"/> izz="${2.0/5.0 * caster_wheel_mass * caster_wheel_radius * caster_wheel_radius}" />
</inertial> </inertial>
</link> </link>
<!-- laser_link --> <!-- laser_link -->
<link name="${prefix}laser_link"> <link name="${prefix}laser_link">
<collision> <collision>
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
<geometry> <geometry>
<box size="0.1 0.1 0.1"/> <box size="0.1 0.1 0.1" />
</geometry> </geometry>
</collision> </collision>
<visual> <visual>
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
<geometry> <geometry>
<box size="0.1 0.1 0.1"/> <box size="0.1 0.1 0.1" />
</geometry> </geometry>
<material name="green"/> <material name="green" />
</visual> </visual>
<inertial> <inertial>
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
<mass value="0.1"/> <mass value="0.1" />
<inertia <inertia
ixx="0.001" ixy="0.0" ixz="0.0" ixx="0.001" ixy="0.0" ixz="0.0"
iyy="0.001" iyz="0.0" iyy="0.001" iyz="0.0"
izz="0.001"/> izz="0.001" />
</inertial> </inertial>
</link> </link>
<!-- camera_link --> <!-- camera_link -->
<link name="${prefix}camera_link"> <link name="${prefix}camera_link">
<collision> <collision>
<origin xyz="${base_length/2} 0 0" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 0" rpy="0 0 0" />
<geometry> <geometry>
<box size="0.1 0.1 0.1"/> <box size="0.1 0.1 0.1" />
</geometry> </geometry>
</collision> </collision>
<visual> <visual>
<origin xyz="${base_length/2} 0 0" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 0" rpy="0 0 0" />
<geometry> <geometry>
<box size="0.1 0.1 0.1"/> <box size="0.1 0.1 0.1" />
</geometry> </geometry>
<material name="blue"/> <material name="blue" />
</visual> </visual>
<inertial> <inertial>
<origin xyz="${base_length/2} 0 0" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 0" rpy="0 0 0" />
<mass value="0.1"/> <mass value="0.1" />
<inertia <inertia
ixx="0.001" ixy="0.0" ixz="0.0" ixx="0.001" ixy="0.0" ixz="0.0"
iyy="0.001" iyz="0.0" iyy="0.001" iyz="0.0"
izz="0.001"/> izz="0.001" />
</inertial> </inertial>
</link> </link>
<!-- Base Joint --> <!-- Base Joint -->
<joint name="${prefix}base_joint" type="fixed"> <joint name="${prefix}base_joint" type="fixed">
<parent link="${prefix}base_link"/> <parent link="${prefix}base_link" />
<child link="${prefix}laser_link"/> <child link="${prefix}laser_link" />
<origin xyz="0 0 ${base_height}" rpy="0 0 0"/> <origin xyz="0 0 ${base_height}" rpy="0 0 0" />
</joint> </joint>
<!-- Front Joint --> <!-- Front Joint -->
<joint name="${prefix}front_joint" type="fixed"> <joint name="${prefix}front_joint" type="fixed">
<parent link="${prefix}laser_link"/> <parent link="${prefix}laser_link" />
<child link="${prefix}camera_link"/> <child link="${prefix}camera_link" />
<origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0"/> <origin xyz="${base_length/2} 0 ${base_height}" rpy="0 0 0" />
</joint> </joint>
</xacro:macro> </xacro:macro>

View File

@ -11,18 +11,18 @@
<xacro:if value="$(arg enable_joint0)"> <xacro:if value="$(arg enable_joint0)">
<link name="link0" /> <link name="link0" />
<joint name="joint0" type="continuous"> <joint name="joint0" type="continuous">
<parent link="world"/> <parent link="world" />
<child link="link0"/> <child link="link0" />
<axis xyz="0 0 1"/> <axis xyz="0 0 1" />
</joint> </joint>
</xacro:if> </xacro:if>
<xacro:if value="$(arg enable_joint1)"> <xacro:if value="$(arg enable_joint1)">
<link name="link1" /> <link name="link1" />
<joint name="joint1" type="continuous"> <joint name="joint1" type="continuous">
<parent link="world"/> <parent link="world" />
<child link="link1"/> <child link="link1" />
<axis xyz="0 0 1"/> <axis xyz="0 0 1" />
</joint> </joint>
</xacro:if> </xacro:if>