How Can a PID Controller Improve Missile Guidance in a Game?

AI Thread Summary
A PID controller can enhance missile guidance in a game by stabilizing the missile's angle and improving its trajectory towards a target. The current approach, which uses simple commands based on angle differences, results in erratic movement and overshooting. Implementing a PID algorithm would allow for smoother adjustments to the missile's rotation and acceleration, effectively dampening the angle difference (theta) to zero more quickly. This would enable the missile to maintain a more direct path to the target, improving accuracy. Ultimately, a well-tuned PID controller can optimize missile guidance, making it more effective in navigating towards asteroids and other targets.
tenpoints
Messages
1
Reaction score
0
Hey all,

This is a bit of a broad subject so I'm not sure which section it best applies to, but here it is anyway.

I'm working on a massively over-engineered version of the original Asteroids game. How over-engineered? Well the problem I have right now is desigining and implementing a guidance system that will be used for missiles targeting asteroids, and aliens targeting the player. It will later be extended to navigating around obstructions via a series of waypoints.

I have an algorithm that finds the point of intersection of asteroid and missile, but I don't have an accurate enough method for calculating the duration of flight (to get the point accurately).

Asteroids have a velocity vector with a constant magnitude and angle.

Missiles have:
  • A velocity vector with a variable magnitude and angle.
  • An intial rotation based on the rotation of the ship. Variable name: rotate
  • A fixed rate of acceleration.
  • A maximum speed of rotation.

When fired, the goal of the missile is to align its velocity angle with the angle between the missile and the target point. I have a function called theta which returns the difference between these two angles.
When theta is:
  • Positive: The target is off to the right of the missile.
  • Negative: The target is off to the left of the missile.
  • Zero: The target is dead ahead of the missile.
The range of angles is from -179 to 180 degrees.
In the game, an angle of 0 degrees (missile rotate) is facing right.

The problem I'm having at the moment is that my current commands tell the missile to rotate right or left based on theta, and as a result the missile tends to fishtail around the line of intersection and often ends up overshooting the target point.

What I need is an algorithm/equation to stabilise the missile's angle by "dampening" the velocity vector to theta=0 in as short a time as the thrust and rotation of the missile will allow. Once the missile has the right angle it will pass right through the target point.

The missile can only apply an acceleration in the direction of rotation.

Once I have an accurate hit on a point I can calculate the number of steps to reach that target, either by simulating the path before actually launching it, or with an equation, apply a function to determine the length of the path (possibly less expensive processwise).

Any ideas?
Thanks :-)
 
Physics news on Phys.org
Having variable missile speed and finite turinig speed makes it difficult to compute the interception path.

Controling the missile via rotation & linear acceleration forward only, makes it even more difficult to follow the interception path, even if you knew it exactly.
 
Thread 'Question about pressure of a liquid'
I am looking at pressure in liquids and I am testing my idea. The vertical tube is 100m, the contraption is filled with water. The vertical tube is very thin(maybe 1mm^2 cross section). The area of the base is ~100m^2. Will he top half be launched in the air if suddenly it cracked?- assuming its light enough. I want to test my idea that if I had a thin long ruber tube that I lifted up, then the pressure at "red lines" will be high and that the $force = pressure * area$ would be massive...
I feel it should be solvable we just need to find a perfect pattern, and there will be a general pattern since the forces acting are based on a single function, so..... you can't actually say it is unsolvable right? Cause imaging 3 bodies actually existed somwhere in this universe then nature isn't gonna wait till we predict it! And yea I have checked in many places that tiny changes cause large changes so it becomes chaos........ but still I just can't accept that it is impossible to solve...
Back
Top