# How to get the Acceleration of a Joint

Hi folks,

I have a robotic arm in Gazebo from which I am already reading the angles (i.e. GetAngle(0).Radian()) as well as the velocity (i.e. GetVelocity(0)) from each joint. Now I also need to get the acceleration from the joints.

So far I haven't come across a way to achieve this. Do you have any ideas?

Cheers, Dennis

edit retag close merge delete

Sort by » oldest newest most voted

The acceleration is the derivative of the velocity and the velocity is the derivative of the position/angle. You can just create a small class, that keeps in memory the previous (or many previous) angle/velocity and get the acceleration from that. Typically, if you get the velocity of your joint at each iteration i, then the acceleration would be something like:

accelaration[i] = (velocity[i-1] - velocity[i]) / (time[i-1] - time[i])


This is not perfectly exact since we should use:

accelaration[i] = (velocity[i-1] - velocity[i+1]) / (time[i-1] - time[i+1])


But since we can't predict the future, it should give you good aproximation. An other way would be to use the force sum on your joint and compute the formula F = m.a but this requires much more knowledge and is too cumbersome. `

more