first thing first, thank you so much for helping me with this problem.

I am working on a **ROS-C++** Project. Problem:

i have a vector of positions (x, y, z) and a vector of time stamp with 10 times per second sampling(10Hz), from these two vector i need to output:

- A vector of velocities
- A vector of Accelerations
- A vector of Accelerations with gravity component

For the first two requests i did:

*Velocity = dx/dt;*

*Acceleration = dv/dt*

basically the medium Velocity and medium Acceleration.

Where:

dx = Xi – Xi-1;

dt = ti – ti-1

and so on…

I really don’t know if there are other or better solutions than these like if there is a C++ library that makes a function from a vector input and get the instantaneous velocity/acceleration but i am open to new solutions, maybe Alglib…

Now my real problem is considering the Gravity component in the last vector: i have accelerations but i don’t think the solution would be cutting 9.8 from them :’)

I really searched everywhere but all i have are these vectors, i can also get the orientations values (x, y, z, w) but i don’t think they are necessary for this problem?

Source: Windows Questions C++