Difference between revisions of "Mean Targeting"

From Robowiki
Jump to navigation Jump to search
m (adding category "Targeting")
m
Line 1: Line 1:
A style of [[Targeting]] that averages the data from a few recent scans to use as input to its prediction algorithm.
+
A style of [[targeting]] that averages the data from a few recent scans to use as input to its prediction algorithm.
  
 
== Linear Mean ==
 
== Linear Mean ==

Revision as of 17:26, 13 November 2007

A style of targeting that averages the data from a few recent scans to use as input to its prediction algorithm.

Linear Mean

Given the enemy's current position and their position t ticks in the past, assume the enemy will continue to move with the same direction and average speed deduced from these scans. The pseudo-code would look like this:

  • Take a present scan position and an older scan position, t ticks in the past. Ignore actual heading and velocity.
  • Find the angle from from the old scan to the new one. This is the mean heading.
  • Find the distance between the two points and divide by t. This is the mean velocity.
  • Use these values as input to a Linear Targeting algorithm.

Circular Mean

Given a collection of x recent scans of the enemy, calculate his average velocity and turn rate and assume that he will continue to move with those values. The pseudo-code would look like this:

  • Iterate over the group of scans, summing the x - 1 heading changes and x velocities.
  • Divide the sum of heading changes by x - 1 to find the mean heading change.
  • Divide the sum of velocities by x to find the mean velocity.
  • Use these values as input to a Circular Targeting algorithm.