Skip to content
7 changes: 4 additions & 3 deletions config/diffbot/base.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
base:
mass: 2.5 # Base mass in Kg
mass: 0.8 # Base mass in Kg
x_size: 0.195 # Dimension in x axis
y_size: 0.198 # Dimension in y axis
z_size: 0.182 # Dimension in z axis
y_size: 0.08 # Dimension in y axis
z_size: 0.005 # Dimension in z axis
mesh: 'chassis.stl' # Name of the mesh files. Leave it empty ('') to have a white base.
#mesh: ''
11 changes: 6 additions & 5 deletions config/diffbot/front_wheel.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
wheel:
mass: 0.01 # Wheel mass in Kg
radius: 0.011 # Wheel radius in m
length: 0.006 # Wheel length in m, considering is as a cylinder
radius: 0.0331 # Wheel radius in m
length: 0.025 # Wheel length in m, considering is as a cylinder
mesh: 'wheel.stl' # Name of the mesh files. Leave it empty ('') to have a red wheel
x_offset: 0.035
y_offset: -0.056
z_offset: 0.008
#mesh: ''
x_offset: 0.079
y_offset: 0.015
z_offset: -0.017
9 changes: 9 additions & 0 deletions config/diffbot/motor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mass: 0.1 # Motor mass in Kg
x_size: 0.07 # Motor dimension in x axis
y_size: 0.0225 # Motor dimension in y axis
z_size: 0.0188 # Motor dimension in z axis
mesh: 'motor.stl' # Name of the mesh files. Leave it empty ('') to have a red wheel
#mesh: ''
x_offset: 0.096
y_offset: -0.0135
z_offset: -0.017
Binary file modified meshes/diffbot/motor.stl
Binary file not shown.
Binary file modified meshes/diffbot/wheel.stl
Binary file not shown.
35 changes: 35 additions & 0 deletions urdf/diffbot.gazebo.xacro
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">

<!-- ros_control plugin -->
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/diffbot</robotNamespace>
<!--robotParam>/robot_description</robotParam-->
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
</plugin>
</gazebo>

<!-- xacro to set the friction for the wheel. This patch was taken from the MIR
repository.
https://github.com/dfki-ric/mir_robot/tree/noetic.
https://github.com/dfki-ric/mir_robot/blob/a216d7374c21e360c94034d360b07fd7a4d42842/mir_description/urdf/include/mir_100.gazebo.xacro#L29
-->
<xacro:macro name="set_wheel_friction" params="link friction">
<gazebo reference="${link}">
<mu1 value="${friction}"/>
<mu2 value="${friction}"/>
<kp value="10000000.0"/>
<kd value="1.0"/>
<minDepth>0.01</minDepth>
</gazebo>
</xacro:macro>

<xacro:macro name="set_all_wheel_frictions" >
<xacro:set_wheel_friction link="back_left_wheel" friction="200"/>
<xacro:set_wheel_friction link="front_left_wheel" friction="200"/>
<xacro:set_wheel_friction link="back_right_wheel" friction="200"/>
<xacro:set_wheel_friction link="front_right_wheel" friction="200"/>
</xacro:macro>

</robot>
33 changes: 27 additions & 6 deletions urdf/diffbot.urdf.xacro
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="mobile_robot">
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="diffbot">

<xacro:property name="package_name" value="mobile_robot_description"/>
<xacro:property name="package_name" value="diffbot_description"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this parameter should be left as mobile_robot_description because is the name of the package and the path to find the files, isn't it?

<xacro:property name="robot_name" value="diffbot"/>

<xacro:include filename="$(find ${package_name})/urdf/include/common_macros.urdf.xacro" />

<!-- <xacro:set_package_name /> -->
<xacro:include filename="$(find ${package_name})/urdf/include/common_sensors.xacro" />
<xacro:include filename="$(find ${package_name})/urdf/diffbot.gazebo.xacro" />

<xacro:property name="caster_wheel_yaml" value="$(find ${package_name})/config/${robot_name}/caster_wheel.yaml" />
<xacro:property name="caster_wheel_props" value="${load_yaml(caster_wheel_yaml)}"/>

<xacro:property name="front_wheel_yaml" value="$(find ${package_name})/config/${robot_name}/front_wheel.yaml" />
<xacro:property name="front_wheel_props" value="${load_yaml(front_wheel_yaml)}"/>

<xacro:property name="motor_yaml" value="$(find ${package_name})/config/${robot_name}/motor.yaml" />
<xacro:property name="motor_props" value="${load_yaml(motor_yaml)}"/>

<xacro:property name="base_yaml" value="$(find ${package_name})/config/${robot_name}/base.yaml" />
<xacro:property name="base_props" value="${load_yaml(base_yaml)}"/>


<!-- Footprint link -->
<xacro:footprint wheel_props="${front_wheel_props}" />

<!-- Base link -->
<xacro:base base_prop="${base_props}" mesh="${base_props['base']['mesh']}" >
<origin xyz="0 0 0" rpy="0 0 0" />
</xacro:base>

<!-- Back Caster Wheel -->
<xacro:caster_wheel prefix="caster_wheel" reflect="-1"
<xacro:caster_wheel prefix="rear" reflect="-1"
wheel_props="${caster_wheel_props}">
</xacro:caster_wheel>

Expand All @@ -40,8 +46,23 @@
base_props="${base_props}"
mesh="${front_wheel_props['wheel']['mesh']}">
</xacro:wheel>


<!-- Motors -->
<xacro:motor prefix="right" reflect="-1"
motor_props="${motor_props}"
base_props="${base_props}"
mesh="${motor_props['mesh']}">
</xacro:motor>

<xacro:motor prefix="left" reflect="1"
motor_props="${motor_props}"
base_props="${base_props}"
mesh="${motor_props['mesh']}">
</xacro:motor>


<!-- <xacro:include filename="$(find mobile_description)/urdf/mobile_robot_gazebo_plugins.xacro"/> -->
<!-- Sensors -->


</robot>
Loading