I'm trying to simulate linear accelerations and angular velocity of a vehicle which drives on a flat surface. For this, I want to use a trajectory consisting of position ($x_i, y_i$) and orientation $\theta_i$, where i relates to a point in time ($t(i) = i \cdot \Delta t$)

vehicle position visualization

vehicle heading angle visualization

Both accelerometer and gyroscope are part of a strap-down IMU (blue dashed line). I'm calculating the angular velocity simply using the discrete derivative of $\theta_i$.

$\omega(i) = \frac{\theta_{i+1} - \theta_i}{\Delta t}$

For the acceleration component in heading direction, I simply use the change in velocity along the trajectory.

$P(i) = [x_i, y_i]^T$

$v(i) \approx \frac{| P(i+1) - P(i) |}{\Delta t}$

$a_x(i) \approx \frac{v(i+1) - v(i)}{\Delta t}$

I have two questions about this:

  1. Is my approach correct or are the equations wrong

  2. How can I calculate the linear velocity $a_y(i)$ which is orthogonal to the vehicle trajectory


1 Answer 1


Your equations seem alright, but why are you dividing by 2 in your definition of acceleration?

To your second question: I think you want to calculate both linear (tangential) acceleration and radial (orthogonal) acceleration. Linear acceleration causes the speed to increase/decrease, while radial acceleration only changes the direction of the velocity without changing the length. (I'm repeating the definition to avoid confusion). You can calculate the velocity vector which has both magnitude and direction: $$\vec v_i=\frac{\vec p_{i+1}-\vec p_i}{\Delta t}$$ and the acceleration vector: $$\vec a_i=\frac{\vec v_{i+1}-\vec v_i}{\Delta t}$$ The linear acceleration is parallel to the velocity vector, while the radial acceleration is orthogonal to the velocity vector. You can use the dot product to determine the parallel component: $$a_{||}=\frac{\vec a\cdot\vec v}{|\vec v|}$$ The radial acceleration is orthogonal so can be determined using the Pythagorean theorem: $$a_\perp^2+a_{||}^2=a^2\\a_\perp=\sqrt{a^2-a_{||}^2}$$

edit: your equation for linear acceleration is still correct, but this way you get both the linear and radial acceleration quite easily.

  • $\begingroup$ Ah thank you! This is what I was looking for. The $2 \cdot \Delta t$ should've been just $\Delta t$. $\endgroup$
    – RobinW
    Mar 8, 2020 at 20:43
  • $\begingroup$ I think there are two things you should add to your solution. 1. $a = |\vec a|$ 2. to get the direction of $a_\perp$ you could maybe use $sign(a^2 - a^2_\perp)$ (not sure about that) $\endgroup$
    – RobinW
    Mar 8, 2020 at 22:06
  • $\begingroup$ @RobinW If you want $a_\perp$ as a vector you can use $\vec a_{||}=\frac{\vec a\cdot \vec v}{|\vec v|^2}\vec v$ (also called the projection of $\vec a$ onto $\vec v$) and then use $\vec a_\perp=\vec a-\vec a_{||}$. $\endgroup$ Mar 8, 2020 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.