]> defiant.homedns.org Git - ros_wild_thumper.git/blob - urdf/wild_thumper.urdf.xacro
fix simulation
[ros_wild_thumper.git] / urdf / wild_thumper.urdf.xacro
1 <?xml version="1.0"?>
2 <robot name="wild_thumper" xmlns:xacro="http://ros.org/wiki/xacro">
3         <xacro:property name="PI" value="3.1415926535897931" />
4         <xacro:include filename="$(find hector_sensors_description)/urdf/asus_camera.urdf.xacro" />
5
6         <link name="base_footprint">
7                 <visual>
8                         <geometry>
9                                 <box size="0.28 0.31 0.000001"/>
10                         </geometry>
11                         <material name="grey">
12                                 <color rgba="0.5 0.5 0.5 0.5"/>
13                         </material>
14                 </visual>
15         </link>
16
17         <link name="base_link">
18                 <collision>
19                         <geometry>
20                                 <box size="0.23 0.18 0.09"/>
21                         </geometry>
22                 </collision>
23                 <visual>
24                         <origin xyz="-0.00275 0 0" rpy="0 0 0"/>
25                         <geometry>
26                                 <mesh filename="package://wild_thumper/meshes/wild_thumper_4wd.stl" />
27                         </geometry>
28                 </visual>
29                 <inertial>
30                         <origin xyz="-0.00275 0 -0.02" rpy="0 0 0"/>
31                         <mass value="2.5"/>
32                         <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
33                 </inertial>
34         </link>
35
36         <link name="base_imu_link">
37                 <visual>
38                         <geometry>
39                                 <box size="0.041 0.028 0.002"/>
40                         </geometry>
41                         <material name="red">
42                                 <color rgba="1 0 0 1"/>
43                         </material>
44                 </visual>
45         </link>
46
47         <link name="mounting_plate">
48                 <visual>
49                         <geometry>
50                                 <box size="0.23 0.12 0.001"/>
51                         </geometry>
52                 </visual>
53         </link>
54
55         <xacro:asus_camera name="camera" parent="mounting_plate">
56                 <origin xyz="0.107 0.0 0.04" rpy="0 0 0"/>
57         </xacro:asus_camera>
58
59         <link name="sonar_forward">
60                 <visual>
61                         <geometry>
62                                 <box size="0.016 0.044 0.02"/>
63                         </geometry>
64                         <origin xyz="${0.016/2} 0 0" rpy="0 0 0"/>
65                         <material name="green">
66                                 <color rgba="0 1 0 0.8"/>
67                         </material>
68                 </visual>
69         </link>
70
71         <link name="sonar_backward">
72                 <visual>
73                         <geometry>
74                                 <box size="0.016 0.044 0.02"/>
75                         </geometry>
76                         <origin xyz="${0.016/2} 0 0" rpy="0 0 0"/>
77                         <material name="green">
78                                 <color rgba="0 1 0 0.8"/>
79                         </material>
80                 </visual>
81         </link>
82
83         <link name="ir_left">
84                 <visual>
85                         <geometry>
86                                 <box size="0.015 0.015 0.046"/>
87                         </geometry>
88                         <origin xyz="${-0.015/2} 0 0" rpy="0 0 0"/>
89                         <material name="black">
90                                 <color rgba="0 0 0 1"/>
91                         </material>
92                 </visual>
93         </link>
94
95         <link name="ir_right">
96                 <visual>
97                         <geometry>
98                                 <box size="0.015 0.015 0.046"/>
99                         </geometry>
100                         <origin xyz="${-0.015/2} 0 0" rpy="0 0 0"/>
101                         <material name="black">
102                                 <color rgba="0 0 0 1"/>
103                         </material>
104                 </visual>
105         </link>
106
107         <joint name="base_link_joint" type="fixed">
108                 <parent link="base_footprint"/>
109                 <child link="base_link"/>
110                 <origin xyz="0.0 0.0 0.082" rpy="0 0 0"/>
111         </joint>
112
113         <joint name="mounting_plate_joint" type="fixed">
114                 <parent link="base_link"/>
115                 <child link="mounting_plate"/>
116                 <origin xyz="0.0 0.0 0.044" rpy="0 0 0"/>
117         </joint>
118
119         <joint name="imu_joint" type="fixed">
120                 <parent link="mounting_plate"/>
121                 <child link="base_imu_link"/>
122                 <origin xyz="0.06 -0.03 0.058" rpy="0 0 0"/>
123         </joint>
124
125         <joint name="sonar_forward_joint" type="fixed">
126                 <parent link="mounting_plate"/>
127                 <child link="sonar_forward"/>
128                 <origin xyz="0.115 0.0 -0.012" rpy="0 0 0"/>
129         </joint>
130
131         <joint name="sonar_backward_joint" type="fixed">
132                 <parent link="mounting_plate"/>
133                 <child link="sonar_backward"/>
134                 <origin xyz="-0.115 0.0 -0.012" rpy="0 ${PI} 0"/>
135         </joint>
136
137         <joint name="ir_left_joint" type="fixed">
138                 <parent link="mounting_plate"/>
139                 <child link="ir_left"/>
140                 <origin xyz="0.0 ${0.072+0.015} -0.045" rpy="0 0 ${PI/2}"/>
141         </joint>
142
143         <joint name="ir_right_joint" type="fixed">
144                 <parent link="mounting_plate"/>
145                 <child link="ir_right"/>
146                 <origin xyz="0.0 ${-0.072-0.015} -0.045" rpy="0 0 ${-PI/2}"/>
147         </joint>
148
149         <xacro:macro name="wheel" params="pos side xyz rpy">   
150                 <link name="${pos}_${side}_wheel">
151                         <visual>
152                                 <origin xyz="0 0 0" rpy="0 0 0"/>
153                                 <geometry>
154                                         <mesh filename="package://wild_thumper/meshes/wheel_${side}.stl" />
155                                 </geometry>
156                         </visual>
157                         <collision>
158                                 <origin xyz="0 0 0" rpy="${-PI/2} 0 0"/>
159                                 <geometry>
160                                         <cylinder radius="0.06" length="0.06"/>
161                                 </geometry>
162                         </collision>
163                         <inertial>
164                                 <origin xyz="0 0 0" rpy="0 0 0"/>
165                                 <mass value="0.1"/>
166                                 <inertia ixx="0.005" ixy="0" ixz="0" iyy="0.005" iyz="0" izz="0.005"/>
167                         </inertial>
168                 </link>
169
170                 <gazebo reference="${pos}_${side}_wheel">
171                         <mu1 value="1.0"/>
172                         <mu2 value="1.0"/>
173                         <kp value="1000000.0" />
174                         <kd value="1.0" />
175                         <fdir1 value="1 0 0"/>
176                 </gazebo>
177
178                 <joint name="${pos}_${side}_wheel_joint" type="continuous">
179                         <parent link="base_link"/>
180                         <child link="${pos}_${side}_wheel"/>
181                         <axis xyz="0 1 0"/>
182                         <origin xyz="${xyz}" rpy="${rpy}"/>
183                 </joint>
184
185                 <transmission name="${pos}_${side}_wheel_trans" type="SimpleTransmission">
186                         <type>transmission_interface/SimpleTransmission</type>
187                         <joint name="${pos}_${side}_wheel_joint">
188                                 <hardwareInterface>VelocityJointInterface</hardwareInterface>
189                         </joint>
190                         <actuator name="{pos}_${side}_wheel_motor">
191                                 <mechanicalReduction>1</mechanicalReduction>
192                         </actuator>
193                 </transmission>
194         </xacro:macro>
195
196         <xacro:wheel pos="rear" side="left"   xyz="-0.07525  0.12 -0.025" rpy="${-5*PI/180} 0 0" />
197         <xacro:wheel pos="rear" side="right"  xyz="-0.07525 -0.12 -0.025" rpy="${5*PI/180} 0 0" />
198         <xacro:wheel pos="front" side="left"  xyz=" 0.07525  0.12 -0.025" rpy="${-5*PI/180} 0 0" />
199         <xacro:wheel pos="front" side="right" xyz=" 0.07525 -0.12 -0.025" rpy="${5*PI/180} 0 0" />
200
201         <gazebo>
202                 <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
203                         <robotNamespace>/</robotNamespace>
204                         <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
205                 </plugin>
206
207                 <plugin name="imu_controller" filename="libgazebo_ros_imu.so">
208                         <alwaysOn>true</alwaysOn>
209                         <updateRate>20.0</updateRate>
210                         <bodyName>base_imu_link</bodyName>
211                         <topicName>imu</topicName>
212                         <gaussianNoise>0.05</gaussianNoise>
213                         <frameName>base_imu_link</frameName>
214                         <xyzOffsets>0 0 0</xyzOffsets>
215                         <rpyOffset>0 0 0</rpyOffset>
216                         <serviceName>/default_imu</serviceName>
217                 </plugin>
218         </gazebo>
219
220         <xacro:macro name="range_sensor" params="name ros_topic update_rate minRange maxRange fov radiation">
221                 <gazebo reference="${name}">
222                         <sensor type="ray" name="${name}_sensor">
223                                 <pose>0 0 0 0 0 0</pose>
224                                 <update_rate>${update_rate}</update_rate>
225                                 <visualize>false</visualize>
226                                 <ray>
227                                         <scan>
228                                                 <horizontal>
229                                                         <samples>5</samples>
230                                                         <resolution>1</resolution>
231                                                         <min_angle>-${fov/2}</min_angle>
232                                                         <max_angle>${fov/2}</max_angle>
233                                                 </horizontal>
234                                                 <vertical>
235                                                         <samples>5</samples>
236                                                         <resolution>1</resolution>
237                                                         <min_angle>-${fov/2}</min_angle>
238                                                         <max_angle>${fov/2}</max_angle>
239                                                 </vertical>
240                                         </scan>
241                                         <range>
242                                                 <min>${minRange}</min>
243                                                 <max>${maxRange}</max>
244                                                 <resolution>0.01</resolution>
245                                         </range>
246                                 </ray>
247                                 <plugin filename="libgazebo_ros_range.so" name="gazebo_ros_range">
248                                         <gaussianNoise>0.005</gaussianNoise>
249                                         <alwaysOn>true</alwaysOn>
250                                         <updateRate>${update_rate}</updateRate>
251                                         <topicName>${ros_topic}</topicName>
252                                         <frameName>${name}</frameName>
253                                         <fov>${fov}</fov>
254                                         <radiation>${radiation}</radiation>
255                                 </plugin>
256                         </sensor>
257                 </gazebo>
258         </xacro:macro>
259
260         <xacro:range_sensor name="sonar_forward" ros_topic="range_forward" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
261         <xacro:range_sensor name="sonar_backward" ros_topic="range_backward" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
262         <xacro:range_sensor name="ir_left" ros_topic="range_left" update_rate="10" minRange="0.04" maxRange="0.3" fov="${5*PI/180}" radiation="infrared" />
263         <xacro:range_sensor name="ir_right" ros_topic="range_right" update_rate="10" minRange="0.04" maxRange="0.3" fov="${5*PI/180}" radiation="infrared" />
264 </robot>