fix some urdf inertias
[ros_wild_thumper.git] / urdf / wild_thumper.urdf.xacro
index cf2c67240b9edfe7806f2ac61bb31149f23216da..fd005afa5d7308fe564d8ab3d91d2489abc88414 100644 (file)
@@ -1,33 +1,45 @@
 <?xml version="1.0"?>
 <robot name="wild_thumper" xmlns:xacro="http://ros.org/wiki/xacro">
        <xacro:property name="PI" value="3.1415926535897931" />
-       <xacro:include filename="$(find hector_sensors_description)/urdf/asus_camera.urdf.xacro" />
+
+       <material name="wtgrey">
+               <color rgba="0.5 0.5 0.5 0.5"/>
+       </material>
+       <material name="wtred">
+               <color rgba="1 0 0 1"/>
+       </material>
+       <material name="wtblack">
+               <color rgba="0 0 0 1"/>
+       </material>
+       <material name="wtgreen">
+               <color rgba="0 1 0 0.8"/>
+       </material>
 
        <link name="base_footprint">
                <visual>
                        <geometry>
-                               <box size="0.28 0.31 0.0"/>
+                               <box size="0.28 0.31 0.000001"/>
                        </geometry>
-                       <material name="grey">
-                               <color rgba="0.5 0.5 0.5 0.5"/>
-                       </material>
+                       <material name="wtgrey"/>
                </visual>
        </link>
 
        <link name="base_link">
                <collision>
                        <geometry>
-                               <box size="0.23 0.18 0.09"/>
+                               <box size="0.23 0.12 0.09"/>
                        </geometry>
                </collision>
                <visual>
+                       <origin xyz="-0.00275 0 0" rpy="0 0 0"/>
                        <geometry>
                                <mesh filename="package://wild_thumper/meshes/wild_thumper_4wd.stl" />
                        </geometry>
                </visual>
                <inertial>
-                       <mass value="1.9"/>
-                       <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
+                       <origin xyz="-0.00275 0 0" rpy="0 0 0"/>
+                       <mass value="2.5"/>
+                       <inertia izz="0.014021" ixy="0.0" ixz="0.0" iyy="0.012708" iyz="0.0" ixx="0.0046875"/>
                </inertial>
        </link>
 
@@ -36,9 +48,7 @@
                        <geometry>
                                <box size="0.041 0.028 0.002"/>
                        </geometry>
-                       <material name="red">
-                               <color rgba="1 0 0 1"/>
-                       </material>
+                       <material name="wtred"/>
                </visual>
        </link>
 
                </visual>
        </link>
 
-       <xacro:asus_camera name="camera" parent="mounting_plate">
-               <origin xyz="0.107 0.0 0.04" rpy="0 0 0"/>
-       </xacro:asus_camera>
+       <link name="lidar">
+               <visual>
+                       <geometry>
+                               <mesh filename="package://wild_thumper/meshes/rplidar_a2.stl" scale="0.001 0.001 0.001"/>
+                       </geometry>
+                       <origin xyz="0.0 0.0 0" rpy="0 0 0"/>
+                       <material name="wtblack"/>
+               </visual>
+       </link>
 
-       <link name="sonar_forward">
+       <link name="sonar_forward_left">
                <visual>
                        <geometry>
                                <box size="0.016 0.044 0.02"/>
                        </geometry>
                        <origin xyz="${0.016/2} 0 0" rpy="0 0 0"/>
-                       <material name="green">
-                               <color rgba="0 1 0 0.8"/>
-                       </material>
+                       <material name="wtgreen"/>
                </visual>
        </link>
 
-       <link name="sonar_backward">
+       <link name="sonar_forward_right">
                <visual>
                        <geometry>
                                <box size="0.016 0.044 0.02"/>
                        </geometry>
                        <origin xyz="${0.016/2} 0 0" rpy="0 0 0"/>
-                       <material name="green">
-                               <color rgba="0 1 0 0.8"/>
-                       </material>
+                       <material name="wtgreen"/>
                </visual>
        </link>
 
