Difference between revisions of "Advancing Velocity"

From Robowiki
Jump to navigation Jump to search
m (Minor edit.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Advancing Velocity''' (also '''AdvancingVelocity''') is the speed at which your opponent is moving toward you (perpendicular to [[LateralVelocity]]). When you stay still, [[RamFire]] usually has an Advancing Velocity of 8 and [[MyFirstRobot]] usually has an Advancing Velocity of 0.  A robot moving straight away from you would have an Advancing Velocity of -8.
+
'''Advancing Velocity''' is the speed at which your opponent is moving toward you (perpendicular to [[Lateral Velocity]]). For example, a bot moving full speed straight at you would have an advancing velocity of 8, a robot moving full speed perpendicular to you would have an advancing velocity of 0, and a robot moving full speed straight away from you would have an advancing Velocity of -8. A stationary bot will always have an advancing velocity of 0, no matter which direction it's moving.
  
 
== Calculation ==
 
== Calculation ==
 
A simple formula for advancing velocity is:
 
A simple formula for advancing velocity is:
<pre>
+
<syntaxhighlight>
double advancingvelocity = -Math.cos(e.getHeadingRadians()-absbearing)*e.getVelocity();
+
double advancingVelocity = -Math.cos(e.getHeadingRadians() -  
</pre>
+
    (e.getBearingRadians() + getHeadingRadians())) * e.getVelocity();
Where absbearing is the absolute bearing to your target.  Without the negative sign, it could be called the retreating velocity.
+
</syntaxhighlight >
 +
Where <code>e</code> is a [[ScannedRobotEvent]].
 +
 
 +
== See Also ==
 +
* [[Lateral Velocity]]
  
 
[[Category:Terminology]]
 
[[Category:Terminology]]

Latest revision as of 21:54, 17 December 2012

Advancing Velocity is the speed at which your opponent is moving toward you (perpendicular to Lateral Velocity). For example, a bot moving full speed straight at you would have an advancing velocity of 8, a robot moving full speed perpendicular to you would have an advancing velocity of 0, and a robot moving full speed straight away from you would have an advancing Velocity of -8. A stationary bot will always have an advancing velocity of 0, no matter which direction it's moving.

Calculation

A simple formula for advancing velocity is:

double advancingVelocity = -Math.cos(e.getHeadingRadians() - 
    (e.getBearingRadians() + getHeadingRadians())) * e.getVelocity();

Where e is a ScannedRobotEvent.

See Also