Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Self balancing robot problem in simulation

Hi to everyone, I’m trying to simulate a self balancing robot, and what I would like to do is take the controller that I create for the simulated robot and use it with just few modification on the real one. Now I think that for this kind of robot the parameters have to be as close as possible to the real one in order to get the correct dynamics. The real robot is 3D printed so for what concern dimensions of the parts, the parameter are close enough to the real one, also the weight should be close enough, the problem is about inertia matrix, motor parameters and frictions. Inertia matrix I’ve looked for the instruction that I’ve found here:

so the steps are:

  1. load the .stl file
  2. clear duplicated faces and vertex
  3. scale of 0.001 (cause the unit of meshlab is m I guess while in freecad is mm)
  4. computer the geometric filter so I get the Volume
  5. The inertial matrix I get is a 0 matrix, so I execute the instructions of “Scaling to increase numerical precision” and “Rescaling the moment of inertia values” paragraphs
  6. I didn’t checked if the matrix is positive definite and if its diagonal satisfy the triangle inequality.

So after all these steps I think and hope that the Inertial matrix are close to the real one

Motor parameters:

  1. The motor is a real cheap one so it doesn’t have any datasheet for parameters
  2. The holding torque should be around 2/3 kg*cm or 0.2/0.3 Nm (I found that through experimental tests)
  3. The maximum velocity should be around 100rpm
  4. about the joint of the motor I’ve set the effort to 0.2 and the velocity to 210

I’ll add the link of banggood where I bought the motor just in case someone has the same and can help me setting the parameters for this kind of motor that I use quite often


  1. The wheels are in rubber so I’ve used a friction of 0.8 for mu1 and mu2
  2. The friction and the damping of the motor’s joint I’ve no idea of what insert.

Now the problem is that the moviment is really strange, and I think is fault of the effort of the motor and of inertia.

  1. If I increase the effort to 1 and then load the model, I notice that when the robot touch the ground literally start bouncing (I don’t have the same problem when the effort is around 0.3)
  2. Keeping the effort to 0.3 and putting the robot upside down, and imposing a position of let’s say 1rad the robot fall and this isn’t normal at all.

Here you can find my ros folder with the xacro file:

In the stl folder there are all the stl file I’ve used to calculate the inertial matrix with meshlab and the unit is mm so they need to be scaled.

Any help or suggestion would be really appreciated, thanks a lot :)