-       <link name="ir_left">
+       <link name="sonar_backward">
                <visual>
                        <geometry>
-                               <box size="0.015 0.015 0.046"/>
+                               <box size="0.016 0.044 0.02"/>
                        </geometry>
-                       <origin xyz="${-0.015/2} 0 0" rpy="0 0 0"/>
-                       <material name="black">
-                               <color rgba="0 0 0 1"/>
-                       </material>
+                       <origin xyz="${0.016/2} 0 0" rpy="0 0 0"/>
+                       <material name="wtgreen"/>
                </visual>
        </link>
 
-       <link name="ir_right">
+       <link name="antenna">
                <visual>
                        <geometry>
-                               <box size="0.015 0.015 0.046"/>
+                               <cylinder radius="0.006" length="0.165"/>
                        </geometry>
-                       <origin xyz="${-0.015/2} 0 0" rpy="0 0 0"/>
-                       <material name="black">
-                               <color rgba="0 0 0 1"/>
-                       </material>
+                       <origin xyz="0 0 0.0825" rpy="0 0 0"/>
+                       <material name="wtblack"/>
                </visual>
+               <collision>
+                       <geometry>
+                               <cylinder radius="0.008" length="0.17"/>
+                       </geometry>
+                       <origin xyz="0 0 0.085" rpy="0 0 0"/>
+               </collision>
        </link>
 
        <joint name="base_link_joint" type="fixed">
                <origin xyz="0.06 -0.03 0.058" rpy="0 0 0"/>
        </joint>
 
-       <joint name="sonar_forward_joint" type="fixed">
+       <joint name="sonar_forward_left_joint" type="fixed">
+               <parent link="mounting_plate"/>
+               <child link="sonar_forward_left"/>
+               <origin xyz="0.115 0.05 -0.012" rpy="0 ${-5*PI/180} 0"/>
+       </joint>
+
+       <joint name="sonar_forward_right_joint" type="fixed">
                <parent link="mounting_plate"/>
-               <child link="sonar_forward"/>
-               <origin xyz="0.115 0.0 -0.012" rpy="0 0 0"/>
+               <child link="sonar_forward_right"/>
+               <origin xyz="0.115 -0.05 -0.012" rpy="0 ${-5*PI/180} 0"/>
        </joint>
 
        <joint name="sonar_backward_joint" type="fixed">
                <parent link="mounting_plate"/>
                <child link="sonar_backward"/>
-               <origin xyz="-0.115 0.0 -0.012" rpy="0 ${PI} 0"/>
+               <origin xyz="-0.115 0.0 -0.012" rpy="0 ${-175*PI/180} 0"/>
        </joint>
 
-       <joint name="ir_left_joint" type="fixed">
+       <joint name="antenna_joint" type="fixed">
                <parent link="mounting_plate"/>
-               <child link="ir_left"/>
-               <origin xyz="0.0 ${0.072+0.015} -0.045" rpy="0 0 ${PI/2}"/>
+               <child link="antenna"/>
+               <origin xyz="0.011 0.05 0" rpy="0 0 0"/>
        </joint>
 
-       <joint name="ir_right_joint" type="fixed">
+       <joint name="lidar_joint" type="fixed">
                <parent link="mounting_plate"/>
-               <child link="ir_right"/>
-               <origin xyz="0.0 ${-0.072-0.015} -0.045" rpy="0 0 ${-PI/2}"/>
+               <child link="lidar"/>
+               <origin xyz="0.075 0.01 ${0.0408/2}" rpy="0 0 ${-110*PI/180}"/>
        </joint>
 
        <xacro:macro name="wheel" params="pos side xyz rpy">   
                                </geometry>
                        </visual>
                        <collision>
-                               <origin xyz="0 0 0" rpy="${-PI/2} 0 0"/>
+                               <origin xyz="0 0 0" rpy="${PI/2} 0 0"/>
                                <geometry>
                                        <cylinder radius="0.06" length="0.06"/>
                                </geometry>
                        </collision>
                        <inertial>
                                <origin xyz="0 0 0" rpy="0 0 0"/>
