4.4.2 Edge Following
Insects like the cockroach spend the vast majority of there time following along the edges of rooms, shelves and such. They will usually only dare to leave the safety of the edges to venture out in to the open for food or if it is dark. The reason for this is that the roach is usually safer in the edges. It is much easier to overlook the nasty little bug when it is under the edge of a counter than if it is sitting in the middle of the floor. Also, the insect that stays near the edges will usually be closer to a bolt hole of some kind where it may be difficult or impossible for a predator to get to it. The only time a roach really feels safe going out in the open is when it is dark. That is why you will only usually catch them like that when you surprise them by flicking on the lights in a dark room. So being able to follow along the edges of obstacles can be a very beneficial behavior for a canny insect to be able to perform. It also provides an efficient means of exploring the boundaries of their environment. The only other real behavioral choice available for dealing with obstacles is the recoil response. In the recoil response the insect recoils and goes in another direction when it encounters a wall. However, edge following is much more realistic of actual insect behavior.
2. Insect Edge Following
The function of the edge followers is to orient the insect so that it travels parallel to an edge when it encounters an obstacle. To do this it uses its left and right antennas. The functionality of the simulated antennas is inspired by the stress receptors of real antenna. As an antenna comes into contact with an obstacle it is bent slightly. This causes stress receptors at the base of the antenna to fire. The more the antenna is bent, the more the stress receptors fire. The simulated antennas work in a similar manner. Section 18.104.22.168 discussed the functionality of the virtual antennas. When the antenna encounters an obstacle it calculates the angle of incidence of the antenna with the obstacle. This value can then be used by sensory neurons to determine what angle the insect is colliding with the wall. Figure 22.214.171.124 shows this nicely. If the insect is running head on into the wall then the angle of incidence will be much larger than it will be if it is only grazing the wall. Another important aspect of edge following in insects is that it has some hysteresis, or memory. If the insect is following an edge and it comes to a corner or rough section where it momentarily loses contact with the wall it should not immediately stop the edge following behavior and start random wandering. It needs some short term memory to tell it that it should keep trying to find a nearby edge. However, this memory should only last for a limited amount of time. If the insect can not find another edge in that time window then it needs to start its random wandering again.
3. Edge Follower Neural System
If the insect runs into an obstacle using the neural network developed to this point it would be stuck. Video 1 demonstrates what happens when the insect runs into a wall while its edge following system is disabled. It simply keep trying to shove its head through the wall. That behavior is completely useless for any real exploration of the environment, and for the long term survival of the insect. There are two edge following systems that are connected to the turning controller. These are the left and right edge follower, and they can be seen in figure 126.96.36.199. Figure 1 shows the layout for the right edge follower. The left edge following layout is the same except the neurons have names with left instead of right. The system is centered around the Antenna Tactile Sensor Right (ATSr) neuron. This sensor is the one that takes the angle of incidence from the right antenna and converts this into an intrinsic current. The sensor uses the sigmoid function shown in figure 2 to relate the incidence angle and the current it uses.
It uses the sigmoid in order to make any incidence angle less than or around zero map to a low intrinsic current. Once the angle goes above zero it increases in an almost linear manner. The intrinsic current then causes the neuron to fire. The larger the angle of incidence the larger the firing frequency. ATSr then stimulates Qr. Qr is basically a gated pass through neuron that works similar to the way the locomotion control system does once it was broken up. Qr stimulates the neuron Fr. That neuron has a high gain and a large capacitance. When stimulated it will quickly saturate and will stay saturated for an extended period of time once the original stimulus is removed. This neuron is what implements the hysteresis for the edge following system. When an antenna comes into contact with the obstacle it will cause Fr to saturate and even if it temporarily loses contact, Fr will still continue to fire for around 10 seconds or so. The key behavior of edge following is that when the antenna comes into contact with an obstacle it must turn away from the contact. The larger the angle of incidence, the more head on the insect is coming at the obstacle, the harder it must turn in order to avoid running into the wall. However, at some point it will turn so much that it will again lose contact with the wall. It must then turn slightly in the other direction until it again contacts the wall. The insect will repeat this over and over while there is an edge to follow. It will turn slightly until it contacts the wall, and then turn the other way until it loses the wall again, ping ponging back and forth. This will keep it moving parallel to the wall. This behavior is implemented with the neurons High Right (Hr) and Low Right (Lr). Neuron Hr acts to decrease the angle between the body and the edge when it is to large. In other words, it is active when the angle of incidence is to high. Lr acts to increase the angle between the body and the edge when it is to small. Or, it is active when the angle of incidence is to low. As an example assume that an insect is traveling such that its right antenna hits a wall and it is going to hit the obstacle almost head on. But the right antenna hits the wall and the left has not yet contacted it. The following events take place for this example.
Edge following is an important behavior for insects. However, other behavior systems must be able to override it when their behaviors are more important. That is where the Non-Following Command Right (NFCr) and Non-Following Command Left (NFCl) Neurons come into play. The NFCr neuron acts like a switch to turn off the edge following system on the right side. First it inhibits Qr preventing it from firing. It also strongly inhibits Fr to attempt to drain it of all charge as fast as possible. Next, it uses a gated synapse to shut down the excitatory connection between Fr and Lr. It does this because even though Fr is being strongly inhibited it will still continue to fire for a noticeable amount of time. But by using the gated synapse this is no longer a consideration because even though Fr is firing it is not able to excite Lr.
4. Edge Following Analysis
Video 1 shows what happens when the insect collides with an obstacle without having the edge following circuits. Once it collides with the obstacle it slowly skates down the side of it. This is an artifact of the collision algorithm this system is using. It tries to move the insect in different combinations of the original motion if it had not hit a wall. Since it is angled slightly it is trying to go right and slightly up. The obstacle prevents it from going any farther right, but allows the up motion because it is not constrained. This is not an accurate representation of true motion. However, it was deemed to not be a critical failure and was not worth the time to fix in the current implementation. This type of flaw will not exist in future versions of the simulator that will use a true physics based simulation. The important thing to take from this animation is that the insect became stuck once it hit the wall using the current neural network. It will continue to try and ram its head through that wall until it slides away from the wall, gets stuck in a corner, or dies.
This video is the same as video 1 except the edge following circuits are now enabled. The resulting behavior displayed by the insect is very different. Now instead of running headlong into the wall and getting stuck, it senses that it is about to hit the wall and turns away and follows the edge instead. One of the things of importance to note from this video is the value of ATSr firing. Watch how it spikes to one as the right antenna comes into contact with the obstacle in a head on manner, but it goes much lower when the insect has turned to graze the edge of the obstacle. The next thing to notice is how the value of Fr stays pegged at one even thought the values of Qr and ATSr are fluctuating wildly. Finally, look at the ping-ponging motion that was discussed earlier. Once the insect is walking parallel it will lose contact with the wall and then recover contact with it. This can be seen when the value of ATSr drops to zero and then comes back and does so again. And as soon as ATSr drops to zero Hr also drops to zero and Lr begins firing.
These two videos demonstrate the memory inherent in the edge following system. To go around an outside corner the insect temporarily loses contact with the edge. It must have some short term memory that keeps it trying to find the edge for some short period of time. Fr plays that role in this system. Its high gain and large capacitance insure that it continues to fire for several seconds even after the antenna loses contact with the wall. In video 3 be certain to watch as Fr continues to fire even as ATSr is silent. It causes Lr to fire at a low rate to keep the insect turning towards the wall until it finds it again. Video 4 shows the insect traversing all of the outside corners for the entire L shaped obstacle.
5. Corner Detection
Only a portion of the neurons that are visible in figure 1 have thus far been explained. The remaining neurons are related to corner detection and navigation. These are not for corners that turn out, but those that turn in like the walls of a room. Figure 3 gives an example. The insect follows the wall until it gets to the inside corner and then it runs head on into the other wall and gets stuck in the corner. Video 5 demonstrates this. The corner detection neurons are meant to combat this problem. When the insect is about to run into the perpendicular wall its non-edge following antenna will make contact with that wall. This is used as a signal to let the insect know that it is about to get caught in a corner and needs to do something. If the insect is following a wall on its right side then Fr will be stimulating the Corner Detection Right (CDr) neuron. The excitation voltage of CDr is setup so that it will not fire if just Fr is stimulating it. When the left antenna makes contact with the perpendicular wall its ATSl neuron will begin firing and will further stimulate CDr. This added stimulation will be enough to cause CDr to fire. When CDr fires it is basically a signal that a corner has been detected, and it does a few different things. First it inhibits the left edge following system to prevent that circuit from trying to follow the new edge. Second, It stimulates the Corner Detection Right Memory (CDrM) neuron. This neuron has a high gain and a large capacitance. It is another hysteresis neuron. It will continue to fire for several seconds even after the insect can no longer detect the corner. It stimulates the Backward controller (BC) neuron and the Left (LT) neuron. This causes the insect to back up a little bit and to turn away from the corner. When CDrM fully discharges the insect begins walking forward again and it will be oriented so that the right antenna will make contact with the new wall instead of the old wall. This would happen exactly the same if it was following a wall on the left side, except it would be neurons in the left edge follower responding instead of the right edge follower.
6. Corner Detection Analysis
This video shows what happens when the insect is following an edge and runs into an inside corner without having the corner detection neurons working. It once again bangs its head into the wall and stays there. The reason for this is that both antennas are making contact with the obstacle, and both are firing at roughly the same rate because of that. So the output from the left and the right edge following systems cancel out and the insect keeps trying to walk straight ahead into the new wall.
Video 6 demonstrates what happens when the insect runs into an inside corner using the corner detection circuits. The insect is walking along following the right edge when at around 6.3 seconds the left antenna makes contact with the perpendicular wall. This causes ATSl to spike, which in turn causes CDr to spike. CDr strongly excites NFCl to keep the left edge following control from engaging, and it temporarily backs the insect up. After just a little bit the insect begins walking forward and starts following the new edge. Video 7 shows this same example with a better view for what the insect is doing.
With the addition of the edge following behavior the simulated insect has finally started to act much more like a real insect. Edge following is a rather complex and impressive looking behavior for the insect. It must use its antennas to detect that it is about to hit an obstacle, and use the sensor information to determine how sharply it must turn to avoid hitting it. Then it has to use a little feedback system so that it will continue walking parallel to the wall. The hysteresis that is contained in the system allows the insect to continue trying to follow the edge even after it has lost contact with the wall. Finally, the corner detection neurons allow the insect to get itself out of tight corners with ease. These systems all tied together give the insect a powerful set of behaviors for exploring a rich environment with numerous, complex obstacles with corners and sharp edges. However, even all of these systems are still not going to keep it from getting stuck sometimes. So what is needed is a simple system to get the insect out of trouble once it has become glued to a wall.