# Physics integration from acceleration to velocity doesn't match

Hi,

I have a SDF defining a AUV. It has several links, with joints of revolute and with 0 limits connecting them. So I can consider my robot one of rigid body. I also set the inertia of the main link with an known value and the others with a near zero mass and inertia. I also have my own dynamic model integrator, where I set the same model as my robot, with the same damping and buoyancy and apply the same efforts (in my case going forward).

Differently of what I expected, both simulations doesn't match. The forces and accelerations are the same (checked on the main link), but the velocities are not even close (I checked all in body frame). To get the velocity on my dynamic model, I integrate the acceleration. But looks like gazebo gets the velocity some other way, which doesn't match the expected.

Anyone knows how gazebo compute the velocities? Does it make the model behavior differently of an acceleration integrator? Is there any embedded damping on gazebo to force the model be stable?

To better explain, here is a graph

I apply a force in a link and plot the resulting force using model->GetLink("my_link")->GetRelativeForce() and the acceleration with model->GetLink("my_link")->GetRelativeLinearAccel(). The mass of the link is 350 kg, and for a 90N force gives a acceleration of ~0.25 m/s².

But for the velocity, displayed at the last graph with model->GetLink("my_link")->GetRelativeLinearVel(), the rate of increase is not what I expected (~2.5 m/s /10s). Gazebo provides a much slower velocity.

Gazebo indeed computes acceleration by dividing the force by the mass. But how it computes the velocity? Should not the acceleration being the derivative of the velocity?

edit retag close merge delete

Sort by » oldest newest most voted

I think I found the problem.

The default physics properties are: max step size = 0.001, real time update rate = 1000 and real time factor = 1. I was expecting it be kept true and I got the above results.

But when I change them to: max step size = 0.01, real time update rate = 100 and keep real time factor = 1, I got the result in the graph below, which seems to be rigth (acceleration of 0.25m/s² and velocity of 1 m/s in 4 seconds).

So my guess is that my pc was not able to perform the 1000 interactions/second (specially with plots and visualization going on). I just need to reduce the amount of interaction/second to make sure my pc can run the simulation respecting the real time factor.

more