-                               <mass value="0.1"/>
-                               <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
+                               <mass value="0.2"/>
+                               <inertia ixx="0.00024" ixy="0" ixz="0" iyy="0.00036" iyz="0" izz="0.00024"/>
                        </inertial>
                </link>
+
+               <gazebo reference="${pos}_${side}_wheel">
+                       <mu1 value="1.0"/>
+                       <mu2 value="0.2"/>
+                       <kp value="1000000000000.0" />
+                       <kd value="1.0" />
+                       <fdir1 value="0 1 0"/>
+                       <minDepth>0.005</minDepth>
+               </gazebo>
+
                <joint name="${pos}_${side}_wheel_joint" type="continuous">
                        <parent link="base_link"/>
                        <child link="${pos}_${side}_wheel"/>
                        <axis xyz="0 1 0"/>
                        <origin xyz="${xyz}" rpy="${rpy}"/>
                </joint>
-       </xacro:macro>
 
-       <gazebo reference="front_left_wheel">
-               <dampingFactor>0.001</dampingFactor>
-       </gazebo>
-       <gazebo reference="front_right_wheel">
-               <dampingFactor>0.001</dampingFactor>
-       </gazebo>
+               <transmission name="${pos}_${side}_wheel_trans" type="SimpleTransmission">
+                       <type>transmission_interface/SimpleTransmission</type>
+                       <joint name="${pos}_${side}_wheel_joint">
+                               <hardwareInterface>VelocityJointInterface</hardwareInterface>
+                       </joint>
+                       <actuator name="{pos}_${side}_wheel_motor">
+                               <mechanicalReduction>1</mechanicalReduction>
+                       </actuator>
+               </transmission>
+       </xacro:macro>
 
-       <xacro:wheel pos="aft" side="left"  xyz="-0.06398 0.11407 -0.022446" rpy="0 0 0" />
-       <xacro:wheel pos="aft" side="right" xyz="-0.07397 -0.11408 -0.022446" rpy="0 0 0" />
-       <xacro:wheel pos="front" side="left"  xyz="0.07602 0.11407 -0.022446" rpy="0 0 0" />
-       <xacro:wheel pos="front" side="right" xyz="0.07397 -0.11408 -0.022446" rpy="0 0 0" />
+       <xacro:wheel pos="rear" side="left"   xyz="-0.07525  0.12 -0.025" rpy="${-5*PI/180} 0 0" />
+       <xacro:wheel pos="rear" side="right"  xyz="-0.07525 -0.12 -0.025" rpy="${5*PI/180} 0 0" />
+       <xacro:wheel pos="front" side="left"  xyz=" 0.07525  0.12 -0.025" rpy="${-5*PI/180} 0 0" />
+       <xacro:wheel pos="front" side="right" xyz=" 0.07525 -0.12 -0.025" rpy="${5*PI/180} 0 0" />
 
        <gazebo>
-               <plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so">
+               <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
                        <robotNamespace>/</robotNamespace>
-                       <jointName>aft_left_wheel_joint, aft_right_wheel_joint, front_left_wheel_joint, front_right_wheel_joint</jointName>
-                       <updateRate>10.0</updateRate>
-                       <alwaysOn>true</alwaysOn>
+                       <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
                </plugin>
 
-               <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
-                       <robotNamespace>/</robotNamespace>
+               <plugin name="imu_controller" filename="libgazebo_ros_imu.so">
                        <alwaysOn>true</alwaysOn>
