Home | Tutorials | Wiki | Issues
Ask Your Question
1

4 Wheel Robot wheels unstable. Fix needed.

asked 2019-03-31 05:11:33 -0500

afroRoboticist gravatar image

updated 2019-04-01 11:09:51 -0500

Hi All, I am new here and this is my first question and as a result I can't post images so will do the best I can to explain what I'm experiencing.

Platform Details: Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic ROS Distro: Melodic

I successfully spawned a 4 wheeler in Gazebo and for some reason, every half revolution, this Robot's wheels sink into an imaginary hole in Gazebo's plane. Imagine that you have 4 wheels with a small segment cut off (not enough to make their cross section a semi circle but almost), that's exactly how they behave. What happens is after every half revolution, part of the wheels sink below the ground plane in Gazebo and then literally rise back to the surface. Between revolutions everything is fine by the way.

See my robot URDF below. I have seen a similar question in this link but all it stated was the wheels were perpetually below the ground plane. This is not my case. The Robot behaves as it should in between half revolutions. Note that I have experimented with robot weights and Kp values of the wheels (used a stepwise approach to no avail). Please help. I am at my wits' end. Note that the part of the code that is the wheels is refered to <xacro:macro name="wheel_position_macro" params="prefix suffix reflect1 reflect2">

Thanks in anticipation of your help.

<?xml version = "1.0"?>
<robot name="Rover" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:property name="wheel_thickness" value="0.15"/>
<xacro:property name="wheel_diameter" value="0.4"/>
<xacro:property name="wheel_guide_thickness" value="0.05"/>
<xacro:property name="wheel_guide_length" value="0.4"/>
<xacro:property name="wheel_guide_height" value="0.1"/>
<xacro:property name="body_length" value="0.6"/>
<xacro:property name="body_width" value="0.5"/>
<xacro:property name="body_height" value="0.3"/>
<xacro:property name="camera_width" value="0.01"/>
<xacro:property name="wheel_mass" value="0.5"/>
<xacro:property name="body_mass" value="1"/>
<xacro:property name="guide_mass" value="0.5"/>
<xacro:property name="axel_mass" value="0.5"/>
<xacro:property name="camera_mass" value="0.1"/>
<xacro:property name="kinect_mass" value="0.5"/>
<xacro:property name="pi" value="3.1415"/>

<xacro:macro name="default_inertial" params="mass">
  <inertial>
    <mass value="${mass}"/>
    <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
  </inertial>
</xacro:macro>


<xacro:macro name="shape_visual" params="length width height color">
  <visual>
    <pose xyz="0 0 1.0"/>
    <geometry>
      <box size="${length} ${width} ${height}"/>
    </geometry>
    <material name="${color}"/>
  </visual>
  <collision>
    <geometry>
      <box size="${length} ${width} ${height}"/>
    </geometry>    
  </collision>

</xacro:macro>

<xacro:macro name="camera_visual" params="length width height color">
  <visual>
    <geometry>
      <box size="${length} ${width} ${height}"/>
    </geometry>
    <material name="${color}"/>
  </visual>
  <collision>
    <geometry>
      <box size="${length} ${width} ${height}"/>
    </geometry>    
  </collision>

</xacro:macro>

<xacro:macro name="wheel_guide_macro" params="prefix reflect">
<link name="${prefix}_wheel_guide">
  <visual>
    <origin xyz="0 ${reflect*wheel_guide_thickness/2} 0"/>
    <geometry>
      <box size="${wheel_guide_length} ${wheel_guide_thickness} ${wheel_guide_height}"/>
    </geometry>
    <material ...
(more)
edit retag flag offensive close merge delete

Comments

I took the liberty of formatting your question. FYI, you can use the 101010 button to format code/xml examples.

josephcoombe gravatar imagejosephcoombe ( 2019-04-01 12:14:22 -0500 )edit

Could you post of a video of this behavior?

josephcoombe gravatar imagejosephcoombe ( 2019-04-01 12:22:31 -0500 )edit

I'm a newbie on here @josephcoombe I am not allowed to post images and/or videos. However, Imagine that there were potholes in the ground surface of gazebo, the potholes have a width equal to the width of my wheels and length slightly less than its diameter. 4 of these potholes are aligned perfectly such that when my robot moves forward it sinks into them and gets out and continues like this. That would be an apt description of what's happening. Also thanks for editing my post. Appreciate it

