Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

URDF model always slipping/ rotating

Hi guys,

I am using a modified version of turtlebot3 and tried to make a quiet simple model in gazebo but when opening it in gazebo its always slipping and/or rotating a bit.

I first tried to have two caster wheels (which is how it really looks though) but decided to first try it with one.. cause that is hard enough for the beginnging.

I hope somebody can help me with this!

Here is my urdf:

<?xml version="1.0" ?>

<robot name="turtlebot3_waffle_pi" xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:include filename="$(find turtlebot3_description)/urdf/common_properties.xacro"/> <xacro:include filename="$(find turtlebot3_description)/urdf/turtlebot3_waffle_pi.gazebo.xacro"/>

<link name="base_footprint"/>

<joint name="base_joint" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0 0 0" rpy="0 0 0"/> </joint>

<link name="base_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.52 0.50 1.20"/> </geometry> <material name="light_black"/> </visual>

<collision>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <box size="0.52 0.50 1.20"/>
  </geometry>
</collision>

<inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <mass value="20.00e+00"/>
  <inertia ixx="3" ixy="0" ixz="0"
           iyy="2.82" iyz="0"
           izz="0.83" />
</inertial>

</link>

<joint name="sonar_bottom_right_joint" type="fixed"> <parent link="base_link"/> <child link="sonar_bottom_right_link"/> <origin xyz="0.26 -0.16 -0.51" rpy="0 0 0"/> </joint>

<link name="sonar_bottom_right_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.005 0.05 0.05"/> </geometry> <material name="blue"/> </visual>

<collision>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <box size="0.005 0.05 0.05"/>
  </geometry>
</collision>

<inertial>
  <origin xyz="0 0 0" />
  <mass value="1.8498940e-02" />
  <inertia ixx="0.1175580e-05" ixy="-3.2369783e-11" ixz="-4.9381719e-09"
           iyy="0.1192413e-05" iyz="-0.4400107e-11"
           izz="0.0712558e-05" />
  </inertial>

</link>

<joint name="sonar_bottom_left_joint" type="fixed"> <parent link="base_link"/> <child link="sonar_bottom_left_link"/> <origin xyz="0.26 0.16 -0.51" rpy="0 0 0"/> </joint>

<link name="sonar_bottom_left_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.005 0.05 0.05"/> </geometry> <material name="blue"/> </visual>

<collision>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <box size="0.005 0.05 0.05"/>
  </geometry>
</collision>

<inertial>
  <origin xyz="0 0 0" />
  <mass value="1.8498940e-02" />
  <inertia ixx="0.1175580e-05" ixy="-3.2369783e-11" ixz="-4.9381719e-09"
           iyy="0.1192413e-05" iyz="-0.4400107e-11"
           izz="0.0712558e-05" />
  </inertial>

</link>

<joint name="wheel_left_joint" type="continuous"> <parent link="base_link"/> <child link="wheel_left_link"/> <origin xyz="0.26 0.2215 -0.5835" rpy="-1.57 0 0"/> <axis xyz="0 0 1"/> </joint>

<link name="wheel_left_link"> <visual> <origin xyz="0 0 0" rpy="1.57 0 0"/> <geometry> <mesh filename="package://turtlebot3_description/meshes/wheels/left_tire.stl" scale="0.001 0.001 0.001"/> </geometry> <material name="dark"/> </visual>

<collision>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <cylinder length="0.018" radius="0.033"/>
  </geometry>
</collision>

<inertial>
  <origin xyz="0 0 0" />
  <mass value="2.8498940e-02" />
  <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
           iyy="1.1192413e-05" iyz="-1.4400107e-11"
           izz="2.0712558e-05" />
  </inertial>

</link>

<joint name="wheel_right_joint" type="continuous"> <parent link="base_link"/> <child link="wheel_right_link"/> <origin xyz="0.26 -0.2215 -0.5835" rpy="-1.57 0 0"/> <axis xyz="0 0 1"/> </joint>

<link name="wheel_right_link"> <visual> <origin xyz="0 0 0" rpy="1.57 0 0"/> <geometry> <mesh filename="package://turtlebot3_description/meshes/wheels/right_tire.stl" scale="0.001 0.001 0.001"/> </geometry> <material name="dark"/> </visual>

<collision>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <cylinder length="0.018" radius="0.033"/>
  </geometry>
</collision>

<inertial>
  <origin xyz="0 0 0" />
  <mass value="2.8498940e-02" />
  <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
           iyy="1.1192413e-05" iyz="-1.4400107e-11"
           izz="2.0712558e-05" />
  </inertial>

</link>

<joint name="caster_back_joint" type="fixed"> <parent link="base_link"/> <child link="caster_back_link"/> <origin xyz="-0.26 0 -0.5835" rpy="0 0 0"/> <axis xyz="0 0 1"/> </joint>

<link name="caster_back_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <sphere radius="0.033"/> </geometry> <material name="dark"/> </visual>

<collision>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <sphere radius="0.033"/>
  </geometry>
</collision>

<inertial>
  <origin xyz="0 0 0" />
  <mass value="2.8498940e-02" />
  <inertia ixx="0.001" ixy="0.0" ixz="0.0"
           iyy="0.001" iyz="0.0"
           izz="0.001" />
  </inertial>

