_pingbearing


Value Type

numeric [-180-179]

Description

When a robot is detected by another robot's radar scan, the _pingbearing variable contains a bearing to the point where the scan intersected the robot. Since _pingbearing contains a bearing rather than an absolute heading, values are in degrees ranging from -180 to 179 inclusive. A value of 0 is directly ahead of a robot while -180 is directly behind a robot.

For example, if a robot was heading 180 degrees and a radar scan from another robot intersected it at a point that was 90 degrees to the right of its current heading, _pingbearing would have a value of 90. To convert _pingbearing to a heading, a robot can add _pingbearing to its current _heading value (180 + 90 given a heading of 270 degrees).

When a robot is pinged it can also obtain the direction of the incoming radar scan. The _pingheading variable provides this information. For an illustrated example of bearing and heading values, see the _cldbearing help topic.

See Also

_pingheading, _pingfriendly, _ping, scan