-                       <updateRate>10.0</updateRate>
-                       <leftJoint>aft_right_wheel_joint</leftJoint>
-                       <rightJoint>aft_left_wheel_joint</rightJoint>
-                       <wheelSeparation>0.252</wheelSeparation>
-                       <wheelDiameter>0.12</wheelDiameter>
-                       <wheelTorque>5.0</wheelTorque>
-                       <commandTopic>cmd_vel</commandTopic>
-                       <odometryTopic>odom</odometryTopic>
-                       <odometryFrame>odom</odometryFrame>
-                       <robotBaseFrame>base_footprint</robotBaseFrame>
-                       <rosDebugLevel>Info</rosDebugLevel>
-                       <publishWheelTF>false</publishWheelTF>
-                       <publishWheelJointState>true</publishWheelJointState>
-                       <wheelAcceleration>0.0</wheelAcceleration>
-                       <odometrySource>world</odometrySource>
-                       <publishTf>true</publishTf>
+                       <updateRate>20.0</updateRate>
+                       <bodyName>base_imu_link</bodyName>
+                       <topicName>imu</topicName>
+                       <gaussianNoise>0.05</gaussianNoise>
+                       <frameName>base_imu_link</frameName>
+                       <xyzOffsets>0 0 0</xyzOffsets>
+                       <rpyOffset>0 0 0</rpyOffset>
+                       <serviceName>/default_imu</serviceName>
                </plugin>
        </gazebo>
+
+       <xacro:macro name="range_sensor" params="name ros_topic update_rate minRange maxRange fov radiation">
+               <gazebo reference="${name}">
+                       <sensor type="ray" name="${name}_sensor">
+                               <pose>0 0 0 0 0 0</pose>
+                               <update_rate>${update_rate}</update_rate>
+                               <visualize>false</visualize>
+                               <ray>
+                                       <scan>
+                                               <horizontal>
+                                                       <samples>5</samples>
+                                                       <resolution>1</resolution>
+                                                       <min_angle>-${fov/2}</min_angle>
+                                                       <max_angle>${fov/2}</max_angle>
+                                               </horizontal>
+                                               <vertical>
+                                                       <samples>5</samples>
+                                                       <resolution>1</resolution>
+                                                       <min_angle>-${fov/2}</min_angle>
+                                                       <max_angle>${fov/2}</max_angle>
+                                               </vertical>
+                                       </scan>
+                                       <range>
+                                               <min>${minRange}</min>
+                                               <max>${maxRange}</max>
+                                               <resolution>0.01</resolution>
+                                       </range>
+                               </ray>
+                               <plugin filename="libgazebo_ros_range.so" name="gazebo_ros_range">
+                                       <gaussianNoise>0.005</gaussianNoise>
+                                       <alwaysOn>true</alwaysOn>
+                                       <updateRate>${update_rate}</updateRate>
+                                       <topicName>${ros_topic}</topicName>
+                                       <frameName>${name}</frameName>
+                                       <fov>${fov}</fov>
+                                       <radiation>${radiation}</radiation>
+                               </plugin>
+                       </sensor>
+               </gazebo>
+       </xacro:macro>
+
+       <xacro:range_sensor name="sonar_forward_left" ros_topic="range_forward_left" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
+       <xacro:range_sensor name="sonar_forward_right" ros_topic="range_forward_right" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
+       <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" />
+
+       <gazebo reference="lidar">
+               <sensor type="ray" name="head_rplidar_a2_sensor">
+                       <pose>0 0 0 0 0 0</pose>
+                       <visualize>false</visualize>
+                       <update_rate>12</update_rate>
+                       <ray>
+                               <scan>
+                                       <horizontal>
+                                               <samples>360</samples>
+                                               <resolution>1</resolution>
+                                               <min_angle>-3.12413907051</min_angle>
+                                               <max_angle>3.14159274101</max_angle>
+                                       </horizontal>
+                               </scan>
+                               <range>
+                                       <min>0.20</min>
+                                       <max>16.0</max>
+                                       <resolution>0.01</resolution>
+                               </range>
+                               <noise>
+                                       <type>gaussian</type>
+                                       <mean>0.0</mean>
+                                       <stddev>0.01</stddev>
+                               </noise>
+                       </ray>
+                       <plugin name="gazebo_ros_head_rplidar_a2_controller" filename="libgazebo_ros_laser.so">
+                               <topicName>/scan</topicName>
+                               <frameName>lidar</frameName>
+                       </plugin>
+               </sensor>
+       </gazebo>
 </robot>