Gazebo | Ignition | Community
Ask Your Question
0

Differential driven robot warping when driving forward and stuttering when driving backwards

asked 2015-09-17 09:26:54 -0500

F4B1 gravatar image

updated 2015-09-17 09:51:29 -0500

Hi everybody,

I'm modelling a differential driven robot and have two problems.

image description

image description

My first problem: The robot turns a bit right or left when I want to drive forward.

Made this short Video for explanation.

I tried to fix it by setting the wheels stiffness, damping, friction, maxVel and minDepth to different values but didn't get it working correctly.

This are my xxx.urdf.xacro files:

body.urdf.xacro:

<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

  <!-- The body macro that is also used to generate the tail -->
  <xacro:macro name="body" params="name parent length width height mass off_x off_y off_z role pitch yaw type full_joint material Gmaterial mu1 mu2 kp kd">

    <!-- if -->
    <xacro:if value="${full_joint}">
      <joint name="${parent}_to_${name}" type="${type}">
        <parent link="${parent}"/>
        <child link="${name}_body_link"/>
        <origin rpy= "${role} ${pitch} ${yaw}" xyz="${off_x} ${off_y} ${off_z}"/>
      </joint>
    </xacro:if>

    <!-- else -->
    <xacro:unless value="${full_joint}">
      <joint name="${parent}_to_${name}" type="${type}">
        <parent link="${parent}"/>
        <child link="${name}_body_link"/>
      </joint>
    </xacro:unless>

    <link name="${name}_body_link">
      <visual>
        <origin xyz="0 0 0"/>
        <geometry>
           <box size="${length} ${width} ${height}"/>
        </geometry>
        <material name="${material}"/>
       </visual>

       <collision>
         <origin xyz="0 0 0"/>
         <geometry>
           <box size="${length} ${width} ${height}"/>
         </geometry>
       </collision>

       <xacro:solid_cuboid_inertial
        width="${length}" depth="${width}"
        height="${height}" mass="${mass}">
        <origin xyz="${off_x} ${off_y} ${off_z}"/>
      </xacro:solid_cuboid_inertial>
    </link>

    <gazebo reference="${name}_body_link">
      <!-- <material>Gazebo/Black</material> -->
      <material>Gazebo/${Gmaterial}</material>
      <mu1>${mu1}</mu1>
      <mu2>${mu2}</mu2>
      <kp>${kp}</kp>
      <kd>${kd}</kd>
    </gazebo>
    <!--
   <gazebo reference="{parent}_to_${name}" >
   </gazebo>
   -->
  </xacro:macro>

  <!-- The sphere macro that is used to simulate the finn -->
  <xacro:macro name="finn" params="name parent reflect radius mass off_x off_y off_z role pitch yaw type material Gmaterial mu1 mu2 kp kd maxVel minDepth fdir1">

    <joint name="${parent}_to_${name}" type="${type}">
      <parent link="${parent}"/>
      <child link="${name}_sphere_link"/>
      <origin rpy= "${role} ${pitch} ${yaw}" xyz="${off_x} ${off_y} ${reflect * off_z}"/>
      <dynamics damping="0.0" friction="0.0"/>
    </joint>

    <link name="${name}_sphere_link">
      <visual>
        <origin xyz="0 0 0"/>
        <geometry>
           <sphere radius="${radius}"/>
        </geometry>
        <material name="${material}"/>
       </visual>

       <collision>
         <origin xyz="0 0 0"/>
         <geometry>
           <sphere radius="${radius}"/>
         </geometry>
       </collision>

       <xacro:sphere_inertial
        radius="${radius}" mass="${mass}">
        <origin xyz="${off_x} ${off_y} ${reflect * off_z}"/>
      </xacro:sphere_inertial>
    </link>

    <gazebo reference="${name}_sphere_link">
      <!-- <material>Gazebo/Black</material> -->
      <material>Gazebo/${Gmaterial}</material>
      <mu1>${mu1}</mu1>
      <mu2>${mu2}</mu2>
      <kp>${kp}</kp>
      <kd>${kd}</kd>
      <maxVel>${maxVel}</maxVel>
      <minDepth>${minDepth}</minDepth>
      <fdir1>${fdir1}</fdir1>
    </gazebo>

    <gazebo reference="{parent}_to_${name}" >
      <kp>${kp}</kp>
      <kd>${kd}</kd>
    </gazebo>

  </xacro:macro>


  <!-- Definitions of all single parts -->
  <xacro:body
       name="main"
       parent="base_link"
       length="0.14"
       width="0.22"
       height="0.09"
       mass="1.709"
       off_x="0"
       off_y="0"
       off_z="0"
        role="0"
        pitch="0"
        yaw="0"
       type="fixed"
       full_joint="false"
       material="body_mat"
       Gmaterial="Black"
        mu1="0.5"
        mu2="50.0"
        kp="100000000.0"
        kd="1.0"
 />

  <!-- off_x = half body + half tail-->
  <xacro:body
       name="tail"
       parent="main_body_link"
       length="0.22"
       width="0.10"
       height="0.02"
       mass="0.242"
       off_x="${-0.11-0.07}"
       off_y ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-09-18 09:35:36 -0500