</link>

<joint name="imu_joint" type="fixed"> <parent link="base_link"/> <child link="imu_link"/> <origin xyz="0.0 0 0.068" rpy="0 0 0"/> </joint>

<link name="imu_link"/>

<joint name="scan_joint" type="fixed"> <parent link="base_link"/> <child link="base_scan"/> <origin xyz="0 0 0.62" rpy="0 0 0"/> </joint>

<link name="base_scan"> <visual> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <mesh filename="package://turtlebot3_description/meshes/sensors/lds.stl" scale="0.001 0.001 0.001"/> </geometry> <material name="dark"/> </visual>

<collision>
  <origin xyz="0.015 0 -0.0065" rpy="0 0 0"/>
  <geometry>
    <cylinder length="0.0315" radius="0.055"/>
  </geometry>
</collision>

<inertial>
  <mass value="0.114" />
  <origin xyz="0 0 0" />
  <inertia ixx="0.001" ixy="0.0" ixz="0.0"
           iyy="0.001" iyz="0.0"
           izz="0.001" />
</inertial>

</link>

</robot>

and my gazebo.xacro for friction:

<?xml version="1.0"?>

<robot name="turtlebot3_waffle_pi_sim" xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:arg name="laser_visual" default="false"/> <xacro:arg name="camera_visual" default="false"/> <xacro:arg name="imu_visual" default="false"/>

<gazebo reference="base_link"> <material>Gazebo/DarkGrey</material> </gazebo>

<gazebo reference="wheel_left_link"> <mu1>0.1</mu1> <mu2>0.1</mu2> <kp>500000.0</kp> <kd>10.0</kd> <mindepth>0.001</mindepth> <maxvel>0.1</maxvel> <fdir1>1 0 0</fdir1> <material>Gazebo/FlatBlack</material> </gazebo>

<gazebo reference="wheel_right_link"> <mu1>0.1</mu1> <mu2>0.1</mu2> <kp>500000.0</kp> <kd>10.0</kd> <mindepth>0.001</mindepth> <maxvel>0.1</maxvel> <fdir1>1 0 0</fdir1> <material>Gazebo/FlatBlack</material> </gazebo>

<gazebo reference="caster_back_link"> <turngravityoff>false</turngravityoff> <mu1>0.1</mu1> <mu2>0.1</mu2> <kp>1000000.0</kp> <kd>100.0</kd> <mindepth>0.001</mindepth> <maxvel>1.0</maxvel> <material>Gazebo/FlatBlack</material> </gazebo>

<gazebo reference="imu_link"> <sensor type="imu" name="imu"> <always_on>true</always_on> <visualize>$(arg imu_visual)</visualize> </sensor> <material>Gazebo/Grey</material> </gazebo>

<gazebo> <plugin name="turtlebot3_waffle_pi_controller" filename="libgazebo_ros_diff_drive.so"> <commandtopic>cmd_vel</commandtopic> <odometrytopic>odom</odometrytopic> <odometryframe>odom</odometryframe> <odometrysource>world</odometrysource> <publishodomtf>true</publishodomtf> <robotbaseframe>base_footprint</robotbaseframe> <publishwheeltf>false</publishwheeltf> <publishtf>true</publishtf> <publishwheeljointstate>true</publishwheeljointstate> <legacymode>false</legacymode> <updaterate>30</updaterate> <leftjoint>wheel_left_joint</leftjoint> <rightjoint>wheel_right_joint</rightjoint> <wheelseparation>0.287</wheelseparation> <wheeldiameter>0.066</wheeldiameter> <wheelacceleration>1</wheelacceleration> <wheeltorque>10</wheeltorque> <rosdebuglevel>na</rosdebuglevel> </plugin> </gazebo>

<gazebo> <plugin name="imu_plugin" filename="libgazebo_ros_imu.so"> <alwayson>true</alwayson> <bodyname>imu_link</bodyname> <framename>imu_link</framename> <topicname>imu</topicname> <servicename>imu_service</servicename> <gaussiannoise>0.0</gaussiannoise> <updaterate>200</updaterate> <imu> <noise> <type>gaussian</type> <rate> <mean>0.0</mean> <stddev>2e-4</stddev> <bias_mean>0.0000075</bias_mean> <bias_stddev>0.0000008</bias_stddev> </rate> <accel> <mean>0.0</mean> <stddev>1.7e-2</stddev> <bias_mean>0.1</bias_mean> <bias_stddev>0.001</bias_stddev> </accel> </noise> </imu> </plugin> </gazebo>

<gazebo reference="base_scan"> <material>Gazebo/FlatBlack</material> <sensor type="ray" name="lds_lfcd_sensor"> <pose>0 0 0 0 0 0</pose> <visualize>$(arg laser_visual)</visualize> <update_rate>5</update_rate> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1</resolution> <min_angle>0.0</min_angle> <max_angle>6.28319</max_angle> </horizontal> </scan> <range> <min>0.120</min> <max>3.5</max> <resolution>0.015</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> <plugin name="gazebo_ros_lds_lfcd_controller" filename="libgazebo_ros_laser.so"> <topicname>scan</topicname> <framename>base_scan</framename> </plugin> </sensor> </gazebo>

</robot>