Tuesday, November 26, 2019

kinematics - What is the best path for a given initial and final state?


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.



Answer



Here's my messy approach. It's not ideal, but it may work reasonably well:


Approximate the position function $x(t)$ as a fourth degree polynomial:


$$x(t) = at^4 + bt^3 + ct^2 + dt + e$$



This way, you have one extra degree of freedom to manipulate, which you can use to minimize unnatural motion. Let's assume the motion starts at $t = 0$ and ends at $t = T$.


Then $x(0) = p_0 = e$ and $x'(0) = v_0 = d$, so we can write:


$$x(t) = at^4 + bt^3 + ct^2 + v_0 t + p_0$$


For the remaining three variables, we write a matrix system. Here's the augmented matrix:


$$\begin{bmatrix} T^4 & T^3 & T^2 & p_f - p_0 - v_0 T \\ 4 T^3 & 3 T^2 & 2 T & v_f - v_0 \end{bmatrix}$$


With Mathematica, I row-reduced the above to


$$\begin{bmatrix} 1 & 0 & -1/T^2 & \frac{3p_0 - 3p_f + 2 v_0 T + v_f T}{T^4} \\ 0 & 1 & 2/T & \frac{-4p_0 + 4p_f - 3 v_0 T - v_f T}{T^3} \end{bmatrix}$$


For simplicity, I'll define $\alpha = \frac{3p_0 - 3p_f + 2 v_0 T + v_f T}{T^4}$ and $\beta = \frac{-4p_0 + 4p_f - 3 v_0 T - v_f T}{T^3}$.


This system tells us that as long as we ensure $a = \alpha + c/T^2$ and $b = \beta - 2c/T$, any value of $c$ will result in a polynomial $x(t)$ that matches your conditions.


You can then choose $c$ based on any number of criteria. For example, minimizing acceleration yields $c = -\alpha T^2$ and Floris' result, although this may sometimes result in retrograde motion.



No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...