F4B1 gravatar image

We found the solution:

I made a mistake when I set the origin of the body's and wheel's inertial. I set it to the same offset as I set in the joints but the origin of the inertial is its joint. As it is for the visual and collision. Now I set the origin of each interial to xyz="0 0 0".

In addition we added the axis parameter to the finn's joints and set it to xyz="1 1 1" together with a modification of the joint-type to continuous.

Cheers, F4B1

edit flag offensive delete link more
0

answered 2015-09-18 02:49:23 -0500

Stefan Kohlbrecher gravatar image

updated 2015-09-18 02:50:32 -0500

It seems weird that your small spheres appear to have friction. If you set mu1 and mu2 to 0 you should get perfectly frictionless, sliding behavior. Have you checked that your generated URDF has the values set correctly (and that there is no bug in the xacro macros)?

That being said, there are issues when trying to tune diff drive systems (see here or here). Especially the fdir1 parameter seems to be a little bit mysterious, so you might want to get rid of that one.

I just recently implemented a plugin that applies forces directly to a robot body and otherwise lets the robot "slide" over the environment by setting mu1 and mu2 to 0 for links in contact with the ground. This avoids friction tuning issues and works well for many applications. See video.

edit flag offensive delete link more

Comments

Hi Stefan, the spheres (called finn's in the model) have mu1 and mu2 = 0. If i drive slowly backwards they slide over the ground but if I start driving backwards a bit faster the tail goes up into the air, drops back and the sphere (finn) hits the ground. At this point, the robot stutter and the tail get's thrown up into the air. My video shows that. It's like a ball hitting a soft ground but I want a really hard ball hitting a hard ground. Like stone on stone.

F4B1 gravatar imageF4B1 ( 2015-09-18 03:39:05 -0500 )edit

I implemented the fdir1 parameter in the hope it could maybe fix my problem but it changed nothing and after your answer I will kick it out. Or should I set it to "0 0 0" ?

F4B1 gravatar imageF4B1 ( 2015-09-18 04:01:05 -0500 )edit

Your plugin looks great but we want to play around with different friction, mass, motor-power, etc. later on so I'm not sure if your plugin would help or not in this case.

F4B1 gravatar imageF4B1 ( 2015-09-18 04:26:05 -0500 )edit

Ok, you might want to play around with the other params then. It seems like your model is too bouncy (kd, kp and possibly others).

Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2015-09-18 09:06:33 -0500 )edit

Question Tools

Stats

Asked: 2015-09-17 09:26:54 -0500

Seen: 1,592 times

Last updated: Sep 18 '15