Home | Tutorials | Wiki | Issues
Ask Your Question
0

Can't get my URDF RC Car to work properly. Always Explodes!!

asked 2018-01-30 20:37:31 -0500

timallenyi111 gravatar image

I am trying to get an RC car working in gazebo that I designed myself. The problem is that when I launch the URDF in Gazebo, it either explodes immediately, or will explode if I try to move a joint too far. I have tried turning off self collision, increasing the masses and inertias, messed around with my PID values, but nothing seems to help.

Below is a copy of the URDF that I am using along with some pictures taken from RVIZ of the model.

Any help on this would be greatly appreciated, I have been working on this for 3 days and can't seem to track down the issue.

image description

image description

image description

  <?xml version="1.0"?>

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

<gazebo>
  <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/d8t</robotNamespace>
    <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
  </plugin>
</gazebo>

<material name="gray">
   <color rgba="0.4078 0.4078 0.4078 1"/>
</material>

<material name="green">
   <color rgba="0 1 0 1"/>
</material>

<material name="red">
   <color rgba="1 0 0 1"/>
</material>

<gazebo reference="main_frame_1">
  <selfCollide>false</selfCollide>
</gazebo>

<link name="main_frame_1">
  <inertial>
     <origin rpy="0 0 0" xyz="-0.0003 0.0207 0.00636"/>
     <mass value="0.23744142441441"/>
     <inertia ixx="0.0002244733" ixy="2.2633E-06" ixz="3.6E-09" iyy="2.77876E-05" iyz="-5.8616E-06" izz="0.0002322028"/>
  </inertial>

   <visual>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/main_frame.stl"/>
      </geometry>
      <material name="gray"/>
   </visual>

   <collision>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/main_frame.stl"/>
      </geometry>
   </collision>
</link>

<gazebo reference="steering_knuckle_2">
  <selfCollide>false</selfCollide>
</gazebo>

<link name="steering_knuckle_2">
   <inertial>
     <origin rpy="0 0 0" xyz="0.00023 0.00249 -0.00237"/>
     <mass value="0.00131088136152897"/>
     <inertia ixx="1.03E-08" ixy="-1.4E-09" ixz="-6E-10" iyy="9.7E-09" iyz="-1.8E-09" izz="1.46E-08"/>
   </inertial>

   <visual>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/steering_knuckle.stl"/>
      </geometry>
      <material name="green"/>
   </visual>

   <collision>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/steering_knuckle.stl"/>
      </geometry>
   </collision>
</link>

<gazebo reference="front_wheel_1">
  <selfCollide>false</selfCollide>
</gazebo>

<link name="front_wheel_1">
   <inertial>
     <origin rpy="0 0 0" xyz="0 0 -0.00853"/>
     <mass value="0.00503220031033372"/>
     <inertia ixx="7.13E-07" ixy="0" ixz="0" iyy="4.358E-07" iyz="0" izz="4.358E-07"/>
   </inertial>

   <visual>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/front_wheel.stl"/>
      </geometry>
      <material name="red"/>
   </visual>

   <collision>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/front_wheel.stl"/>
      </geometry>
   </collision>
</link>

<gazebo reference="steerin_knuckle_LH_1">
  <selfCollide>false</selfCollide>
</gazebo>

<link name="steerin_knuckle_LH_1">
   <inertial>
     <origin rpy="0 0 0" xyz="0.00249 0.00023 -0.00237"/>
     <mass value="0.00131088563177186"/>
     <inertia ixx="1.03E-08" ixy="1.4E-09" ixz="6E-10" iyy="9.6E-09" iyz="-1.8E-09" izz="1.46E-08"/>
   </inertial>

   <visual>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/steerin_knuckle_LH.stl"/>
      </geometry>
      <material name="green"/>
   </visual>

   <collision>
      <geometry>
         <mesh filename="package://inv_rc_car/meshes/steerin_knuckle_LH.stl"/>
      </geometry>
   </collision>
</link>

<gazebo reference="front_wheel_2">
  <selfCollide>false</selfCollide>
</gazebo>

<link name="front_wheel_2">
   <inertial>
     <origin rpy="0 0 0" xyz="0 0 -0.00853"/>
     <mass value="0.00503220031033372"/>
     <inertia ixx="7.129E-07" ixy="-1.9E-09" ixz="1E-10" iyy="4.358E-07" iyz="0 ...
(more)
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2018-01-31 11:24:50 -0500

Some debugging tips:

  • Remove your plugin to make sure only the physics is acting on your robot
  • Start Gazebo paused
  • View -> Collisions: verify their size looks reasonably close to size of the links
  • View -> Center of mass: check that it is within the links
  • View -> Inertia: the pink boxes also should be close to the size of the link (assuming uniform density)
  • View -> Contacts: step through the simulation and notice the blue dots representing contacts, they show you where forces are being applied and pushing your robot into explosion

Hope that helps :)

edit flag offensive delete link more
1

answered 2018-02-01 20:50:49 -0500

timallenyi111 gravatar image

Thank you both for your help!!! After following both of your tips, I was able to track down my problem.

When I stepped through the simulation 1 step at a time (I didn't even know I could do that), I found that when the simulation started the model would drop about 0.05 m. When the model hit the ground, the joints flexed and the controllers completely dis-membered it. I finally found that my inertias were exactly 1000 times too small.

I exported this URDF from a program that I have recently developed to convert Autodesk Inventor Assemblies to URDF files, so I obviously need to check my inertial units

When I first viewed the inertias, they all looked fine because the boxed were roughly the same size as my links. However, after reviewing the Gazebo "Inertial parameters of triangle meshes" tutorial, I found that the inertia box should only be roughly the same size as the link when the mass was set to 1. When I changed my masses to 1, the inertia boxes were tiny. I then started increasing my inertias by a factor of 10 until they were perfect, and then changed my masses back to their respective value.

After doing that, the controllers started working perfectly, and the robot hasn't exploded yet.

edit flag offensive delete link more

Comments

Sweet, go ahead an accept your own answer for others who might have the same problem!

josephcoombe gravatar imagejosephcoombe ( 2018-02-02 12:43:15 -0500 )edit
0

answered 2018-02-01 09:09:24 -0500

updated 2018-02-01 09:25:06 -0500

I've had this happen before - though I can't remember exactly what the cause was.

Some additional things you can do to debug:

  • Start gazebo in paused mode, then advance the simulation in single time steps. This will let you see what is causing the model to fly apart.
  • Build and simulate your model in incremental steps - this will allow your zero in on the troublesome link/joint.

Two additional things you can do (together):

  • Add damping and friction to the moving joints in your URDF.

Example:

<joint name="my_joint" type="revolute">   
  <dynamics damping="0.3" friction="0.1">  
</joint>

  • Enable implicit damping on the moving joints in your URDF - this tells Gazebo to apply the <dynamics damping... value you set using a more numerically stable method.

Example:

  <gazebo reference="my_joint">
    <implicitSpringDamper>True</implicitSpringDamper>
  </gazebo>
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-01-30 20:37:31 -0500

Seen: 286 times

Last updated: Feb 01