wiki:ra

Version 7 (modified by jpawlick, 13 years ago) (diff)

--

This ProtocolZero command asks the agent to tell you the entityids? of every game object it can see within the provided range. It responds once for each entity, and completes after all responses are issued.

Radar example: response includes only green entity dots. Black lines indicate obstructing walls.

In the above example of an ra command, black lines are walls. Dots represent entities. The response only includes the green dots. Red dots are either occluded or out of range.

Parameters:

  • 1 float range. Only entities closer than this range are returned. If you provide a non-positive range, the command considers the range infinite.

Responds:

  • X TYPE D Y P for each entity that can be seen. The set of seen entities does not include the quagent itself.
    • where X is that entity's entityid?
    • where TYPE is the typename that would be returned by a wi on this entity.
    • where D is the distance to the entity.
    • where Y is the relative yaw to the entity from the quagent's current facing.
    • where P is the relative pitch to the entity from the quagent's current facing.

Reports:

  • done when the task completes.
  • popped if popped by po.
  • forgotten if deleted by fa or fm.
  • replaced if replaced by a command scheduled with 'r'.

Example:

  • User sends: "n ra 512 400"
  • Bot replies "rs ra 512 2 player 331.00 22.12 99.324"
  • Bot replies "rs ra 512 144 ammo_shells 40.00 112.00 88.00"
  • Bot replies "rs ra 512 145 ammo_shells 55.00 112.00 88.00"
  • Bot replies "rs ra 512 146 ammo_shells 80.00 112.00 88.00"
  • Bot replies "rs ra 512 147 ammo_shells 100.00 112.00 88.00"
  • Bot replies "rs ra 512 148 ammo_shells 140.00 112.00 88.00"
  • Bot replies "cp ra 512 done"

Calculating Exact Positions:

Because 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:

 D = 300; //responded distance
 W =  81; //responded yaw
 P =  31; //responded pitch
 F =  45; //agent's current yaw
 I = -15; //agent's current pitch
 X =   0; //agent's current location (x)
 Y =   0; //agent's current location (y)

 L  = D * cos(P + I);
 X' = X + L * cos(W + F); //absolute position of target (x)
 Y' = Y + L * sin(W + F); //absolute position of target (y)

Demo of calculating absolute position of an object using radar: figure 1.

Attachments (2)

Download all attachments as: .zip