
   
      
         
            Proposal for a Red Harvester Ant Robot: Colony Infiltration and Task Switching
            Sonia Roberts
            11/27/07
            Introduction
            
            Background
            Science fiction writers have been anticipating humanoid androids that could pass a Turing Test for years. Unfortunately, as of yet, no robot has managed to fool a human for more than a few seconds, and no robot has been created that can integrate itself into human society. Infiltrating insect societies, however, is much simpler. Extensive research has been done on the interactions of social insects such as honeybees, ants and cockroaches, and in fact robots have passed undetected in cockroach society performing single simple behaviors already (Halloy et al, 2007). No robot has yet been constructed, however, that could pass undetected within a colony of the red harvester ants species Pogonomyrmex barbatus; nor has a robot managed to pass undetected in a society of insects while combining in its design several different behaviors and the thresholds of stimulation required to switch between them. Such a robot would allow for both long-term studies of ant-robot interactions and studies of task-switching in the robots. I propose here the theoretical construction and programming of a robot (hereafter referred to as Antie) that will be able to infiltrate a red harvester ant nest, switching between the foraging, patrolling and midden work behaviors.
            
            Environment
            The red harvester ant lives in hot, dry deserts, building its nests in light yellowy sand and foraging for seeds deposited by winds and rain. The ants forage for more than 30 different varieties of seeds, many of which do not grow in the desert (Gordon, 54), where only a few varieties of small shrubs, small herbaceous flowering plants and short grasses do grow (Gordon, 51). Other insects and creatures, including other species of ants, are present in the desert, but red harvester ants seem to be relatively undisturbed by these animals (Gordon, 7-11). Though fights sometimes do break out with other red harvester ants from different nests, intraspecies interactions tend not to be aggressive (Gordon, 11). Because of this, I will ignore other ant species in the design of Antie, and will not create a fighting behavior. Antie will be equipped to navigate in this environment and will be designed to find seeds in sandy soil.
            
            The Ant & the Robot
            Ants of this species are of two types: breeding ants (queens and drones) and sterile female workers. Queens and drones will not be considered in this proposal, as their behaviors and design is much more specialized and would be applicable only during the breeding season, which occurs but once per year. The behaviors of the sterile workers may be divided into several subcategories: brood care, nest maintenance, patrolling and foraging. Little is known about brood care, as this occurs only in the deepest regions of the nest and observation would generally require the destruction of the nest. Nest maintenance and seed processing are likewise difficult to observe in the deeper regions of the nest, but the sorting and deposition of waste dirt and nest garbage outside of the nest (midden work) occurs close enough to the surface to be observable. Patrolling and foraging, too, occur for the most part outside of the nest, and have therefore been studied extensively (ex., Schafer, et al, 2006; Gordon, et al, 2002; Gordon, 2002; Gordon, 1987). It is therefore these three behaviors that I would like to focus on in this proposal: the others remain a bit too mysterious to yet model, and the ability of a robot to pass undetected in the depths of a colony would be very difficult to observe.
            These three behaviors each present different puzzles to the ant and to the modeler, though there is some overlap, particularly with navigational problems. In the case of midden work, Antie must be able to identify garbage, grasp it, carry it out of the nest, and deposit it about halfway down the mound before returning to repeat the process ad infinitum (or until stimulated to switch behaviors). Patrolling may be divided into two distinct sub-behaviors, nest patrolling and trail patrolling. An ant engaged in nest patrolling must exit the nest at the proper time in the morning and wander about for a bit on the nest mound, presumably taking measurements of the temperature and humidity in some way and making sure that it is safe for the other ants to exit. Perhaps the level of degradation of the nest patrollers’ cuticular hydrocarbons after this short foray into the sun and heat acts as an indication of the outside conditions to the foragers, who may then, upon smelling the returning patroller, be stimulated either to forage or to remain inactive inside the nest. An ant engaged in trail patrolling must exit the nest, wander around searching for food sources, identify food upon discovery and return to the nest to show the foragers where the food is. This is thought to be accomplished by the deposition of chemical markers from a gland on the abdomen that the patroller drags along the ground on her return route to the nest that the foragers may then follow (Gordon, 33-34; Holldobler et al, 1990, as cited in Webb, 1998). In addition to following these trails to the food, foragers must also be able to identify food, grasp it and carry it back to the nest. Ants engaged in all three behaviors must be able to identify other nestmates and their current tasks (as well as indicate to other ants their own nestmate status and current task), walk, navigate both within and outside of the nest, and of course switch tasks at appropriate times.
            
            The Agent 
            
            Chassis
            Antie will be implemented on a tiny Road Warrior robotic system. Behaviors will be coded in Interactive C, for which some pseudocode is included. Sensors will include a thermometer, photoreceptors, bump sensors, a polarization compass, and a series of chemical receptors. Antie be a circular robot, no more than 1cm in diameter (the length of a red harvester ant), with two driving wheels and one rear wheel for stabilization. A gripper will be located on the front of the robot consisting of two elongated tongs. Antie will also feature a skirt of bump sensors, sonar detectors and chemical emitters, including sacs of hydrocarbons extracted from ants of the nest being infiltrated and pheromones for successful patrolling and foraging. These sacs will be refilled at a filling station each morning as Antie determines that they are getting depleted. Antie will likewise recharge at a special station at night just inside the nest entrance. For the purposes of this proposal, I will assume that Antie has enough battery life to remain powered the whole day. A rudimentary blueprint of Antie is attached. (Fig 1)
            
            Sensors
            In order to inform itself about its environment, Antie will need a number of sensors. In an attempt to mimic the red harvester ant as closely as possible, these sensors include a thermometer, photoreceptors, bump sensors and sonar, a polarization compass, and a series of chemical receptors on a pair of stalks corresponding to the antennae. On its front grippers, Antie will have a tactile skin to sense pressure. The locations of the rest of these sensors will depend on their function.
            The thermometer will be located on the rear of the robot to keep it out of the way, and will detect and input to the robot the outside temperature in degrees Celsius. Harvester ants do not exit the nest when the outside temperature is above 52 degrees Celsius (Gordon, 9), and the ability to use a temperature gradient will enable in-nest navigation.
            Antie will also be equipped with one photoreceptor located in the middle of the top of its chassis corresponding to the ant’s eyes. These will be useful for initiating patrolling behavior in the morning and shutting off behaviors at night: the patrollers first poke their heads out of the nest shortly after sunrise and scuttle back in at night (Gordon, 5).
            The bump sensors and sonar will form a skirt around Antie to keep it from colliding with other objects. The sonar will constantly be detecting nearby objects and initiate an escape maneuver when their inputs pass a certain threshold of stimulation, and the bump sensors will, when depressed, also initiate the escape function. The sonar will correspond to the ant’s limited optical object detection ability, and the bump sensors will allow the robot to detect collisions.
            The polarization compass will consist of two polarized light sensors placed at 45 and -45 degrees from the center front of Antie, respectively, that will orient Antie towards a desired polarization pattern. These sensors would correspond to the cells in the ants’ eyes sensitive to polarized light, and research has shown that many insects, including ants, do navigate using a path integration system synthesizing input from a polarization compasses and from a sort of odometer (Labhart, et al, 2002). Antie would use a system for processing the input from its polarization compass based on the compass designed by Lambrinos, Moller, Labhart, Pfeifer and Wehner in 2000, consisting of two photodiodes with blue filters and polarizers. (Fig 2) The difference of their logarithmized signals would be returned to Antie, who will use a simultaneous model to navigate returns to the nest: Upon each exit from the nest, Antie will take a single 360o scan of the sky, and will orient itself according to an analytical procedure to derive compass information from different polarization patterns perceived later. This should be sufficient to return Antie to the nest, given the accuracy achieved by Lambrinos, et al and the relatively short periods of time that harvester ants spend outside the nest before returning.
            
            
               
            
            Fig. 2. Diagram of the polarization-opponent unit described by Lambrinos, et al (2000). The unit takes in polarization levels through the two polarization-sensitive photodiodes and feeds them into the logarithm ratio amplifier, which returns the difference of the logarithmized signals from the photodiodes. The e-vector (heading) returned from the two polarization-sensitive photodiodes (1, 2) follows a cos2-function.
            
            Ants themselves rely primarily on chemical information taken in through their antennae, and to mimic this, Antie will have chemical sensing and emitting “stalks” with which to both interact with other ants (who may be surprised to find an ant without antennae) and take in chemical information. These stalks will need to have receptors to measure the n-alkene levels present in another ant’s cuticular hydrocarbons, which research indicates is the marker for harvester ants of a nestmate’s current task, perhaps because the hydrocarbons are altered in the dry sun, causing a different ratio of n-alkanes to n-alkenes and the presence of branched n-alkanes in the hydrocarbon profile (Wagner, et al, 2001, as cited in Gordon & Greene, 2003). Antie’s stalks would also have receptors for the hydrocarbons themselves, which research shows indicate to the ants whether another ant is their nestmate (Arnold, et al, 1996, as cited in Gordon & Mehdiabadi, 1999), receptors to detect food, and receptors for three types of pheromones: those released by successful foragers returning with food, those released by successful patrollers returning to the nest, and those marking piles of trash as midden. Research shows that successful foragers returning to the nest do have a different effect on the inactive workers than unsuccessful foragers returning (Schafer, et al, 2006). Returning successful patrollers have an even greater effect on foraging activity: foragers will not leave the nest unless a patroller returns (Gordon, 2002), and the rate of foraging in a colony can be controlled by rolling glass beads coated with cuticular hydrocarbons extracted from patrollers into the nest (Gordon & Greene, 2003; Greene & Gordon, 2007). Midden seems to be marked in some olfactory way, since removing midden from nests makes them more likely to be invaded by other species (Gordon, 35). For the purposes of this proposal, I will assume that the nest maintenance and food processing ants have marked the midden with a particular pheromone. All of these chemical receptors will be arranged in an array on a pair of chemical stalks, with four of each type of receptor per stalk. This technique, described by Ishida, et al (2001), has been shown to improve the chemical plume-tracking abilities of robots. The wires will lead back down through the stalk to the on-board PC.
            Finally, Antie will have tactile sensors on its grippers to analyze the pressure being exerted on a gripped object. These sensors will be of the type patented by Peterson, et al (Patent #4,492,949), and will feature several layers of electrically insulating and parallel flexible conductive rods arranged such that an exerted pressure may be measured in output voltage. These will correspond to the muscles of the ant’s mandibles, which provide sensorimotor feedback to the ant when grasping objects. A table of the sensors and their relation to the ant’s sensory system is provided below.
            
            Fig 3. Table of sensors and their relations to the ant.
            
               
                     
                        Sensor
                     
                     
                        Relation to Ant
                     
                     
                        Placement on Antie
                     
                     
                        Function
                     
                  
                  
                     
                        Sonar detectors
                     
                     
                        Eyes; object perception
                     
                     
                        Skirt
                     
                     
                        Prevent object collisions!
                     
                  
                  
                     
                        Thermometer
                     
                     
                        Ants respond to different temperatures
                     
                     
                        Rear
                     
                     
                        In-nest navigation; tells Antie when to stop engaging in extra-nest activity
                     
                  
                  
                     
                        “Successful forager” pheromone chemical detectors
                     
                     
                        Antennae
                     
                     
                        Stalks
                     
                     
                        Forager behavior activation
                     
                  
                  
                     
                        “Successful patroller” pheromone chemical detectors
                     
                     
                        Antennae
                     
                     
                        Stalks
                     
                     
                        Detect and follow trails left by patrollers
                     
                  
                  
                     
                        Photoreceptor
                     
                     
                        Eyes; light perception
                     
                     
                        Center top
                     
                     
                        Find surface from inside nest; tell patrollers when to begin patrolling in the morning
                     
                  
                  
                     
                        Hydrocarbon alkene level detectors
                     
                     
                        Antennae
                     
                     
                        Stalks
                     
                     
                        Determine what task other ants are engaged in
                     
                  
                  
                     
                        Cuticular hydrocarbon detectors
                     
                     
                        Antennae
                     
                     
                        Stalks
                     
                     
                        Determine whether an ant is a nestmate
                     
                  
                  
                     
                        Chemical seed detectors
                     
                     
                        Antennae
                     
                     
                        Stalks
                     
                     
                        Determine whether an object is a seed or not
                     
                  
                  
                     
                        Polarized photoreceptors 
                     
                     
                        Retina
                     
                     
                        45 and -45 degrees from center on top
                     
                     
                        Polarization compass
                     
                  
                  
                     
                        Midden pheromone chemical receptors
                     
                     
                        Antennae
                     
                     
                        Stalks
                     
                     
                        Determine whether an object is midden or not
                     
                  
            
            
            
            Motors
            Antie’s motors will allow it to move around and interact with its environment and fellow ants. There will be two individually operated motors to drive the two side wheels in lieu of legs. Two simultaneously operated motors will open and close the grippers, emulating the grasping power of the ant’s mandibles. A third motor will lift and lower the grippers, allowing Antie to raise and lower gripped items as an ant would by raising and lowering its head. Three small sprayers will emit successful patroller and forager pheromones and cuticular hydrocarbons from the appropriate sacs. These will be located in different places: the sprayer for the successful patroller pheromone will be located on the rear at the base of Antie, corresponding to the glands that researchers believe the ants drag along behind them to mark returning paths, while the successful forager and cuticular hydrocarbon sprayers will be located on the skirt. Antie will not spray different pheromones depending on its task, on the assumption that its time in the sun will alter its hydrocarbons enough that its tasks will be recognizable to other ants. Almost all motor output will be a direct function of sensory input as indicated in the following section.
            
            The Behavior
            
            Antie will have a hybrid software architecture: a subsumption hierarchy will be responsible for switching between behaviors, but many sub-behaviors will operate on a schema basis. Pseudocode will approximate this architecture as closely as possible, and where appropriate, different subroutines running on a schema basis will be marked.
            
            Common Behaviors
            A few sub-behaviors will be necessary for more than one behavior. To ease Antie’s on-board memory requirements and processing capabilities (and to make all the rest of the pseudocode easier for the reader to understand), I propose a few global variables and subroutines.
            The following global variables will be used throughout the pseudocode, and are compiled here for ease of reference:
            
            // number representing calibration for speed
            double calibrate = 0;
            
            // constant representing the light at sunrise
            double sunrise;
            
            // outputs
            double left_motor_OP = 0;// left wheel motor
            double right_motor_OP = 0; // right wheel motor
            
            // inputs
            double photo_IP;// photoreceptor
            double temp_IP;// thermometer
            
            // Array inputs from left and right midden pheromone 
            // detectors. Assume a function to determine more precise
            // location, returning these variables:
            double left_midden_IP;
            double right_midden_IP;
            
            // Array inputs from left and right alkene sensors. Assume a 
            // function to determine location:
            double left_alk_avg_IP;
            double right_alk_avg_IP;
            
            // Array inputs from left and right successful forager 
            // sensors. Assume a function to determine location:
            double left_sucfor_IP;
            double right_sucfor_IP;
            
            // Array inputs from left and right “successful patroller”
            // sensors. Assume a function to determine location:
            double left_sucpat_IP;
            double right_sucpat_IP;
            
            // Array inputs from left and right nestmate hydrocarbon 
            // detectors. Assume a function to determine location:
            double left_hydrocarb_IP;
            double right_hydrocarb_IP;
            
            // Array inputs from left and right chemical seed detectors.
            // Assume a function to determine location:
            double left_seed_IP;
            double right_seed_IP;
            
            
            // inputs from left and right sonar sensors:
            double left_sonar_IP;
            double right_sonar_IP;
            
            // Booleans representing detection
            boolean food_detect = false; // is an object food?
            boolean midden_detect = false; // is an object midden?
            boolean nestmate_detect = false; // is an object a nestmate?
            boolean sucfor_detect = false; // successful forager
            boolean forager_detect = false; // forager
            boolean midworker_detect = false; // midden worker
            poolean patroller_detect = false; // patroller
            boolean sucpat_detect = false; // successful patroller
            
            // thresholds at which inputs may be declared to
            // have been detected
            double food_threshold;
            double midden_threshold;
            double hydrocarb_threshold; // nestmate hydrocarbons
            boolean forage_active = false; // activation status as forager
            
            
            Common behaviors will include a forward cruise and turning mechanism, procedures to determine the orientation towards nest and the distance from the nest when outside, in-nest navigation, an escape function for when objects are detected or bumped into, object identification and gripping, a generic algorithm for pheromone plume and chemical trail following, and the identification of other ants.
            For a simple start, the forward cruise function will merely take in a double integer representing a speed and cause Antie to move forward at this speed.
            
            // Forward cruise
            // Takes in a number representing the desired speed.
            // Causes robot to cruise forward at said speed.
            // Speeds assumed to be on a 1-10 scale (10 being fastest).
            
            void forCruz(double speed) {
            // Each wheel input "gets" the appropriate speed
            // Calibrate is a double representing a calibration
            // initialized to zero and altered as necessary.
            
            // The robot will receive the “GO” command as long as
            // this function is running.
            
            left_motor_OP = speed + calibrate;
            right_motor_OP = speed;
            } // end forCruz
            
            A similar rotate function will be used to orient Antie towards a particular heading.
            
            // Rotate
            // Takes in a desired angle to rotate the robot and 
            // rotates accordingly
            // Assume that 10s is sufficient to rotate the robot 
            // completely around one wheel; this may be changed 
            // in implementation.
            
            void rotate(int angle) {
            // If angle to turn is to the right, rotate left wheel 
            // for a portion of 10s in accordance with desired 
            // angle's proportion of a circle
            if(angle>0) {
            while ([timer] < 10 * angle / 360) {
            left_motor_OP = 5;
            right_motor_OP = 0;
            }
            // else rotate right wheel for appropriate portion of 10s
            else {
            while ([timer] < 10 * angle / 360) {
            left_motor_OP = 0;
            right_motor_OP = 5;
            } // end while
            } // end else
            } // end rotate
            
            These behaviors will often be used in other subroutines running on a schema basis, and when combined with the forward cruise function, should cause the robot to move at an angle.
            In order to orient itself toward the nest while navigating outside, Antie will need to determine which direction the nest is in and rotate toward that heading, and also how far from the nest it is at its current location. The orientation and distance should be calculable by the polarization pattern according to the system set up by Lambrinos, et al. Antie will therefore have a polarization function that will return a compass direction toward which it should orient in order to return home to the nest, and a distance function that will return the shortest direct distance. We may assume that this first function will return a direction in degrees, positive or negative, and that the second function will return a distance in centimeters. The first function might look something like this:
            
            // Nest Orient
            // Takes in the polarization sensitive photo diode inputs
            // and returns the location of the nest in degrees.
            int nestOrient(double left_POL_IP, double right_POL_IP) {
            int degrees = 0;
            // Calculates direction of nest, and returns as degrees.
            return degrees;
            } // end nestOrient
            
            The second function, which would return the distance in centimeters, might look something like this:
            
            // Nest Distance
            // Takes in the polarization sensitive photo diode inputs
            // and returns the current distance to the nest.
            int nestDist(double left_POL_IP, double right_POL_IP) {
            int dist = 0;
            // Calculates distance from nest, returning distance in cm.
            return dist;
            } // end nestDist
            
            In-nest navigation will be a function of the temperature, read by Antie’s thermometer and a light source. To exit, Antie will seek a high temperature until the photoreceptor reaches a threshold of stimulation indicating sunlight, and to get deeper, Antie will seek a lower temperature. The code may look something like this:
            
            // Exit Nest
            // Uses temperature gradient to navigate towards the nest
            // entrance from inside
            
            void nestExit() {
            // Reads temperature, scoots forward 1s, reads temperature
            // again, takes the difference, and determines whether current 
            // heading is increasing temperature reading. If not, rotates // 45 degrees and tries again.
            while(photo_IP < sunrise) {
            double temp = temp_IP;
            while([timer] < 1){
            forCruz(5);
            }
            temp -= temp_IP;
            if(temp>0) rotate(45);
            } // end nestExit
            
            To enter the nest, such as at the end of a task, Antie will perform the same function, except it will seek a lower temperature instead of a higher temperature, it will avoid light, and it will only activate while Antie is less than 10cm from the nest entrance. This void function will be called nestEnter(), and will take in no inputs. 
            To avoid bumping into things (including other ants), Antie be provided with an escape function. Each of Antie’s eight bump sensors will cause the robot to rotate a different amount, and the sonar will cause it to rotate 90 degrees in the opposite direction. Regardless, this will be a very simple function. I will include one example:
            
            // Escape
            // Escapes from danger when bump sensors or sonar are 
            // activated.
            
            void escape() {
            // Declare and initialize left bump sensors in 
            // order from front to back.
            bump_left1;
            bump_left2;
            bump_left3;
            bump_left4;
            // Declare and initialize right bump sensors in 
            // order from front to back.
            // Sonar sensors are globally declared.
            
            if(bump_left1) {
            // reverse … (at reduced speed)
            forCruz(-3);
            // … and rotate!
            rotate(45);
            }
            } // end escape
            
            Because this function responds to the sensors on Antie’s around the sides and only its sonar detectors will be able to detect objects in front of it, this escape function will not prevent Antie from being able to locate and pick up objects such as seeds.
            Before picking objects up, however, Antie will need to identify them. This object detection process will be activated when the front bump sensor is stimulated or when both sonar detectors are stimulated. Chemical inputs will be checked to see what this object is most likely to be given its smell. Objects will include midden and food. The code may look something like this:
            
            // Object Identification
            // Identifies an object that has snuck up on the 
            // unsuspecting robot.
            
            void objID() {
            // Declare and initialize front bump sensor.
            // Sonar sensors are globally declared.
            
            // Check inputs to determine which smell is strongest
            // if food smell is detected at higher rate and 
            // above the food threshold for detection, Antie 
            // assumes object is food
            while (bump_front || (sonar_left_IP && sonar_right_IP)) {
            if(((left_midden_IP + right_midden_IP) 
            < ((left_food_IP + right_food_IP))
            && ((left_food_IP + right_food_IP) 
            > food_threshold) {
            food_detect = true;
            }
            // if midden smell is detected at higher rate 
            // and above threshold for midden detection, 
            // Antie assumes object is midden
            else if(((left_midden_IP + right_midden_IP) 
            > ((left_food_IP + right_food_IP))
            && ((left_midden_IP + right_midden_IP) 
            > midden_threshold) {
            midden_detect = true;
            }
            } // end objID
            
            Once the object has been identified, Antie may grip it and lift it. A simple void function grip() taking in no inputs will tighten the grippers until a certain threshold of pressure is reached, at which point the grippers will be lifted for carrying. A void function release() will perform this same action in reverse.
            Antie will also need to follow several different kinds of chemical gradient trails: it will need to track the trails left by successful patrollers, and localize the source of food-odors and midden-odors. Implementations of chemical gradient following robots using two sensors on “antennae” stalks has been successful in with analog robots in the past (Webb, 1998), regardless of the potential problem of airflow causing a disturbed gradient over evaporating pheromones. As a partial control for the problem of imprecise sensing, a function will perform an analysis of the array information coming on from Antie’s four sensors on each stalk. The differences between these outputs is what is being compared everywhere there is a “left_IP” or “right_IP.” Antie will use the chemical gradient algorithm of Braitenberg’s aggressive type 2 vehicle described in his book “Vehicles: Experiments in Synthetic Psychology,” as this was found through a series of experiments by Russell, et al (2003) to be very efficient when compared to several biomimetic models. Because the same general algorithm will be followed for the localization of all three chemical traces, I will provide pseudocode for only one generic subroutine. Note that a portion of this subroutine does run on a schema basis:
            
            // Follow Gradient
            // Follows a generic chemical gradient, seeking a higher
            // concentration.
            
            void gradientFollow() {
            // Compares left and right inputs and activates opposite
            // motor to a greater degree. 
            if (left_IP > right_IP) {
            [schema] {
            rotate(-90);
            forCruz(5);
            } // end schema
            } // end if
            if (right_IP > left_IP) {
            [schema] {
            rotate(90);
            forCruz(5);
            } // end schema
            } // end if
            else forCruz(5);
            } // end gradientFollow
            
            For the purposes of calls later in the pseudocode, I will refer to these subroutines as trailFollow(), findFood(), and findMidden(). All three are void and take no inputs.
            The final common subroutine will be one for the identification of other ants. When both sonar sensors are stimulated simultaneously, Antie will check hydrocarbon inputs and determine whether the detected object is a nestmate. As harvester ants tend not to engage aggressively with non-nestmates, Antie will only identify other ants as ants if they belong to its nest. Research has shown that red harvester ants may identify the tasks nestmates are engaged in based on the ratio of n-alkenes to n-alkanes in their hydrocarbons and the presence or absence of branched n-alkanes. The difference in ratio is caused by the time ants spend outside in the sun, which depletes their n-alkene levels. Antie will attempt to determine the tasks of other ants by sensing only the n-alkene levels. The code will be similar to the object identification subroutine and may look something like this:
            
            // Ant Identification
            // Identifies an ant that has snuck up on the 
            // unsuspecting robot.
            
            void antID() {
            while (left_sonar_IP && right_sonar_IP) {
            // Are hydrocarbons present? (Is this a nestmate?)
            if((left_hydrocarb_IP + right_hydrocarb_IP)
            > hydrocarb_threshold) {
            nestmate_detect = true;
            // In what task is the nestmate engaged?
            if (n-alkene level is appropriate for a forager) {
            forager_detect = true;
            }
            if (n-alkene level is appropriate for a patroller) {
            patroller_detect = true;
            }
            if (n-alkene level is appropriate for a midden worker) {
            midworker_detect = true;
            } // If not midden work, foraging or patrolling, ignore
            } // If not nestmate, ignore
            }
            } // end antID
            
            Using these basic common behaviors, more complex behaviors may be coded.
            Red harvester ants do not retain one task throughout their lifespan, but instead change their behaviors as is appropriate for the colony (Gordon, 1996). Research has shown that red harvester ants switch tasks partially as a function of age (ex., Ingram, et al, 2005) and partially as a function of interactions with other workers (ex., Schafer et al, 2006; Gordon, 2002; Greene & Gordon, 2007). Younger ants work more inside the nest, and older ants work more outside the nest. As a result, I will model the three main behaviors in the order that they are to be engaged in. Midden work, which consists of moving dirt between the inside of the nest and the outside, will occur first; patrolling, which involves a shorter overall amount of time spent outside, will occur second; and foraging will be the final behavior. Finally, I will discuss a main method encoding the task switching between these behaviors.
            The midden work behavior will be Antie’s default initial behavior. It will be initiated in the morning by the sunrise, and will continue until the outside temperature reaches 52­­­oC, at which point all red harvester ants must return to the nest. As previously stated, a midden worker must identify midden, grasp it, and carry it to the surface, depositing it halfway down the mound before returning to collect more midden. A program encoding this behavior might look like this:
            
            //////////////////////////////////////////////////////////
            // MIDDEN WORK
            //////////////////////////////////////////////////////////
            // Antie will leave nest in the morning after sunrise,
            // carrying bits of midden halfway down the nest mound
            // and depositing them. Antie will return to the nest and
            // repeat this task until the temperature reaches above
            // 52 degrees Celsius.
            
            void midden() {
            
            // Initiated by sunrise, stopped by temperature
            while (photo_IP > sunrise && temp_IP < 52) {
            // Find midden and identify any found objects. If
            // they are midden, grip and carry outside nest.
            findMidden();
            objID();
            if(midden_detect) {
            grip();
            nestExit();
            // cruise to halfway down the nest mound
            while(nestDistance() < 25) {
            forCruz();
            }
            release();
            // reset midden_detect
            midden_detect = 0;
            nestEnter();
            } // end if
            } // end while
            } // end midden
            
            The second behavior, patrolling, involves two sub-behaviors: nest patrolling and trail patrolling. Nest patrolling will involve leaving the nest, roaming around on the nest mound for a few minutes, and reentering the nest. This behavior will be implemented in two parts, with a task-switching algorithm based on age. Research shows that ants do change their behaviors based partly on their perceived life expectancy (Moron, et al, 2007), and that task-switching is partly genetically controlled by a switch in gene expression as the individual ages (Ingram, et al, 2005). It is therefore reasonable to assign a constant age at which Antie will switch from nest patrolling to trail patrolling. In order to perform both of these functions, Antie will need a subroutine to explore in a zig-zag fashion, as harvester ants do (Gordon, 34). Harvester ants display a preference to wander in familiar territory, though foragers and patrollers do sometimes wander into other nests’ territories (Gordon, 57-60). To control for this behavior, Antie’s explore subroutine will display a preference for exploration in places where there is a low gradient of nestmate pheromones. This model is reasonable because patrollers and foragers change their explored territory from day to day, even though they do retain some more commonly chosen paths (Gordon, 45). The code may look something like this:
            
            // Explore
            // Takes in desired distance from nest to explore 
            // in cm and moves in a slightly randomized zigzag 
            // pattern
            
            void explore(int distance, int time) {
            // Local Variables
            int time=0; // integer representing the time to 
             // wander one direction
            int angle=0; // integer representing number of 
             // degrees to rotate
            int dir=0; // integer representing the direction to 
             // turn (0=right, 1=left)
            
            // Random number generator to add a bit of wanderlust
            RandomGenerator rGen = new RandomGenerator();
            
            // While loop; robot will keep zigging and zagging 
            // for a set amount of time
            while ([timer] < time) {
            if (ant's distance from nest < distance) {
            // int time gets a random number of seconds 
            // between 3 and 10
            time = rGen.nextInt(3,10);
            // int angle gets a random number of degrees 
            // between 15 and 75
            angle = rGen.nextInt(15,75);
            
            // function call to rotation subroutine
            // if dir is 0, rotate to the right; if dir 
            // is 1, rotate to the left.
            if (dir==0) {
            dir = 1; // dir changes direction- turn 
             // left next time
            rotate(angle); // rotate to the right
            } else {
            dir = 0; // dir changes direction- turn 
             // right next time
            rotate(-angle); // rotate to the left
            } // end rotation call
            
            // while loop to count down number of seconds 
            // using a timer
            while ( [timer] < time) {
            // command to go forward is given
            goForward = 1;
            // call to forward cruise function; 
            // straight cruise
            forCruz(5,5);
            } // end timer while loop
            } // end distance from nest while loop
            // if ant is approaching the desired distance,
            // double back (at angle) to explore more!
            if (ant's distance from nest ==
            distance - some small constant) {
            rotate(135);
            } // end if
            // Avoid leaving nest territory
            else if (nestmate pheromones IP < very low threshold) {
            while([short timer]) {
            forCruz(5); // explore a bit further
            } // end while
            rotate(45);
            } // end if
            } // end if (distance from nest < distance)
            } // end explore
            
            Nest patrollers will only call this behavior for a short distance before returning to the nest to idle for a few minutes and exit again. Trail patrollers will go much further, until food sources are found, and will then orient towards the nest and create trails for the foragers to follow. A general site of food is all that the patroller need find; the foragers will dig through the sand for the food. Code for the patrolling behavior might look like this (note that part is on a schema basis):
            
            /////////////////////////////////////////////////////////////
            // PATROLLING
            /////////////////////////////////////////////////////////////
            //
            // Main patrolling behavior function.
            // Includes nest patrolling, trail patrolling and the
            // stimulation and thresholds to initiate and switch between
            // the two.
            
            // Nest Patrolling
            // Patrollers' first job of the day: exit the nest and
            // explore the nest mound, taking measurements.
            void nestPatrol() {
            while (photo_IP > [light at sunrise]
            && temp_IP < 52 degrees Celsius ) {
            nestExit();
            // Nest mounds are generally up to 1m across
            // Thus, explore in a 50cm radius (Gordon, 6)
            explore(50, 120);
            [schema] {
            rotate(nestOrient());
            forCruz(5);
            nestEnter();
            }
            wait a short time
            } // end if
            } // end nestPatrol
            
            // Trail Patrolling
            // Patrollers exit nest and attempt to find food. Once food
            // is found, they mark a trail leading back to it while
            // taking the most efficient route home.
            void trailPatrol() {
            while (photo_IP > [light at sunrise]
            && temp_IP < 52 degrees Celsius ) {
            nestExit();
            // Explore no further than about 15m from nest, for no
            // more than 20 minutes
            if (food_IP > some low threshold){
            findFood();
            if (food_detect) {
            [schema] {
            rotate(nestOrient());
            forCruz(5);
            spray “successful patroller” pheromone
            nestEnter();
            }
            wait a short time
            }
            }
            else {
            explore(1500, 20 * 60);
            [schema] {
            rotate(nestOrient());
            forCruz(5);
            nestEnter();
            }
            wait a short time
            }
            } // end if
            } // end trailPatrol
            
            For the task-switching in the patrolling behavior, assume some variable “age” that Antie has been keeping track of using the CPU’s clock pulses to track the time since its last bootup. The integers nestpatrol_age and trailpatrol_age will represent the ages at which it is appropriate to switch to these tasks.
            
            // PATROLLING
            // Task-switching hierarchy for the two types of patrolling
            void patrol() {
            while (age > nestpatrol_age && age < trailpatrol_age) {
            nestPatrol();
            }
            while (age > trailpatrol_age && age < forage_age) {
            trailPatrol();
            }
            }
            
            The final behavior, foraging, will involve one extra subroutine that will employ an algorithm designed by R. Andrew Russell to localize an object through sand based on a chemical plume. This will emulate the digging that foragers must often do in order to locate seeds, and will enable Antie to accurately retrieve seeds for its host nest. This algorithm will keep track of the last two intensities of the desired chemical input and compare them. It would also keep track of whether the last rotation was clockwise or counter-clockwise. The code for this, adapted from Russell’s paper, might look like this:
            
            // Hex-path search
            // Localizes an object through sand using chemical detection
            void hexSearch() {
            double intense1 = inensity at n-1;
            double intense2 = intensity at n-2;
            while (nothing in grippers) {
            if (((intense2 > intense 1)
            && last rotation was counterclockwise)
            ||
            (((intense2 < intense1)
            && last rotation was clockwise)) {
            rotate(-60);
            while([short timer]) {
            forCruz(5);
            }
            } // end if
            else {
            rotate(60);
            while([short timer]) {
            forCruz(5);
            } // end while
            } // end else
            } // end while
            } // end hexSearch
            
            Foragers will follow trails marked by patrollers to their conclusion before collecting food to bring back to the nest, even if more tantalizing food presents itself in their path (Gordon, 47). To address this, a strict subsumption hierarchy will make sure that the foragers do not stop to collect food too soon. The code might look like this:
            
            /////////////////////////////////////////////////////////////
            // FORAGING
            /////////////////////////////////////////////////////////////
            //
            // Main foraging behavior function.
            // Foragers will exit the nest upon activation and follow
            // a trail laid by the patrollers. Upon completion of the
            // trail-following, will locate and grip food, returning
            // to the nest. Boolean forage_today represents Antie’s
            // activation status for each day once it has switched to 
            // the foraging behavior.
            
            void forage() {
            // Wait for a successful patroller to return.
            if (sucpat_detect) forage_today = true;
            while (forage_today && temp_IP < 52) {
            nestExit();
            trailFollow(); // Follow successful patroller trail.
            // Note that this is NOT a schema basis, which would 
            // cause Antie to stop and retrieve food encountered en 
            // route.
            // When end of plume is reached, retrieve food.
            while (!food_detect) {
            // while food has not yet been found, continue searching 
            // and identifying found objects
            hexSearch();
            objID();
            }
            // Once that loop has been broken, return to nest
            [schema] {
            // grip food and return to nest
            grip();
            rotate(nestOrient());
            forCruz(5);
            nestEnter();
            }
            // release food just inside nest entrance
            release();
            } // end while
            } // end forage
            
            Of course, what makes Antie an innovative robot is the task-switching between these larger behaviors. Because the midden work behavior is Antie’s initial default behavior, I will not address task switching to midden work. Workers probably switch to patrolling based on their perceived life expectancy and as a function of a gene whose expression changes between young and old ants, and this is easily emulated using a clock pulse counter in Antie’s CPU that will count its “age” since last boot. To remind the reader, this technique was implemented earlier in this proposal to create the limited task-switching between nest patrolling and trail patrolling. The switch from patrolling to foraging has been modeled as a function of successful foragers’ returns with great accuracy by Schafer, et al (2006), and evidence from experiments in which successful foragers were removed before reentry to the nest does support the theory that returning successful foragers have an effect on the activation of new foragers (Gordon, 2002). Activated foragers form a queue to exit the nest and exit at a steady rate. According to Schafer’s, et al. model of forager activation, every time a successful forager returns and no foragers are currently in line to exit, a fraction (modeled at 0.0035) of inactive foragers joins the queue. For the purposes of modeling Antie, I will assume that the switches between these behaviors are permanent, irreversible and partly a function of age, with new foragers being activated by returning successful foragers. The code to model this task-switching might look something like this:
            
            /////////////////////////////////////////////////////////////
            // TASK-SWITCHING
            /////////////////////////////////////////////////////////////
            //
            // Main function of Antie’s software. Examines the task-
            // switching criteria and determines when Antie will perform 
            // what behavior. Int “age” is an integer representing the
            // time since Antie’s last boot, corresponding to the age
            // of an ant being simulated. Int nestpatrol_age refers to the 
            // starting age at which Antie will begin to nest patrol; 
            // forage_age refers to the starting age at which Antie may be 
            // activated to forage. This would correspond to the change in 
            // gene expression described by Gordon (2002).
            
            main() {
            // default to midden work
            while (age < nestpatrol_age) {
            midden();
            } // end while
            // switch to patrolling behavior based on age
            while (nestpatrol_age < age && age < forage_ave) {
            patrol();
            } // end while
            // switch to foraging as a function of time, but 
            // remain inactive until stimulated by returning 
            // successful foragers
            // Assume that inactive foragers will not smell different 
            // from patrollers, which was their last task, because 
            // they have not yet spent sufficient time in the sun.
            if (sucfor_detect at time n-1 == false 
            && sucfor_detect at time n == 1) {
            0.0035 probability: forage_active = true;
            }
            
            while (age > forage_age && forage_active) {
            forage();
            }
            } // end main
            
            
            Conclusion
            
            Antie will be a fully autonomous, situated and embodied agent, infiltrating a red harvester ant colony and providing valuable information not only about the hypothesized rules of these ants’ behaviors and their task-switching thresholds, but also about the combination of complex behaviors into a single autonomous system with the ability to switch between behaviors as necessary. Biomimetic robots have long been a rich source of information for both biologists and robotics engineers, and complex robots that can switch tasks as the situation demands and communicate information about current tasks could be useful for further studies of complex robot behaviors as well as for the obvious practical applications of robot swarms, such as on the battlefield and standard building maintenance.
            
            
            
            
            
            
            
            
            
            REFERENCES
            
            Braitenberg, V. Vehicles: Experiments in Synthetic Psychology. MIT Press: Cambridge, MA, 1984.
            
            Gordon, D.M., & Greene, M.J. Cuticular hydrocarbons inform task decisions. Nature 32 (2003).
            
            Gordon, D.M. The regulation of foraging activity in red harvester ant colonies. American Naturalist 159, 509-518 (2002).
            
            Gordon, Deborah. Ants at Work: How an Insect Society is Organized. Norton: New York, NY, 2000.
            
            Gordon, D.M. The organization of work in social insect colonies. Nature 380, 121-124 (1996).
            
            Greene, M.J., & Gordon, D.M. Interaction rate informs harvester ant task decisions. Behavioral Ecology: Advance Access, published January 22, 2007.
            
            Halloy, J., Sempo, G., Caprari, G., Rivault, C., Asadpour, M., Tache, F., Said, I., Durier, V., Canonge, S., Ame, J.M., Detrain, C., Correl, N., Matrinoli, A., Mondala, F., Siegwart, R., & Deneubourg, J.L. Social integration of robots into groups of cockroaches to control self-organized choices. Science 318, 1155-1158 (2007).
            
            Holldobler, B., & Wilson, E.O. (1990). The ants. Berlin: Springer-Verlag. As cited in Webb, B. Robots, crickets and ants: models of neural control of chemotaxis and phonotaxis. Neural Networks 11, 1479-1496 (1998).
            
            Ingram, K.K., Oefner, P., & Gordon, D.M. Task-specific expression of the foraging gene in harvester ants. Molecular Ecology 14, 813-818 (2005).
            
            Ishida, H., Nakamoto, T., Moriizumi, T., Kikas, T., & Janata, J. Biol. Bull 200, 222-226 (2001).
            Labhart, T., & Meyer, E.P. Neural mechanisms in insect navigation: polarization compass and odometer. Current Opinion in Neurobiology 12, 707-714 (2002).
            
            Lambrinos, D., Moller, R., Labhart, T., Pfeifer, R., & Wehner, Rudiger. A mobile robot employing insect strategies for navigation. Robotics and Autonomous Systems 30, 39-64 (2000).
            
            Moron, D., Witek, M., & Woychiechowski, M., Division of labor among workers with different life expectancy in the ant Myrmica scabrinodis. Association for the Study of Animal Behavior (2007), doi:10.1016/j.anbehav.2007.06.005.
            
            Peterson, R.R., Schubert, D.W., & Cholakis, P.N. "Tactile sensors for robot gripper and the like." U.S. Patent 4,492,949. 8 January 1985.
            
            Russell, R.A. Chemical source location and the RoboMole project. Intelligent Robotics Research Centre, Monash University, Clayton, Australia. Contact: andy.russell@eng.monash.edu.au
            
            Russel, R.A., Bab-Hadiashar, A., Shepherd, R.L., & Wallace, G.G. A comparison of reactive robot chemotaxis algorithms. Robotics and Autonomous Systems 45, 83-97 (2003).
            
            Schafer, R.J., Holmes, S., & Gordon, D.M. Forager activation and food availability in harvester ants. Animal Behavior 71, 815-822 (2006).
            
            Webb, B. Robots, crickets and ants: models of neural control of chemotaxis and phonotaxis. Neural Networks 11, 1479-1496 (1998).
            
         
    
      
   
