Changes between Version 6 and Version 7 of ra


Ignore:
Timestamp:
Jun 20, 2011 4:02:26 PM (13 years ago)
Author:
jpawlick
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ra

    v6 v7  
    3131 * Bot replies "rs ra 512 148 ammo_shells 140.00 112.00 88.00"
    3232 * Bot replies "cp ra 512 done"
     33
     34'''Calculating Exact Positions:'''
     35
     36Because the radar command returns only relative values based on the quagent's current orientation, a little additional work is required to find the absolute position of the object (this is useful if the user would prefer to use a [[mt]] rather than a [[mb]] command). Say the radar responds, "rs ra 512 2 ammo_shells 300.00 81.00 31.00". This means that the shells are 300 units away at relative yaw 81 and relative pitch 31. To calculate the point to issue a [[mt]] command with, the vertical component of the distance must be removed (D=D*cos(pitch)), and then the absolute position calculated. This is simple trigonometry:
     37{{{
     38 D = 300; //responded distance
     39 W =  81; //responded yaw
     40 P =  31; //responded pitch
     41 F =  45; //agent's current yaw
     42 I = -15; //agent's current pitch
     43 X =   0; //agent's current location (x)
     44 Y =   0; //agent's current location (y)
     45
     46 L  = D * cos(P + I);
     47 X' = X + L * cos(W + F); //absolute position of target (x)
     48 Y' = Y + L * sin(W + F); //absolute position of target (y)
     49}}}
     50
     51[[Image(radarcompdemo.png)]]