-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff_drive_4.urdf.xacro
152 lines (133 loc) · 5.27 KB
/
diff_drive_4.urdf.xacro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?xml version="1.0"?>
<robot name="roscontrol" xmlns:xacro="http://ros.org/wiki/xacro">
<!--
Run the following command to check if the urdf file is ok:
~$ xacro diff_drive_4.urdf.xacro > tmp.urdf && check_urdf tmp.urdf && rm tmp.urdf
-->
<!-- Xacro properties definition -->
<xacro:property name="odom_dist_wh" value="0.2"/>
<xacro:property name="odom_diam_wh_r" value="0.06"/>
<xacro:property name="odom_diam_wh_l" value="0.06"/>
<xacro:property name="odom_diam"
value="${(odom_diam_wh_r+odom_diam_wh_l)/2}"/>
<xacro:property name="wh_thick" value="0.005"/>
<xacro:property name="body_gnd_height" value="0.02"/>
<xacro:property name="body_wh_space" value="0.005"/>
<xacro:property name="body_len" value="0.3"/>
<xacro:property name="body_width"
value="${odom_dist_wh-wh_thick-2*body_wh_space}"/>
<xacro:property name="body_height" value="0.1"/>
<!-- Materials definition -->
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
<!-- Xacro Macro definitions -->
<!-- + inertial models: -->
<xacro:include
filename="$(find robot_sim_diff_drive_rbs)/urdf/inertia.urdf.xacro"/>
<!-- + wheel macro:
- prefix : relative to the default name
- sufix : relative to the default name
- reflect : 1 or -1 (default or inverted orientation relative to
parent frame)
- offset : relative to the parent frame in x axis -->
<xacro:macro name="wheel" params="prefix suffix reflect offset:=0">
<link name="${prefix}_${suffix}_wheel">
<visual>
<!-- Origin relative to the link frame -->
<origin xyz="0 0 0" rpy="${pi/2} 0 0" />
<geometry>
<cylinder radius="${odom_diam/2}" length="${wh_thick}"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="0 0 0" rpy="${pi/2} 0 0" />
<geometry>
<cylinder radius="${odom_diam/2}" length="${wh_thick}"/>
</geometry>
</collision>
<xacro:inertial_wh_cylinder mass="0.05"
radius="${odom_diam/2}" height="${wh_thick}"/>
</link>
<joint name="${prefix}_${suffix}_wheel_joint" type="continuous">
<!-- axis and rotation always defined relative to parent frame -->
<axis xyz="0 1 0" rpy="0 0 0" />
<parent link="base_link"/>
<child link="${prefix}_${suffix}_wheel"/>
<origin xyz="${offset} ${reflect*odom_dist_wh/2} 0" rpy="0 0 0"/>
</joint>
<!-- This block provides the simulator (Gazebo) with information on a few
additional physical properties.
See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
<gazebo reference="${prefix}_${suffix}_wheel">
<fdir1 value="1 0 0"/>
<mu1 value="1.0"/>
<mu2 value="1.0"/>
<kp value="10000000.0"/>
<kd value="1.0"/>
<material>Gazebo/Grey</material>
</gazebo>
<!-- This block connects the wheel joint to an actuator (motor), which informs both
simulation and visualization of the robot -->
<transmission name="${prefix}_${suffix}_wheel_trans">
<type>transmission_interface/SimpleTransmission</type>
<actuator name="${prefix}_${suffix}_wheel_motor">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
<joint name="${prefix}_${suffix}_wheel_joint">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</joint>
</transmission>
</xacro:macro>
<!-- Body -->
<link name="base_link">
<visual>
<origin xyz="0 0 ${-odom_diam/2+body_gnd_height+body_height/2}"
rpy="0 0 0"/>
<geometry>
<box size="${body_len} ${body_width} ${body_height}"/>
</geometry>
<material name="blue"/>
</visual>
<collision>
<origin xyz="0 0 ${-odom_diam/2+body_gnd_height+body_height/2}"
rpy="0 0 0"/>
<geometry>
<box size="${body_len} ${body_width} ${body_height}"/>
</geometry>
</collision>
<xacro:inertial_body_cuboid mass="1.00"
size_x="${body_len}" size_y="${body_width}"
size_z="${body_height}"/>
</link>
<!-- Wheels -->
<xacro:wheel prefix="right" suffix="front" reflect="-1"
offset="${body_len/2-odom_diam/2}"/>
<xacro:wheel prefix="left" suffix="front" reflect="1"
offset="${body_len/2-odom_diam/2}"/>
<xacro:wheel prefix="right" suffix="back" reflect="-1"
offset="-${body_len/2-odom_diam/2}"/>
<xacro:wheel prefix="left" suffix="back" reflect="1"
offset="-${body_len/2-odom_diam/2}"/>
<!-- Sensors -->
<xacro:include
filename="$(find robot_sim_diff_drive_rbs)/urdf/hokuyo_ust10.urdf.xacro"/>
<xacro:hokuyo_ust10_mount prefix="base" topic="base_laser"
parent_link="base_link">
<origin xyz="0 0 ${-odom_diam/2+body_gnd_height+body_height}"
rpy="0 0 0"/>
</xacro:hokuyo_ust10_mount>
<!-- Gazebo plugin for ROS Control -->
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/</robotNamespace>
</plugin>
</gazebo>
</robot>