Using Newtonian mechanics you can solve for the trajectory of a projectile traveling at a given velocity and angle of elevation (theta). We neglect the affects of drag in our equations.
Now, imagine that you know the position of a target and its current velocity. In order to hit the object we must rewrite the Newtonian equations to solve for the desired theta and phi to hit a given location.
Even after rewriting the equations of motion you cannot simply point the cannon to the targets current location, fire and hope to hit it. A projectile travels at a given velocity along a trajectory, thus it takes time to reach its destination. If the target travels with any velocity at all, the projectile could reach its destination and find the target long gone.
Since we know the targets current position and velocity we can approximate a location ∆t from where it is now. We calculate ∆t by solving for the trajectory time at the targets current position and then multiply it by a factor K. In the future we will create an equation for K that will use the r distance and current velocity to approximate a minimum possible ∆t firing solution from its current position. Once we calculate the ∆t we calculate the next position using Euler’s method of integration.
Check to see if the new trajectory time is greater than or equal to the ∆t. If the trajectory time is greater than ∆t, we fire; if not, we must calculate another trajectory time further ahead and repeat the process.
We have now come up with the ability to find out where the moving object is, determine where the shooter needs to be, and choose the correct time to fire. We have the crucial pieces of information, and now must formulate the architecture of how to solve this problem.
The tracking and shooting simplifies to the following:
- Determine the current location of the object to be hit, as well as time it takes to hit the object at that point
- Calculate the future position where the shooter must move to (theta and phi) such that if the shooter were to fire at that position, the ball would hit the moving target as it passed
- Move to this position
- Calculate how much time it will take for a fired ball to reach where the moving object should be from the shooter’s new position, and confirm whether there is enough time to fire and hit it (time has passed since step 1 which is the reason we must check again)
- If the shooter has moved far enough ahead that it can hit the moving target once it passes, wait until the perfect time to launch the ball, and then launch. If there isn’t enough time, do not shoot. In either of these situations, finish by returning back to step 2
The following diagram illustrates this process:
No comments:
Post a Comment