URDF Model
URDF
Unified Robot Description Format (URDF) is a standard description for robots. A 3D printer is also a kind of robot, we can describe the links and the joints with URDF.
Basic links
A basic 3D printer contains 4 main components: base
, X axis
, Y axis
, Z axis
. The filename
is the important parameter in the URDF, the position and orientation will be initialized at the joints.
Example for basic links:
<link name="base">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="base.mesh"/>
</geometry>
</visual>
</link>
<link name="x_axis">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="x_axis_old.mesh"/>
</geometry>
</visual>
</link>
<link name="y_axis">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="y_axis.mesh"/>
</geometry>
</visual>
</link>
<link name="z_axis">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="z_axis.mesh"/>
</geometry>
</visual>
</link>
Basic joints
Create the basic joints with the proper relative positions and orientations. Every component can move along one given axis.
Example for basic joints:
<joint name="joint_1" type="prismatic">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base"/>
<child link="z_axis"/>
<axis xyz="0 0 1"/>
</joint>
<joint name="joint_2" type="prismatic">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base"/>
<child link="y_axis"/>
<axis xyz="0 -1 0"/>
</joint>
<joint name="joint_3" type="prismatic">
<origin rpy="-1.5707963 0 0" xyz="0 0 0"/>
<parent link="z_axis"/>
<child link="x_axis"/>
<axis xyz="1 0 0"/>
</joint>
Filament spool
We have a spool filled with filament ready to use if it is needed. Create the link with the filename Filament Spool.mesh
then parent it to the base
.
<link name="Spool">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="Filament Spool.mesh"/>
</geometry>
</visual>
</link>
<joint name="joint_4" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base"/>
<child link="Spool"/>
<axis xyz="0 0 0"/>
</joint>
Filament
Set four points for the Bezier curve that represents the filament hanging from the spool. zOutDisp
is the point where the sleeve connectsto the filament. zOutControl
gives the starting direction of the curve. xInDisp
point defines the other end of the sleeve in the head, here xInControl
gives the direction of the curve.
<link name="spoolDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="spoolControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zInControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zInDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
Create joints for each points. Give the position and the parent node like the example below:
<joint name="joint_5" type="fixed">
<origin rpy="0 0 0" xyz="1 -8.2 50"/>
<parent link="base"/>
<child link="spoolDisp"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_6" type="fixed">
<origin rpy="0 0 0" xyz="1 -8.2 17"/>
<parent link="z_axis"/>
<child link="spoolControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_7" type="fixed">
<origin rpy="0 0 0" xyz="-7 -11 19.364"/>
<parent link="z_axis"/>
<child link="zInControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_8" type="fixed">
<origin rpy="0 0 0" xyz="8.0312 -10.47 19.362"/>
<parent link="z_axis"/>
<child link="zInDisp"/>
<axis xyz="0 0 0"/>
</joint>
Sleeve
Set four points for the Bezier curve that represents the sleeve. spoolDisp
is the point where the filament comes out from the spool. spoolControl
gives the starting direction of the curve. zInDisp
point defines the other end of the filament, here zInControl
gives the direction of the curve.
<link name="zOutDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zOutControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="xInControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="xInDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
Create joints for each points. Give the position and the parent node like the example below:
<joint name="joint_9" type="fixed">
<origin rpy="0 0 0" xyz="8.0312 -10.47 19.362"/>
<parent link="z_axis"/>
<child link="zOutDisp"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_10" type="fixed">
<origin rpy="0 0 0" xyz="15.0312 -10.47 19.362"/>
<parent link="z_axis"/>
<child link="zOutControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_11" type="fixed">
<origin rpy="0 0 0" xyz="0.047873 -0.2563 -0.1987"/>
<parent link="x_axis"/>
<child link="xInControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_12" type="fixed">
<origin rpy="0 0 0" xyz="0.047873 -0.1543 -0.1987"/>
<parent link="x_axis"/>
<child link="xInDisp"/>
<axis xyz="0 0 0"/>
</joint>
Control panel
Create a link for the control panel with the name of controlPanel
, then create a joint to give the position and orientation like the example below:
<link name="controlPanel">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<joint name="joint_13" type="fixed">
<origin rpy="-1.1485098 0 0" xyz="34.1785 -22.2322 7.78085"/>
<parent link="base"/>
<child link="controlPanel"/>
<axis xyz="0 0 0"/>
</joint>
Table
We need to know which component is the table. Create a new link with the name table
and parent it to the element with the table function like the example below:
<link name="table">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<joint name="joint_14" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="y_axis"/>
<child link="table"/>
<axis xyz="0 0 0"/>
</joint>
Fan
We have a cooling fan ready to use if it is needed. Create the link named fan
with the filename ext_fan.mesh
then parent it to the right component like the example below:
<link name="fan">
<visual>
<geometry>
<mesh filename="ext_fan.mesh"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<joint name="joint_15" type="fixed">
<origin rpy="0 0 0" xyz="0.0399744 -0.132313 -0.222813"/>
<parent link="x_axis"/>
<child link="fan"/>
<axis xyz="0 0 0"/>
</joint>
Proper 3D printer URDF
Here is an example for a proper 3D printer URDF:
<?xml version="1.0" encoding="utf-8"?>
<robot name="craftbot">
<!-- links: main serial chain -->
<link name="base">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="base.mesh"/>
</geometry>
</visual>
</link>
<link name="x_axis">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="x_axis_old.mesh"/>
</geometry>
</visual>
</link>
<link name="y_axis">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="y_axis.mesh"/>
</geometry>
</visual>
</link>
<link name="z_axis">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="z_axis.mesh"/>
</geometry>
</visual>
</link>
<link name="Spool">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="Filament Spool.mesh"/>
</geometry>
</visual>
</link>
<link name="spoolDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="spoolControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zInControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zInDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zOutDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="zOutControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="xInControl">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="xInDisp">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="controlPanel">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="table">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<link name="fan">
<visual>
<geometry>
<mesh filename="ext_fan.mesh"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
</link>
<joint name="joint_1" type="prismatic">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base"/>
<child link="z_axis"/>
<axis xyz="0 0 1"/>
</joint>
<joint name="joint_2" type="prismatic">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base"/>
<child link="y_axis"/>
<axis xyz="0 -1 0"/>
</joint>
<joint name="joint_3" type="prismatic">
<origin rpy="-1.5707963 0 0" xyz="0 0 0"/>
<parent link="z_axis"/>
<child link="x_axis"/>
<axis xyz="1 0 0"/>
</joint>
<joint name="joint_4" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base"/>
<child link="Spool"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_5" type="fixed">
<origin rpy="0 0 0" xyz="1 -8.2 50"/>
<parent link="base"/>
<child link="spoolDisp"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_6" type="fixed">
<origin rpy="0 0 0" xyz="1 -8.2 17"/>
<parent link="z_axis"/>
<child link="spoolControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_7" type="fixed">
<origin rpy="0 0 0" xyz="-7 -11 19.364"/>
<parent link="z_axis"/>
<child link="zInControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_8" type="fixed">
<origin rpy="0 0 0" xyz="8.0312 -10.47 19.362"/>
<parent link="z_axis"/>
<child link="zInDisp"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_9" type="fixed">
<origin rpy="0 0 0" xyz="8.0312 -10.47 19.362"/>
<parent link="z_axis"/>
<child link="zOutDisp"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_10" type="fixed">
<origin rpy="0 0 0" xyz="15.0312 -10.47 19.362"/>
<parent link="z_axis"/>
<child link="zOutControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_11" type="fixed">
<origin rpy="0 0 0" xyz="0.047873 -0.2563 -0.1987"/>
<parent link="x_axis"/>
<child link="xInControl"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_12" type="fixed">
<origin rpy="0 0 0" xyz="0.047873 -0.1543 -0.1987"/>
<parent link="x_axis"/>
<child link="xInDisp"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_13" type="fixed">
<origin rpy="-1.1485098 0 0" xyz="34.1785 -22.2322 7.78085"/>
<parent link="base"/>
<child link="controlPanel"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_14" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="y_axis"/>
<child link="table"/>
<axis xyz="0 0 0"/>
</joint>
<joint name="joint_15" type="fixed">
<origin rpy="0 0 0" xyz="0.0399744 -0.132313 -0.222813"/>
<parent link="x_axis"/>
<child link="fan"/>
<axis xyz="0 0 0"/>
</joint>
</robot>