Eye

From WikiManual
Jump to: navigation, search

Eyes:

.eye1 501 .eye2 502 .eye3 503
.eye4 504 .eye5 505 .eye6 506
.eye7 507 .eye8 508 .eye9 509
.eyef 510
.focuseye 511
.eye1dir 521 .eye2dir 522 .eye3dir 523
.eye4dir 524 .eye5dir 525 .eye6dir 526
.eye7dir 527 .eye8dir 528 .eye9dir 529
.eye1width 531 .eye2width 532 .eye3width 533
.eye4width 534 .eye5width 535 .eye6width 536
.eye7width 537 .eye8width 538 .eye9width 539

Basic Sysvars:

Eyes allow a bot to see and are key to almost everything a bot does.

A good animal bot should use at least one eye to be effective.

The eyes are numbered 1-9 from left to right. in version 2.4 and later you can tell exactly what is seen in each eye angle, by clicking on your bot.

.eye5 is the most important since it is in the middle, straight ahead of the bot. To use the Refvars eye5 needs to have something in it (and a bot needs to have at least one eye command-trust me--Endychat).

As of 2.43, a bunch of new eye stuff has been added

Eye focus

.eyef reads back the eye value of the current eye focus: the eye that reads refvars, .memval etc. Under normal circumstances, that would be eye5, but now, the focus can be changed using .focuseye.

Changing eye directions

The new .eyeNdir locations allow the direction each eye is looking to be changed. The value stored is treated as an offset from the eye's default direction. Values persit across cycles and are read/write.

Thus, storing 0 values in these locations results in the eyes pointing in their traditional directions. For example, the following gene results in .eye5's direction slowly rotating about the bot every 1256 cycles:

cond
start
*.robage .eye5dir store
stop

To calculate absolute eye directions, one needs to know the default offset from .aim for each eye. The field of view for each eye is pi/18 radians or approx. 35 turning units. Thus, the default offsets for each eye from .aim are as follows:

.eye1 = (4 * pi/18) = 140
.eye2 = (3 * pi/18) = 105
.eye3 = (2 * pi/18) = 70
.eye4 = (1 * pi/18) = 35
.eye5 = 0
.eye6 = -35
.eye7 = -70
.eye8 = -105
.eye9 = -140

Note that the turning units are rounded.

The following gene points all eyes straight ahead, all overlapping .eye5

cond
start
-140 .eye1dir store
-105 .eye2dir store
-70 .eye3dir store
-35 .eye4dir store
35 .eye6dir store
70 .eye7dir store
105 .eye8dir store
140 .eye9dir store
stop

Changing eye widths

The new .eyeNwidth sysvars allow the width of the eyes to be changed.

A value of 0 indicates the default width of pi/18 radians (approx 35 bot rotation units). Storing positive values increases the eye width over and above the default width by .eyeNwidth /1256. Storing negative values narrows the eye width.

Note that a value of 1221 (1256 - 35) is equivalent to a value of -35 and represents a 360 degree field of view. Both positive and negative values are MODed such that an eyewidth value of 1222 is equivalent to a value of -34 which represents the smallest possible eyewidth of 1/1256 * 2 * pi

By increasing a bots eye width the distance the eye will see becomes shorter. This is determined using the formula S = 1 - ln(W)/4 where W is the eyewidth as a multiple of standard pi/18 eye widths.

Eye values

Eye values depend on the distance of the edge of an object or bot from the outside edge of a robot. The farthest point of a robot's vision is equal to an eye value of 1 while an object directly touching or inside a robot will return a value of 32000.The robot's vision value based on how close something is to the eye, will increase at roughly the inverse square of how close the bot is as a percentage of the maximum sight distance. This means that if an object in the eye moves half as close to the eye the distance increment from value to value will be 1/4th of the original. This allows robots to see things very close very accurately.