JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section


The solution doesn't perform as fast as humans. The rules tell the animat to slow down at corners, to prevent getting lost. Humans with the same sensors as the animats would struggle, too. That said, increasing the length of the whiskers helps the animats detect walls better, at the cost of more computation.

In some rare cases, the animats lose track of the wall. When they do this, they go into an endless spin, trying to find the wall! This is particularly problematic, because it really shatters any sense of realism. To solve this, we can use a counter that resets every time the animat moves forward. If it gets stuck in a spin, the counter starts to increase. When the counter reaches a certain value, we have detected a spin. In this case, we reset the "following" symbol in the working memory to start looking for walls again. By using the right value of the counter, we can time the release from the spin so that it happens at 180 degrees. When the bot has turned around fully, it's more likely to find the wall it lost track of.

The implementation of the sensors in FEAR detects obstacles and ledges. However, at the bottom of the stairs, for example, there is a blurry zone with neither (not a bug). The animats can get lost there because the ledge is not high and the wall is too low. These spots are particularly problematic for spins, but the U-turn release strategy is fairly good at getting the animat back on track.

Some tweaking is required to get smooth behaviors. The RBS needs to be executed relatively often; the default of every 0.1 seconds produces smooth results. However, it's the moving average on the forward movement request that really helps the most. Using this averaging mechanism, the frequency of updates can be decreased.

Practical Demo

The animat demonstrating the ideas in this chapter is known as Stalker, available in both source and binary formats. Stalker uses a combination of simple rules driven by an RBS interpreter to follow walls. This animat is also capable of finding walls if it gets lost and preventing spinning motion.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor