Friday, July 15, 2011

Ballistics

When running experiments, I need to choose the initial properties of a ball in order to produce a desired end result. In this case, I know where the ball starts and I know where the ball ends. In a linear system, that would be enough. However, gravity makes the system quadratic. So we need an extra constraint. For my experiment, it was important that the ball height not exceed a certain limit. So I control the maximum height of the trajectory. Our givens are then $g$, $x_0$, $x_m$, and $x_f$. We want to calculate $t_f$ and $v$. We have the following general ballistic equation:
$$f(t)=\frac{1}{2}at^2+vt+x_0$$
What we need is the correct $v$. So we take our knowns and plug them through:
$$\begin{align}
x_m&=\frac{1}{2}at_m^2+vt_m+x_0\\
x_f&=\frac{1}{2}at_f^2+vt_f+x_0\\
0&=at_m+v
\end{align}$$
We can solve for $v=-at_m$ and plug that into the first equation to get $x_m=\frac{1}{2}at_m^2-at_m^2+x_0=-\frac{1}{2}at_m^2+x_0$; therefore, $t_m=\sqrt{\frac{-2(x_m-x_0)}{a}}$. In my case, a is negative (gravity) and so the function will be real-valued as long as $x_m>=x_0$. That's sensible since $x_m$ is the highest point in the trajectory.  Note that you can decide if $t_m$ if positive or negative.  If it's positive, the initial velocity will be going against the acceleration.  If it's negative, the initial velocity is with the direction of acceleration.
 Now we can find $t_f$ and $v$: $v=-at_m$, and $t_f = \frac{-v\pm\sqrt{v^2-2a(x_0-x_f)}}{a}$. Again, since $a$ is negative, using the subtraction branch selects the time farthest in the future and we should have a real-valued result as long as $x_f<=x_m$.
Given  $t_f$, which I assume has been calculated in terms of the dimension parallel to gravity, we can then calculate the velocities for the other dimensions.  This is done based on where you want the ball to be at time $t_f$: $v_{x0} = \frac{dx}{dt} = \frac{x_f - x_0}{t_f - t_0}$.  Note here, that this is assuming no acceleration in the dimension of interest.  Also note, if the trajectory involves bouncing off of a wall, you should "wrap" the bounce into the final endpoint so that you're accounting for total distance traveled in the dimension of interest.  This assumes no friction and elastic collisions.  If collisions are not perfectly elastic, you just need to boost the velocity according to the number of collisions expected before $t_f$.

No comments:

Post a Comment