# Projectile angle that considers canon length

1. Nov 14, 2014

### Edvin

Greetings,

Most projectile problems are presented from the muzzle of a cannon; however, how do we solve the problem if the velocity is known at the muzzle; but the angle is controlled at the base of the canon.
The issue is that, when the canon angle changes, so does the muzzle location!

The problem that I am trying to solve is for a small robot that shoots a ball into a coffee cup. I can control the angle; but, not the velocity. When I try to solve the problem, I end-up with a fourth degree polynomial.
I'm not concerned with air drag; because, it is negligible (at least in the simulation I created in algodoo.

Here is how I approach the problem:
h = v0 t + 1/2 g t2
given that vx = v cosθ and vy = vsinθ
Also, distance traveled is given by d = vx t; therefore, d= t v cosθ, where t = d/(v cosθ)
Next, I add the extra height and distance as the canon angle changes.
The extra horizontal length for given barrel length L is going to be L - L cosθ.
So, t = (d +L - L cos θ)/ (v cos θ)
The extra height is L sin θ
So, the first equation changes to:
h = L sinθ + vy t + 1/2 g t2
h = L sinθ + v sinθ [ (d +L - L cos θ )/ (v cos θ) ] + 1/2 [(d +L - L cos θ )/ (v cos θ)]2
...
2v2h2 - 2L2 - 2v2(d+L)tanθ - g(d+L)2 - g(d+L)2 tan2θ = 2 L g sqrt(1+tan2θ)
...
x1 tan4θ + x2 tan3θ + x3 tan2θ + x4 tanθ + x5 = 0​

If this is right, I would have to write an algorithm to solve a 4th degree polynomial. Alternatively, I can ignore the canon length, and then loop through different angles until I calculate the right value.
However, I would prefer to solve the problem down to an equation and then plug it in.

Please let me know if I'm mistaking or if there is another way of solving this problem.

Tnx,
Edvin

2. Nov 14, 2014

### bigfooted

I would do it like this:
First, I assume that you only know the velocity in the direction of the cannon, V_0, at the exit of the barrel. I call the horizontal distance x, and the vertical distance y. Gravity is pointing down, in the negative y-direction.
The x-component of velocity is $V_0 \cos (\theta)$ and the y-component is $V_0 \sin (\theta)$.
The exit of the barrel is at a height of $y=L \sin (\theta)$.

Now we call the exit of the barrel P=(x1,y1)=(0,0). The next time the ball is at y= 0 is given by the equation for y:
$y=V_0 \sin (\theta)t - \frac{1}{2}gt^2=0$

The total distance traveled can be obtained from the equation for x. The 'real' ground is $L \sin (\theta)$ lower.
Now you need to calculate the time it takes the ball to fall down this distance, and then calculate the extra x-distance.
The angle and velocity components at (x2,y2) are known from the symmetry of the parabola.

3. Nov 14, 2014

### Edvin

Tnx for looking at this...

You are right, I can determine V_0 at the exit with a few experiments.
I also know the distance to target (cup) from base of my canon (determined with sensors).
I certainly understand what you mean by the symmetry of velocity and angle at (x2,y2).

I'm not sure how to drive to θ from the known variables.
I'll try to work the problem again, see where I end-up.

BTW, how do you add the equations in this forum?
EDIT: I found, this how to link

Last edited: Nov 14, 2014
4. Dec 8, 2014

### Edvin

I tried the problem a few more times; but, ultimately I ended up with a 4th degree polynomial.
I reached out to a physics professor and he was kind enough to share that a general solution would be very complicated and that simplifying via approximation would give a reasonable result.

Recall that my goal is to shoot an object into a cup.
Since the farthest distance for a projectile is a 45 degree angle; we know that my angle must be 45 degrees and higher.
The closer the target (cup) is to the cannon, the less significant is the cannon length.
We will approximate the projectile origin at the top of the cannon to be $\mathcal{L}$ (as appose to $\mathcal{L}\ sin \theta$) and that we'll approximate the horizontal offset from the base of the cannon (since $\mathcal{L}\ cos \theta$ is almost zero). [Note $\mathcal{L}$ is our cannon length]

In my original post I showed t = (d +L - L cos θ)/ (v cos θ).
So, we'll revise it such that distance $\mathcal{d}$ is from the base of the cannon to the cup. And we'll endup with $t = \frac {d- l\ cos \theta} {v\ cos \theta} \approx \frac{d}{v\ cos \theta}$
We'll also change our initial y offset to cannon length since $\mathcal{L}\ sin \theta \approx \mathcal{L}$. Now we end up with
$y = y_0 + V_0\ t - \frac{1}{2}\ g\ t^2$
$y = L + V\ sin\theta\ ( \frac{d}{v\ cos \theta} ) - \frac{1}{2}\ g\ (\frac{d}{v\ cos \theta})^2$

And that leads to:
$\frac{gd^2}{2v^2}tan^2\theta-d\ tan \theta+(\frac{gd^2}{2v^2}+y-l)=0$

And now we have our quadratic equation:
$tan \theta = \frac{v^2+\sqrt{2v^2\ g(l-y)+v^4-d^2g^2}}{dg}$

Incidentally, if anyone wants to try 4th degree polynomial; I found the following threads: