I am trying to calculate an efficient acceleration curve given starting and final positions and velocities. I'm assuming no friction, and that the acceleration can be applied in any direction at any time.
Given:
- $p_0$ = starting position
- $v_0$ = starting velocity
- $p_f$ = final position
- $v_f$ = final velocity
- $T$= total time
I want to find a nice $a(t)$ function that will produce final conditions.
So far I have the following solution that works, but produces an incredibly inefficient $a(t)$ curve:
First I calculate the constant acceleration required to get from $v_{0}$ to $v_{f}$ :
$$ a_v = \cfrac{v_f - v_{0}}{T} $$
Then I calculate the change in position this acceleration will create over $T$ :
$$ p_v = \cfrac{1}{2} a_v T^2 $$
Next I calculate the average velocity required to get from $p_{0}$ to $p_f$ and to counteract $p_v$ :
$$ v_p = \cfrac{p_f - (v_{0} + p_f ) }{ T } $$
Next I calculate the acceleration needed to produce this average velocity over the total time:
$$ a_p= \cfrac{2 v_p}{ T} $$
Finally, I add twice that acceleration to the first half of my acceleration function, and subtract twice that acceleration from the second half. This produces the net position change that I want, but has a net $0$ velocity/acceleration change so $v_f$ stays correct:
$$ a(t) = \begin{cases} a_v + 2 a_p & t \leq \frac T 2 \\ a_v - 2 a_p & t > \frac T 2 \end{cases} $$
While this solution provides a result, it can cause the simulated objects I'm working with to move backward before moving toward their final goal, along with other weird behavior. I think the ideal solution would minimize total acceleration applied over time (and thus force, since the mass of the object will stay constant over this time).
I know that the constraints on this problem are that the integral of $a(t)$ must equal $v_f - v_{0} $, and that the integral of that integral must equal $p_f - p_0$ . I just don't know how to setup the problem to solve for those constraints. I don't even really know what I should Google for to try and solve this problem. Any help would be greatly appreciated.