afroRoboticist gravatar imageafroRoboticist ( 2019-04-01 13:19:34 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-04-01 22:46:02 -0500

updated 2019-04-01 22:50:10 -0500

The <visual> and <collision> elements of your wheel links do not line up:

To see this,

  1. Load your model in Gazebo.
  2. Select View > Show collision.
  3. Select View > Transparent.
    (You can learn about the other View options in the Gazebo GUI Tutorial)

image description


Looking at your wheel link macro, the <visual> element is rolled by pi/2 radians but the <collision> element is not...

Broken:

  <xacro:macro name="wheel_position_macro" params="prefix suffix reflect1 reflect2">
    <link name="${prefix}_${suffix}_wheel">
      <visual>
        <origin xyz="0 0 0" rpy="${pi/2} 0 0"/>
        <geometry>
          <cylinder radius="${wheel_diameter/2}" length="${wheel_thickness}"/>
        </geometry>
        <material name="black"/>
      </visual>
      <collision>
        <geometry>
          <cylinder radius="${wheel_diameter/2}" length="${wheel_thickness}"/>
        </geometry>  
        ...
      </collision>
      <xacro:default_inertial mass="${wheel_mass}"/>
    </link>
    ...
  </xacro:macro>

Fixed:

  <xacro:macro name="wheel_position_macro" params="prefix suffix reflect1 reflect2">
    <link name="${prefix}_${suffix}_wheel">
      <visual>
        <origin xyz="0 0 0" rpy="${pi/2} 0 0"/>
        <geometry>
          <cylinder radius="${wheel_diameter/2}" length="${wheel_thickness}"/>
        </geometry>
        <material name="black"/>
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="${pi/2} 0 0"/>
        <geometry>
          <cylinder radius="${wheel_diameter/2}" length="${wheel_thickness}"/>
        </geometry>  
        ...
      </collision>
      <xacro:default_inertial mass="${wheel_mass}"/>
    </link>
    ...
  </xacro:macro>

(You can learn more about URDF XML at http://wiki.ros.org/urdf/XML/link)


One final note:

The inertial values are too high. Check out the Inertial parameters of triangle meshes tutorial.

edit flag offensive delete link more

Comments

1

WOW!!! I did not even need to rerun the simulation to know this was correct. The verdict lined up perfectly with what I was experiencing. I've fixed the collision properties and I AM SHOOK. It actually works. My robot glides along. It is 3am in Georgia and I am celebrating like I just won the world cup. Thank you @josephcoombe I indeed have a lot to learn. Thank you so very much.

afroRoboticist gravatar imageafroRoboticist ( 2019-04-02 02:50:08 -0500 )edit

Hi @josephcombe Please can you tell me how you edited my post to neatly box up the code? I'm struggling to get it done. I had to put in

 tags. These worked but I don't know how to shut them down. I mean I don;t know what tags to use at the end of a block of code to box it off. Thank you. PS" I used the 101010 link up there and for some reason it just is not workin for me. I paste code in the 'enter code here' space and it just goes berzerk. Thank you.

afroRoboticist gravatar imageafroRoboticist ( 2019-04-05 08:46:35 -0500 )edit

Oh wow. I meant '

' '' tags. Thanks.

afroRoboticist gravatar imageafroRoboticist ( 2019-04-05 08:47:15 -0500 )edit

I usually select the code I want to format (make sure there's an empty line both before after code) and then left-click the 101010 button - sometimes you have to do it twice.

josephcoombe gravatar imagejosephcoombe ( 2019-04-09 14:38:41 -0500 )edit
1

@josephcoombe I found another way around it. I found that if you put a "pre" tag before and a "/pre" tag after the code, it formats it appropriately. I haven't enclosed the "pre" in these brackets <> because if I do that, it would proceed to begin formatting what follow it. So basically a pre tag in brackets <> and a /pre tag in brackets at the end <> would format the code properly.

afroRoboticist gravatar imageafroRoboticist ( 2019-04-10 17:22:35 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-03-31 05:11:33 -0500

Seen: 272 times

Last updated: Apr 01