## SUMMARY

The American cockroach, *Periplaneta americana*, is reported to follow walls at a rate of up to 25 turns s^{–1}. During high-speed wall following, a cockroach holds its antenna relatively still at the base while the flagellum bends in response to upcoming protrusions. We present a simple mechanosensory model for the task-level dynamics of wall following. In the model a torsional, mass-damper system describes the cockroach's turning dynamics, and a simplified antenna measures distance from the cockroach's centerline to a wall. The model predicts that stabilizing neural feedback requires both proportional feedback (difference between the actual and desired distance to wall) and derivative feedback (velocity of wall convergence) information from the antenna. To test this prediction, we fit a closed-loop proportional-derivative control model to trials in which blinded cockroaches encountered an angled wall (30° or 45°) while running. We used the average state of the cockroach in each of its first four strides after first contacting the angled wall to predict the state in each subsequent stride. Nonlinear statistical regression provided best-fit model parameters. We rejected the hypothesis that proportional feedback alone was sufficient. A derivative (velocity) feedback term in the control model was necessary for stability.

## Introduction

Mechanosensory stimuli from antennae(Staudacher et al., 2005)mediate a breadth of locomotory behaviors including escape(Camhi et al., 1978; Comer and Dowd, 1993; Comer et al., 1994; Comer et al., 2003; Ye et al., 2003), slow-speed exploration (Okada and Toh,2000; Okada and Toh,2004; Okada et al.,2002; Dürr et al.,2001) and high-speed control(Camhi and Johnson, 1999). Specialized mechanoreceptors distributed along a highly segmented, compliant structure, the flagellum, detect contact and strain to provide tactile feedback (Schafer and Sanchez,1973; Schafer,1971; Seelinger and Tobin,1982; Slifer,1968). Stimuli can also displace the flagellum with respect to two basal segments, the scape and pedicel(Toh, 1981; Okada and Toh, 2000). How arthropods integrate this mechanosensory information depends on input from other sensory modalities, such as vision(Ye et al., 2003), and on the behavioral context, such as locomotion speed prior to or during antennal contact. At the slowest extreme, when a cockroach is initially standing,antennal contact can elicit an escape response(Camhi et al., 1978; Comer and Dowd, 1993; Comer et al., 1994). Basal receptors, as opposed to flagellar receptors, initiate escape turns, while prior flagellar (Comer et al.,2003) or visual (Ye et al.,2003) stimuli either directly or indirectly influence the response. During slow exploratory behaviors, animals actively sweep their antennae to provide rich information about their environment for self-orientation (Okada and Toh,2000; Okada and Toh,2004; Okada et al.,2002) and for slow-speed walking(Dürr et al., 2001). At the fastest extreme, rapidly running cockroaches use antennal feedback to follow surfaces with remarkable consistency, while holding the base of their antenna at nearly fixed angles relative to their body(Camhi and Johnson, 1999). The dominant information for task-level control of this behavior originates from the flagellum, with little-to-no contribution from the base of the antenna(Camhi and Johnson, 1999),though antenna base angle regulation likely requires basal proprioception. The long, passive, unactuated flagellum bends in response to objects in its environment and transduces contact and strain stimuli to neural impulses for control. Using this sensory input, cockroaches can execute extremely high fidelity maneuvers, reportedly achieving up to 25 turns s^{–1}in response to environmental stimuli (Camhi and Johnson, 1999).

We contend that control of rapid locomotion must be embedded in both neurosensory circuitry and an animal's mechanical system, and that a neuromechanical model of a sensory mediated behavior can lead to specific,testable hypotheses regarding afferent neural processing. We tested task-level control hypotheses using the antennal sensory system because of its effectiveness at high speeds, the ease of measuring performance, and the availability of well-developed mechanical models upon which we can build.

### Neuromechanical models

Legged locomotion results from complex, nonlinear, dynamically coupled interactions between an animal and its environment. Despite this complexity,simple patterns often emerge that are consistent with low-dimensional mechanical models or templates (Full and Koditschek, 1999). Legged locomotion in the sagittal plane is consistent with a spring loaded inverted pendulum (SLIP)(Cavagna et al., 1997; McMahon and Cheng, 1990; Blickhan, 1989; Schwind and Koditschek, 2000),a result that scales across the number of legs and three orders of magnitude of body mass (Blickhan and Full,1993; Farley et al.,1993). Similarly, horizontal plane locomotion in sprawled-posture animals is well characterized by the lateral leg spring template (LLS)(Schmitt and Holmes, 2000a; Schmitt and Holmes, 2000b),because animals also bounce side-to-side. Surprisingly, both templates exhibit passive, dynamic stability when perturbed, thus requiring minimal neural feedback (Full et al., 2002; Schmitt et al., 2002; Altendorfer et al., 2004; Seyfarth et al., 2002). The LLS template reveals that horizontal plane dynamics are asymptotically stable in all states except direction and speed, which are neutrally stable and thus both require active control (Schmitt and Holmes, 2000a; Schmitt and Holmes, 2000b).

To build upon prior mechanical locomotor templates, we incorporate antennal sensing and neural control of running direction directly into one mechanosensory template of antenna-based wall following. In contrast to the LLS model, which aims to capture the within-stride dynamics of cockroach locomotion (Schmitt et al.,2002; Seipel et al.,2004), our model focuses on the multi-stride dynamics.

### Wall-following dynamic model

*X*-axis points along the wall, and the

*Y*-axis points into the arena, as shown in Fig. 1. We model the cockroach as a planar rigid body. Let (

*x,y*) denote the position of a point we call the point of rotation (POR). Let

*v*denote the forward speed of the POR, and ϕ the velocity heading of the body POR, so that(

*v*sinϕ,

*v*cosϕ) is the POR velocity vector. Denote the body angle by θ, and let ω

*=d*θ/

*dt*denote the rotational velocity of the body. Cockroaches apply forces with their legs that keep the two angles θ and ϕ aligned during turning(Jindrich and Full, 1999),therefore we model the body angle and the heading as coincident at all times,namely:

*ẋ*=

*dx*/

*dt*. At each instant, the body moves forward in the heading direction at speed

*v*(assumed constant), while pivoting about the POR at angular velocity ω. The general robotics literature refers to this kinematic model as a `planar unicycle' (see Bloch,2003).

*d*, from the body centerline to the wall. The antenna senses ahead of the POR a fixed distance

*l*, which we call the preview distance(Fig. 1B). Under these assumptions,

*d*, changes as a function of the motion of the cockroach. We distinguish the model's effective preview distance,

*l*, from the physical contact distance,

*L*, which denotes the distance ahead of the animal that the antenna is touching the wall(Fig. 1A). The preview distance,

*l*, is based on the information available to the cockroach from a variety of potential mechanosensory receptors (e.g. campaniform sensilla, hair sensilla and marginal sensilla). The antenna may encode distance,

*d*, to the wall

*via*a variety of surrogate signals such as contact point, strain, antennal forces, contact area, or bend, or some combination, that are all likely to be highly correlated with the distance to the wall during wall following. Finally, neural and muscle activation delays may decrease the effective preview distance, a possibility explored in the Discussion.

*u*(Jindrich and Full, 1999). The polar moment of inertia,

*J*, and damping coefficient,

*B*,parameterize the `yaw' dynamics:

*G*(

*s*), between the moment,

*u*,and the antenna measurement,

*d*, as

*s*;head-to-wall distance,

*d*; input moment,

*u*; polar moment of inertia,

*J*; damping,

*B*; preview distance,

*l*; and forward velocity,

*v*. These reduce to four dimensionless groups:

*u*=

*ul*/

*Bv,*τ

*=Jv*/

*Bl,d*=

*d*/

*l*, θ; with

*s*=

*sl*/

*v*,where

*s*is the dimensionless complex frequency. Then, from Eqn 6 the dimensionless transfer function relating

*u*and

*d*can be written as:

*via*closed-loop feedback(Fig. 2). If the cockroach uses negative feedback from the antenna-based distance measurement

*d*, thenτ constrains the control structures that can stabilize the system.

*d*

_{∞}is the steady-state distance that the cockroach neural control system attempts to maintain and

*K*

_{P}is the feedback gain. For stability, the poles (zeros of the denominator) of the closed-loop system,

*K*

_{P}

*G*/(1+

*K*

_{P}

*G*), must have negative real parts. In non-dimensional terms, the closed-loop poles are given by the solutions of the characteristic equation:

*K*

_{P}is the dimensionless proportional gain. Routh's stability criterion (see Franklin et al.,1994) reveals that the system is stable (i.e. the roots of Eqn 10 have negative real parts) if and only if 0<τ

*<*1 and

*K*

_{P}>0.

*K*

_{D}is the gain of the derivative term, which encodes rate of approach to the wall. This additional derivative term helps to stabilize the system, allowing a greater range of allowable values for τ. Note that setting

*K*

_{D}=0 reduces the controller to P-control. The nesting of models enables statistical hypothesis testing of the P-Hypothesis (null) against the PD-Hypothesis (alternative). During model fitting, we obtain estimates for

*l*, as well as the ratios

*K*

_{P}/

*J, K*

_{D}/

*J*and

*B*/

*J*. The resulting values enable us to estimate the dimensionless constant, τ.

## Materials and methods

### Animal husbandry

Adult male American cockroaches *Periplaneta americana* L. were acquired from Carolina Biological Supply Company (Burlington, NC, USA) and housed in a ventilated plastic container. Cockroaches were exposed to a L:D cycle of 12 h:12 h and given fruits, vegetables, dog chow and water *ad libitum*.

### Wall-following arena

Our arena was similar to that used by Camhi and Johnson(Camhi and Johnson, 1999). A rectangular arena, 85 cm×45 cm×15 cm (length × width ×height), was enclosed with a galvanized aluminum sheet wall(Fig. 3A). The upper half of the aluminum wall was coated with petroleum jelly to prevent the cockroaches from escaping. A long, high-density fiber (HDF) block, 50 cm×5 cm×5 cm, was used as a part of the observation wall to view the cockroach's wall-following behavior. To induce turning, we placed HDF boards cut at angles of 30° and 45° in the middle of the first wall. Depending on where the cockroach started, it ran along either wall first using its right or left antenna for wall following. We noted this, but did not distinguish between the two scenarios for modeling. Henceforth, we refer to the wall that the cockroach initially tracks, either using their left or right antenna, as the control wall and refer to the wall that induces a turning behavior as the angled wall. The two walls collectively constitute the observation walls.

Two high-speed video cameras (Kodak EktaPro 1000, Eastman Kodak Company,Rochester, NY, USA) positioned approximately 1.5 m above the arena(Fig. 3A) captured the cockroaches' running behavior. A half-silvered mirror placed in front of each camera at 45° deflected light shone from a 150 W fiber-optic illuminator onto the running surface. There was little-to-no ambient lighting during the experiment. The two camera views of the observation walls overlapped slightly for camera calibration purposes and to ensure continuity of data from each trial (Fig. 3B). Each camera's field of view covered 35 cm in length of its respective wall, with an average resolution of 0.8 mm per pixel. The cameras synchronously captured images at 500 frames s^{–1}.

We captured video images (Fig. 4) of running cockroaches under low light using a retroreflective sheet from 3M (St Pauls, MN, USA) as the running substrate. Proper alignment of the lighting evenly illuminated the retroreflective running substrate and markers, simplifying detection and tracking of the cockroach, because the non-retroreflective walls, cockroach body and legs appeared as sharp silhouettes.

### Animal preparation

We prepared cockroaches inside a 4°C cold room as follows. After initially cooling the animals for 15–20 min, we anesthetized them using CO_{2}. While anesthetized, we attached two small round retroreflective markers to each animal's wings, approximately aligned with the body fore–aft axis, enabling us to estimate the cockroach's position and body angle from video images. The markers did not restrict the wings in any way. To block their visual senses, we covered their compound eyes and ocelli using a white nail polish, taking care to avoid the head/scape joint. This preparation process took less than 40 min per group of five cockroaches. After this preparation, the cockroaches recovered at room temperature for at least 24 h before testing.

### Kinematics

Prior to a set of trials with a cockroach, we placed it in the arena for several minutes to acclimate. When the insect walked into position at the initial part of the control wall, we induced an escape response by tapping the running substrate with a long stick near the posterior of the cockroach. Trials were accepted when the animal ran rapidly along the wall and executed a turn at the angled wall. Trials were rejected when (1) the cockroaches stopped or climbed the wall while they were in view of the cameras, (2) the distance of their POR to the wall deviated by more than 2.5 cm while running along the angled wall; this typically occurred when the animal appeared to voluntarily leave the wall and run into the open space of the arena, (3) their body(excluding their legs) collided with the angled wall, or (4) their antenna was not in a `bent backward' posture when the antenna first encountered the angled wall; this eliminated trials in which the tip was pointing forward, thereby wedging the antenna in the corner.

After each successful trial a cockroach rested for 2–3 min while we downloaded the recorded images to our workstation. When the animal stopped exhibiting the escape response from our perturbation or did not achieve any acceptable trials for 30 min, we switched to a different individual. An individual was never used for experiments twice in the same day.

Before each set of experiments, we captured an image from both cameras of a three-dimensional, non-coplanar block with retroreflective markers. The geometry of the markers was measured with a set of digital calipers. Using these data, we calibrated the cameras using the direct linear transform.

We extracted four quantities from each trial. First, our custom scripts(Matlab, The MathWorks, Inc., Natick, MA, USA) tracked the cockroach's two body markers to obtain the body's POR (see below) and body angle,(*x,y*,θ), for all frames(Fig. 4). We visually verified the tracking data by superimposing the predicted marker measurements onto the raw images. Second, custom Matlab scripts automatically determined (and visual inspection confirmed) the frame number for each posterior extreme position(PEP) of the outside hindleg, contralateral to the observation wall. Third, we manually determined the time at which the antenna ipsilateral to the wall first came in contact with the angled wall. This time is the start time of the perturbation, *t=*0. Fourth, we randomly selected 20 frames from which we manually digitized the antenna-wall contact points, 10 frames from the control wall and 10 frames from the angled wall. If the antenna was not in contact with the wall in the selected frame, a new frame was randomly selected. From these data, we obtained *L* (see Fig. 1A). The distance *L* provides an upper bound on the preview distance, *l* (see Fig. 1B).

### Finding the point of rotation

*v*

^{⊥}is the instantaneous velocity of the rear marker in the direction that is perpendicular to the heading (see Fig. 5). After approximating ω

_{i}and

*i*and

*i*+1, we performed a least-squares fit to find the best α, i.e.

*n*is the total number of frames in a given trial, and thus found the POR.

### Data filtering and normalization

For each trial, we collected a time series of cockroach positions and angles spaced at 2 ms intervals. We zero-phase forward- and reverse-filtered the data with a five pole, low-pass Butterworth filter with a cut-off frequency of 62.5 Hz, nearly three times the maximum observed frequency of angular motion (Camhi and Johnson,1999) during wall following. The origin of the reference coordinate system coincided with the corner where the control wall met the angled wall, with *X*-axis parallel to the angled wall, pointing in the direction of running, and *Y*-axis perpendicular to the angled wall,pointing into the open arena.

Because our model (Fig. 1)does not try to capture the detailed mechanics within each stride, we averaged the cockroach motion during each stride to estimate its state. We used the outer (contralateral to the wall) hind-leg PEP frame to segment the data into individual strides and averaged the data over each stride to obtain the values(

*k=*1, 2,... indicates the stride number and

*j=*1,...,

*N*indicates the trial number. The position during the

*k*

^{th}stride,(

^{j}

_{k}, during the

*k*

^{th}stride. We calculated the speed,

*v*

^{j}

_{k}, as the change in position of the POR between successive contralateral hindleg PEPs divided by the stride duration,

*t*

^{j}

_{k+1}–

*t*

^{j}

_{k}. Similarly we calculated the angular velocity,ω

^{j}

_{k}, as the change in angle divided by the stride period. The first stride (

*k=*1) for each trial was selected as the stride that began after the antenna first contacted the angled wall. The steady-state distance,

*d*

_{∞}, was approximated for each trial by averaging the last three strides in view. We observed that most cockroaches had regained quasi-steady running by this point, which was typically at least 20 cm and at least 5 strides after the perturbation.

To test the model for speed dependent parameters, we segmented it into two groups, `slow' and `fast'. The average speed was computed for each trial as the mean of the individual stride speeds, *v*^{j}_{k},for that trial. The fast group was comprised of trials whose average speed was greater than or equal to the median speed. The slow group were trials less than the median average speed. For each trial, the stride frequency was computed using the average time between successive outer hindleg PEPs.

For visualization purposes, we processed the data as follows. Each trial was normalized to distance traveled along the angled wall, with *x=*0 corresponding to the point where the control wall meets the angled wall. This corresponds to the start time of the perturbation, *t=*0, at *x*=0. In all trials, *x* increased monotonically through the trial. The data were linearly interpolated and renormalized resulting in a sequence of normalized observations(

*x=*0, 0.1,..., 30.0 cm. Lastly, we grouped and averaged trials of similar speed, so that simulated trajectories could be compared with averaged actual trajectories.

### Dynamic model fitting and testing

*p=*(

*l,B*/

*J,K*

_{P}/

*J,K*

_{D}/

*J*). Note that the position along the wall,

*x*, can be omitted from the formulation. We assume the parameters

*p*and the speed

*v*are constant during a trial. Given a set of parameters,

*p*, and the cockroach state,(

*k*of trial

*j*, the flow, Φ, predicts the state of the cockroach during the subsequent stride:

*y*

^{j}

_{k+1},θ

^{j}

_{k+1},ω

^{j}

_{k+1}),are model estimates for the subsequent stride of the same trial, andΔ

*t*

^{j}

_{k}=

*t*

^{j}

_{k+1}–

*t*

^{j}

_{k}is the stride duration. We evaluated the flow (Eqn 16) by simulating the dynamics (Eqn 14) for the full duration of a stride(using Matlab's ode45 command) to obtain the prediction of the state at the next stride of the same trial. We assumed the residual error,(

*y*

^{j}

_{k+1},θ

^{j}

_{k+1})–(

*y*

^{j}

_{k+1},θ

^{j}

_{k+1}),between the model and the measured cockroach position and angle was an independent and identically distributed Gaussian noise process with zero mean and unknown covariance. This assumption implies that each stride is an independent sample for nonlinear regression.

*k*=1,2,3,4) were considered for each trial, because after that point, most animals had almost fully recovered from the perturbation, and including more strides amounted to fitting small fluctuations that occurred during straight wall following. To fit the parameters of the controlled mechanosensory system, we followed the nonlinear statistical modeling framework described by Gallant(Gallant,1987)

^{1}. We used Gauss–Newton optimization to minimize the least-squares error between the observed stride states, and the stride-to-stride predictions thereof, namely:

*N*was the number of trials used for fitting (with four strides per trial), and

*M*is the estimated noise covariance matrix(Gallant, 1987). For computing confidence intervals (significance

*P=*0.05), we assumed 4

*N–*4 degrees of freedom (d.f.; 4

*N*independent state transitions and 4 fitted parameters). Because our goal was to test the overall model structure and the importance of derivative feedback for control, we did not fit the parameters to each individual animal. Moreover, doing so may be experimentally infeasible due to the large number of successful trials that are required for fitting. Thus, we fit all of the data simultaneously, and then divided the data into two groups by speed to determine if control system parameters were speed dependent. We also checked for very large variations between individuals by rerunning the statistics with data from each individual omitted.

Gallant's approach allows us to find the best fit for the parameters *p*=(*l*,*B*/*J,K*_{P}/*J*,*K*_{D}/*J*),while accounting for how random variations in the trials lead to uncertainty in the parameters. This is analogous to linear regression, e.g. fitting a line *y=mx+b*. Here, our `*x*' data are the states at the start of each stride, and our `*y*' data are the states at the end of each stride; the slope and intercept in linear regression are analogous to our unknown parameters, *p*. As is well known in linear regression, random fluctuations in the data affect parameter variances, and we arrive at similar results here, in a nonlinear setting.

*K*

_{D}=0 in Eqn 11, the P-control and PD-control hypotheses can be written:

*H*

_{P}against the alternative

*H*

_{PD}using a nonlinear version of the Student's

*t*-test with 4

*N*-4 d.f. and

*P=*0.05 significance.

## Results

We accepted a total of 59 trials from 11 individual cockroaches(mass=0.770±0.113 g, body length=3.70± 0.17 cm, antenna length=4.36±0.41 cm, shortest antenna= 3.81 cm, longest antenna=4.91 cm, means ± s.d.). The speeds ranged from 24.7 to 63.6 cm s^{–1} (7–17 strides s^{–1}), all of which were above that of metachronal walking(Watson and Ritzmann, 1998),and below the speeds for which four- and two-legged running emerges in *P. americana* (Full and Tu,1991). Therefore the stepping pattern was consistent for all speeds in the study: the animals always exhibited an alternating tripod gait(Delcomyn, 1971).

### Model validation

The planar unicycle assumption requires Eqn 1 to hold, namelyϕ=θ. To validate this assumption, we performed a least-squares fit of the stride-averaged ϕ and θ to the linear model,ϕ=β_{1}θ+β_{0}. The result wasβ _{1}=1.00±0.01 andβ _{0}=2.18±0.30° (*P=*0.05), with an *R*^{2} of 0.96 (see Fig. 6). The non-zero value of β_{0} may have resulted from the inconsistencies in the placement of the two visual markers along the fore–aft axis of the cockroach's body. Alternatively, occasionally, the cockroaches exhibited a wedging behavior during which they ran at a slight angle toward the observation wall.

### P-Control is insufficient

Table 1 shows the results of model fitting. For both slow running (35.2±3.8 cm s^{–1},7–13 strides s^{–1}, 29 trials) and fast running(48.3±6.0 cm s^{–1}, 10–17 strides s^{–1}, 30 trials), the null hypothesis *H*_{P}was strongly rejected in favor of *H*_{PD} (*t*-test;slow: *P*=0.01; fast: *P*<0.001). Fig. 7 shows the average trajectory of a cockroach when encountering a 45° angled wall, in addition to the model prediction. Note that these plots are different than what was used for fitting. For parameter fitting, we used the model to predict only from stride to stride, whereas in the summary data plots, the model generates the entire trajectory. To verify the importance of the derivative gain, *K*_{D}, we tested the model with *K*_{D}=0. In this scenario, the model predicts large excursions of the cockroach that would cause successive collisions with the wall interleaved with large departures into the open space, which is quite atypical. Clearly, the derivative gain in the model is behaviorally critical. When data from each individual were in turn omitted, there was no statistically significant difference in the parameters, so we concluded that any outlier effects were negligible. It was not possible to fit the model parameters to a single individual due to the large number of trials required to perform an accurate fit of the parameters.

Speed group . | Speed (cm s^{-1})
. | l (cm)
. | B/J (s^{-1})
. | K_{P}/J (s^{-2})
. | K_{D}/J (s^{-1})
. | Reject P-Control hypothesis? . |
---|---|---|---|---|---|---|

Slow (N=29) | 35.2±3.8 | 2.71±5.30 | 12.7±16.4 | 26.0±13.2 | 4.33±3.29 | Yes (P=0.01) |

Fast (N=30) | 48.3±6.0 | 2.55±6.79 | 10.6±37.7 | 25.1±14.8 | 6.18±3.30 | Yes (P<0.001) |

All (N=59) | 41.9±8.3 | 1.78±3.46 | 16.1±17.7 | 27.0±10.1 | 5.63±2.05 | Yes (P<0.001) |

Speed group . | Speed (cm s^{-1})
. | l (cm)
. | B/J (s^{-1})
. | K_{P}/J (s^{-2})
. | K_{D}/J (s^{-1})
. | Reject P-Control hypothesis? . |
---|---|---|---|---|---|---|

Slow (N=29) | 35.2±3.8 | 2.71±5.30 | 12.7±16.4 | 26.0±13.2 | 4.33±3.29 | Yes (P=0.01) |

Fast (N=30) | 48.3±6.0 | 2.55±6.79 | 10.6±37.7 | 25.1±14.8 | 6.18±3.30 | Yes (P<0.001) |

All (N=59) | 41.9±8.3 | 1.78±3.46 | 16.1±17.7 | 27.0±10.1 | 5.63±2.05 | Yes (P<0.001) |

A total of 59 trials from 11 individuals were included in the analysis.

Values indicate 95% confidence intervals.

There was no statistically significant dependence of the model parameters on speed, so we also fit all 59 trials (41.9±8.3 cm s^{–1}; mean ± s.d.) simultaneously to the model, which decreased the 95% confidence intervals of the parameters. The *R*^{2} value was 0.75. Again, *H*_{P} was strongly rejected in favor of *H*_{PD} (*t*-test, *P*<0.001).

The model's effective preview distance, *l*, is based on the information available to the animal from mechanosensory receptors along the antenna. Therefore, the contact distance, *L*, measured along the body axes from the POR to the farthest antenna-wall contact point, provides an approximate upper limit for the antenna preview distance. The preview distance will likely be shorter than the contact distance due, for example, to delays. We randomly selected and manually digitized this contact point for 20 frames from each accepted trial. The contact distance averaged over all slow trials, *L*_{slow}=4.72±0.65 cm, and fast trials, *L*_{fast}=4.40±0.53 cm (mean ± s.d.), were significantly different (*P=*0.04, one-way analysis of variance). As the cockroach ran faster, the antenna contact distance decreased because the animal ran closer to the wall (Camhi and Johnson, 1999), and/or experienced increased drag of the antenna against the wall at higher speeds.

As another test of the P-control hypothesis, we directly fit the model with only three free parameters *p=*(*l,B*/*J,K*_{P}/*J*), using the same approach as before. This pure P-control model proved inadequate because the best preview distance (*l*=9.29±2.95 cm) was significantly longer than the values for *L* we observed for fast and slow running,and also significantly longer than the longest antenna length for any of the individuals we tested. Therefore we reject the simplistic P-control model in favor of the PD-control model, which better captures the data, and does so with physically realistic parameters.

## Discussion

### Basis of planar unicycle template

Our template for running is most similar to a unicycle viewed in the horizontal plane (Fig. 1). The planar unicycle takes advantage of the unique performance of the lateral leg-spring template (LLS) (Schmitt and Holmes, 2000a; Schmitt and Holmes, 2000b), allowing for simple control of body angle. The LLS template has been remarkably effective in modeling the dynamics of cockroach running (Schmitt et al., 2002; Schmitt and Holmes, 2003; Lee et al., in press). It consists of a rigid body that bounces from side-to-side as it moves forward with a pair of virtual leg-springs representing the summed behavior of an animal's legs. The leg-springs are attached at a fixed (or moving) point called the center of pressure. Six states describe the LLS: the center-of-mass position (*x,y*), body angle θ, angular velocityω, forward speed *v*, and the COM velocity heading relative to the body axis, δ. Schmitt and Holmes's analysis(Schmitt and Holmes, 2000a; Schmitt and Holmes, 2000b)shows that for a wide range of center-of-pressure locations (for example,fixed behind the COM), the discrete stride-to-stride dynamics partially asymptotically self-stabilize to an isolated equilibrium point in both angular velocity and relative heading. In other words, if an external force slightly perturbs steady-state running, those two variables return to steady state as a result of mechanical feedback (Full et al., 2002). Stability results from losses/gains of angular momentum incurred in leg-to-leg transitions with minimal sensory feedback. In addition, the forward speed and body angle are neutrally stable, so that small perturbations might slightly increase or decrease the speed or send the template off in a somewhat different direction, but they will asymptotically acquire the new steady-state after the perturbation.

Our unicycle template captured the overall trajectories of cockroaches by utilizing the within-stride dynamics responsible for much of the passive self-stability of the LLS template(Schmitt and Holmes, 2000a; Schmitt and Holmes, 2000b). Specifically, in our planar unicycle, the stride-averaged body axis angle remained coincident with the POR's velocity vector. We reduced the passively stable relative heading of the LLS model to an algebraic constraint,δ *=*0, a simplification supported by our data when averaged over each stride (Fig. 6). We added rotational damping to cause the angular velocity to decay to zero after perturbations, enabling the body angle to reach a new steady direction, much like the LLS template predicts. Because our objective was to capture the angular dynamics of antenna-based control, we made one further simplifying assumption – the animal holds its forward speed constant. To enable task-level control of the otherwise neutrally stable body angle, θ, we incorporated into our model an input moment, *u*, about the POR, and an antenna that measures distance, *d*. Finally, we assumed that a PD-controller linked the measurement, *d*, to the input moment, *u* (Fig. 2). We then fit this control model to data experimentally to determine the parameters of the model. This enabled us to test whether velocity feedback information was necessary for control.

### Integration of mechanics, sensing, and task-level control

The proposed controller for the planar unicycle demonstrates the necessary integration of mechanics and sensing during rapid running(Fig. 2). Stable control requires a consideration of mechanics, sensing and delay. Our simple PD-controlled unicycle model provides a mechanism to investigate these three components, which all contribute to the neuromechanical performance limitations inherent in wall following.

Our hypothesis that P-control would be insufficient was motivated by root-locus analysis of the system *G*(*s*) in Eqn 7 under P-control (Eqn 9), as shown in Fig. 8. Under P-control, for τ near 1, two complex conjugate roots will dominate the response, leading to large oscillations every time the cockroach encounters an angled wall. For a given gain *K*_{P},the system becomes increasingly damped as τ decreases. At the critical value τ_{crit}=1/9, the system can be critically damped with *K*_{P}=3, with a triple root at *s*=–3. For anyτ<τ_{crit} and an appropriate choice of *K*_{P} the closed-loop system would have one distinct real pole and one double real pole. This analysis leads to three distinct cases:

τ≥1. The system cannot be stabilized with P-control.

τ

_{crit}<τ*<*1, whereτ_{crit}=1/9. For all choices of the gain*K*_{P},the system will be under-damped and therefore oscillatory.τ≤τ

_{crit}. The system can be stabilized with P-control,and for an appropriate choice of*K*_{P}, the system can be either under damped, over damped, or critically damped.

Eqn 8 indicates that τ increases with speed. If τ remains bounded below τ_{crit} for behaviorally relevant speeds, then we would hypothesize that P-control will be sufficient. If τ exceeds unity (or evenτ _{crit}), then we would hypothesize the need for a more complex compensation mechanism that includes adding velocity dependent feedback *via* a proportional-derivative (PD) controller (Eqn 11).

Unfortunately, we cannot independently measure all of the parameters that determine τ in Eqn 8, and it would therefore seem impossible to make a prediction as to whether or not P-control is sufficient. However, one additional insight leads to the hypothesis that P-control is insufficient:delay can destabilize a control system. Two separate calculations below predict that ethologically observed neural delays of 30 ms or more preclude P-control for stability. As seen, our experimental results bear out this prediction.

*T*seconds, arising from neural processing and generation of muscular forces, adds a multiplicative term

*e*

^{–}

*to the open-loop transfer function*

^{sT}*G*(

*s*) in Eqn 6: The term

*e*

^{–}

*adds pure phase lag. This can be seen by evaluating*

^{sT}*e*

^{–}

*along the imaginary axis,along which it has unity gain and negative phase. Recall that lower values forτ make P-control possible, so assume for simplicity that τ*

^{sT}*=*0. In this case, the delayed version of the dimensionless transfer function (Eqn 7) simplifies to:

*T*=

*Tv*/

*l*is the dimensionless delay. We use Camhi and Johnson's measured latency of approximately 30 ms for a cockroach to respond to an outward wall projection during wall following in

*P. americana*(Camhi and Johnson,1999). That result nearly matches the latency of the antennal escape response for this species (Ye et al., 2003). Since longer preview distances simplify control, we assume that the preview distance is

*l*=4.5 cm (which corresponds to the contact distances,

*L,*that we measured). With these optimistic assumptions, as the running speed approaches the maximum observed running speed of

*P. americana*of 1.5 m s

^{–1}(Full and Tu, 1991), the dimensionless delay approaches a critical value of

*T*=1, at which point the cockroach cannot be stabilized with P-control for any choice of proportional feedback gain,

*K*

_{P}. This can be seen by using the Nyquist stability criterion (Fig. 9). A Nyquist plot is constructed by evaluating the transfer function (Eqn 20) along the imaginary axis, namely

*G*(

*j*ω), from 0 to ∞. Residue theory from complex analysis can be used to show that if this plot encircles the –1 point,the closed loop transfer function is unstable. In our case, for

*T*≥1, the Nyquist plot always encircles the –1 point at least twice regardless of the feedback gain; thus under P-control the closed loop transfer function must have at least two unstable poles when

*T*≥1. For values of

*T*slightly lower than 1, P-control will be highly oscillatory. Adding a velocity feedback component can mitigate this problem by adding phase lead, which can counteract to some extent the phase lag introduced by the delay.

*L*is the maximum contact distance. In other words, the faster the cockroach runs, the less the effective preview distance due to the delay. Recalling that τ

*=Jv*/

*Bl*, we expect that

*T=*30 ms. As

*P. americana*approach their maximum speed 1.5 m s

^{–1}, τ approaches infinity,regardless of the specific values of

*J*and

*B*. Of course, for speeds far less than the maximum, τ

*>*1. This supports the notion that P-control will fail as an adequate explanation for control at behaviorally relevant running speeds. Moreover, as the animal increases in speed, the need for a more complex control mechanism will increase. At a running speed of

*v*=42 cm s

^{–1}(the average speed of the fast group of cockroaches) a delay of at least

*T*=30 ms will reduce the preview distance by at least 1.3 cm. Thus, if

*L*=4.4 cm(the average value for fast trials), the preview distance should be at most 3.1 cm. This is slightly longer than our experimentally fitted value of

*l*=2.6 cm for fast trials (Table 1), and therefore the fitted value is feasible.

*v*is measured and

*l*and

*B*/

*J*are fitted (Table 1), we can calculate the nominal value for τ using the formulaτ

*=*(

*B*/

*J*)(

*l*/

*v*) for each speed group. Based on the best-fit PD-control parameter, at slow speeds, τ is given by

Fig. 7B,D shows that P-control cannot stabilize the behavior at high speeds, becauseτ _{fast}*>*1. PD control is required and we would predict that neural signals from antennae will show a distinct phasic response corresponding to velocity feedback. At the slow speeds tested, however,P-control may be possible, since τ_{slow}≈1, but with P-control the cockroach wall-following dynamics would be very highly oscillatory, no matter what the choice of gain, *K*_{P}(Fig. 7A,C). One expects τto decrease further at slower speeds, and at the slowest speeds the system would be easily controlled by simple P-control. While we suspect that to be the case, we did not test such speeds; for consistency, we used the escape response behavior to elicit running, so the slowest trials captured for this study were those with continuous non-stop running at over 20 cm s^{–1}. This is distinct from the more intermittent walk/pause style walking seen during exploratory locomotion described by Gras et al.(Gras et al., 1994), and examined (along with fast runs) for wall following by Camhi and Johnson(Camhi and Johnson, 1999). To test whether P-control suffices at these slow speeds one would need to model the intermittent walking behavior; that is beyond of the scope of the present study.

As discussed, the data and analyses presented in this paper refute the P-controlled dynamic unicycle model of wall following, and support (though do not prove) a simple alternative, a PD-controlled dynamic unicycle. The PD-controlled model matches the data and, according to the theoretical analysis, enables stable wall following. Our experimental and theoretical observations do not preclude more complex and elaborate alternatives. For example, acceleration feedback may also play a critical role in some circumstances (though a more elaborate set of perturbations may be needed to tease this out). Our controlled experiments also do not support or refute more complex neural transfer functions that might be required for following more complex surfaces or avoiding isolated obstacles.

### Multimodal role of antennae in mechanosensory integration

Behaviors mediated by antennal feedback involve a complex combination of basal and flagellar mechanoreceptors, not to mention feedback from myriad other sensory stimuli, including vision(Ye et al., 2003) and olfaction (Schaller, 1978). Understanding of the neural control strategies underlying sensorimotor function is further confounded by the need to identify the behavioral context,such as wall following and random exploration(Jeanson et al., 2003), wind following (Bohm, 1995), and tunneling *versus* climbing (Harley et al., 2005).

We contend that understanding task-level neural control of rapid running requires the integration of sensing and mechanics. A neuromechanical model opens up a wide range of tools from control theory – such as root locus analysis and Nyquist's stability criterion – to make specific predictions regarding neural function. The neural processing requirements for stability derived from such a neuromechanical model lead to novel, testable motor control predictions. In the present study, we used a simple neuromechanical model of wall following that predicts the need for neural coding of both antennal distance (proportional) and velocity (derivative) for stable wall following. Based on the results in this paper, our prediction would be to see both a tonic response (position) and a phasic response(velocity) of antenna perturbations. Therefore, an important next step would be to test this hypothesis directly with neural recordings of flagellar receptors and neurons.

## List of abbreviations

Symbol . | Description . | Units . | ||
---|---|---|---|---|

Dynamic variables (can change during a trial) | ||||

(x,y) | location of body position of rotation (POR) on the horizontal plane | cm | ||

ν | forward speed | cm s^{-1} | ||

θ | body angle | rad | ||

ϕ | direction of motion of position of rotation (POR) | rad | ||

ω | body angular velocity | rad s^{-1} | ||

d | antenna measurement distance | cm | ||

u | input moment applied by the legs around the POR | g cm^{2} s^{-2} | ||

t | time | s | ||

s | complex frequency | s^{-1} | ||

G(s) | open-loop cockroach transfer function | s^{2} g^{-1} cm^{-1} | ||

G̃,s̃,d̃,ũ | dimensionless version of G,s,d,u | |||

System parameters (assumed constant during a trial) | ||||

J | body polar moment of inertia | g cm^{2} | ||

B | body polar damping constant | g cm^{2} s^{-1} | ||

l | antenna preview distance | cm | ||

L | antenna contact distance ahead of POR | cm | ||

K_{P} | proportional feedback gain | g cm^{2} s^{-2} | ||

K_{D} | derivative feedback gain | g cm^{2} s^{-1} | ||

d_{∞} | steady-state antenna measurement distance | cm | ||

τ | dimensionless time constant for sensorimotor control of wall following | |||

τ_{crit} | critical value of τ below which P-Control can provide good performance | |||

T | neural delay | s | ||

T̃ | dimensionless neural delay | |||

Data processing variables (no units, or units derived from above) | ||||

N | number of trials | |||

j | trial index | |||

k | stride index | |||

f_{p} | vector field of dynamical system | |||

\({\Delta}t_{\mathrm{k}}^{\mathrm{j}}\) | flow of the dynamical system over stride-to-stride time interval \({\Delta}t_{\mathrm{k}}^{\mathrm{j}}\) | |||

M,M̂ | prediction error convariance matrix, and estimate thereof | |||

p,p̂ | p=(l, B/J, K_{P}/J,K_{D}/J), vector of fitted parameters, and estimate thereof | |||

Σ | summation symbol | |||

H_{P} | P-Control hypothesis | |||

H_{PD} | PD-Control hypothesis | |||

α | distance between POR and rear marker | |||

β_{0},β_{1} | slope and intercept of linear model relating ϕ and θ | |||

ν^{⊥} | instantaneous velocity of the rear retroflective marker projected onto the direction that is perpendicular to the heading | |||

δ | COM velocity relative to body axis |

Symbol . | Description . | Units . | ||
---|---|---|---|---|

Dynamic variables (can change during a trial) | ||||

(x,y) | location of body position of rotation (POR) on the horizontal plane | cm | ||

ν | forward speed | cm s^{-1} | ||

θ | body angle | rad | ||

ϕ | direction of motion of position of rotation (POR) | rad | ||

ω | body angular velocity | rad s^{-1} | ||

d | antenna measurement distance | cm | ||

u | input moment applied by the legs around the POR | g cm^{2} s^{-2} | ||

t | time | s | ||

s | complex frequency | s^{-1} | ||

G(s) | open-loop cockroach transfer function | s^{2} g^{-1} cm^{-1} | ||

G̃,s̃,d̃,ũ | dimensionless version of G,s,d,u | |||

System parameters (assumed constant during a trial) | ||||

J | body polar moment of inertia | g cm^{2} | ||

B | body polar damping constant | g cm^{2} s^{-1} | ||

l | antenna preview distance | cm | ||

L | antenna contact distance ahead of POR | cm | ||

K_{P} | proportional feedback gain | g cm^{2} s^{-2} | ||

K_{D} | derivative feedback gain | g cm^{2} s^{-1} | ||

d_{∞} | steady-state antenna measurement distance | cm | ||

τ | dimensionless time constant for sensorimotor control of wall following | |||

τ_{crit} | critical value of τ below which P-Control can provide good performance | |||

T | neural delay | s | ||

T̃ | dimensionless neural delay | |||

Data processing variables (no units, or units derived from above) | ||||

N | number of trials | |||

j | trial index | |||

k | stride index | |||

f_{p} | vector field of dynamical system | |||

\({\Delta}t_{\mathrm{k}}^{\mathrm{j}}\) | flow of the dynamical system over stride-to-stride time interval \({\Delta}t_{\mathrm{k}}^{\mathrm{j}}\) | |||

M,M̂ | prediction error convariance matrix, and estimate thereof | |||

p,p̂ | p=(l, B/J, K_{P}/J,K_{D}/J), vector of fitted parameters, and estimate thereof | |||

Σ | summation symbol | |||

H_{P} | P-Control hypothesis | |||

H_{PD} | PD-Control hypothesis | |||

α | distance between POR and rear marker | |||

β_{0},β_{1} | slope and intercept of linear model relating ϕ and θ | |||

ν^{⊥} | instantaneous velocity of the rear retroflective marker projected onto the direction that is perpendicular to the heading | |||

δ | COM velocity relative to body axis |

## Acknowledgements

We thank Chanson Chang for his significant contribution in collecting our preliminary data, Dan Koditschek and Shai Revzen for their ideas regarding model fitting, Simon Sponberg for his neuroscience insights and Carey Priebe for his statistical advice. Also, thanks to Devin Jindrich for reading the manuscript. The work was supported in part by The Office of Naval Research(MURI N00014-98-1-0669) and the National Science Foundation (FIBR 0425878).

## References

**Altendorfer, R., Koditschek, D. E. and Holmes, P.**(

**Blickhan, R.**(

**Blickhan, R. and Full, R. J.**(

**Bloch, A.**(

**Bohm, H.**(

**Camhi, J. M. and Johnson, E. N.**(

**Camhi, J. M., Tom, W. and Volman, S.**(

*Periplaneta americana*. II. Detection of natural predators by air displacement.

**Cavagna, G. A., Mantovani, M., Willems, P. A. and Musch, G.**(

**Comer, C. M. and Dowd, J. P.**(

**Comer, C., Mara, E., Murphy, K. A., Getman, M. and Mungy, M. C.**(

*Periplaneta americana*. II. Patterns of touch-evoked behavior.

**Comer, C. M., Parks, L., Halvorsen, M. B. and Breese-Terteling,A.**(

**Delcomyn, F.**(

*Periplaneta americana.*

**Dürr, V., König, Y. and Kittmann, R.**(

*Carausius morosus*: anatomy and antennal movements during walking.

**Farley, C. T., Glasheen, J. and McMahon, T. A.**(

**Franklin, G. F., Powell, J. D. and Emami-Naeini, A.**(

**Full, R. J. and Koditschek, D. E.**(

**Full, R. J. and Tu, M. S.**(

**Full, R. J., Kubow, T. M., Schmitt, J., Holmes, P. and Koditschek, D. E.**(

**Gallant, A. R.**(

**Gras, H., Horner, M. and Schurmann, F.**(

**Harley, C. M., Lewinger, W. A., Ritzmann, R. E. and Quinn, R. D.**(

*Blaberus discoidalis*and implementation in a semi-autonomous robot.

**Jeanson, R., Blanco, S., Fournier, R., Deneubourg, J. L.,Fourcassié, V. and Theraulaz, G.**(

**Jindrich, D. L. and Full, R. J.**(

**Lee, J., Lamperski, A., Schmitt, J. and Cowan, N.**(

**McMahon, T. A. and Cheng, G. C.**(

**Okada, J. and Toh, Y.**(

*Periplaneta americana*).

**Okada, J. and Toh, Y.**(

**Okada, J., Kanamaru, Y. and Toh, Y.**(

**Schafer, R.**(

*Leucophaea maderae.*

**Schafer, R. and Sanchez, T. V.**(

*Periplaneta americana*: postembryonic development and morphology of the sense organs.

**Schaller, D.**(

*Periplaneta americana*L.: distribution and frequency of morphologic types of sensilla and their sex-specific changes during postembryonic development.

**Schmitt, J. and Holmes, P.**(

**Schmitt, J. and Holmes, P.**(

**Schmitt, J. and Holmes, P.**(

**Schmitt, J., Garcia, M., Razo, R. C., Holmes, P. and Full, R. J.**(

**Schwind, W. J. and Koditschek, D. E.**(

**Seelinger, G. and Tobin, T. R.**(

**Seipel, J., Holmes, P. and Full, R. J.**(

**Seyfarth, A., Geyer, H., Gunther, M. and Blickhan, R.**(

**Slifer, E. H.**(

*Gromphadorhina portentosa*,and a comparison with those of several other species (Dictyoptera, Blattaria).

**Staudacher, E., Gebhardt, M. and Duerr, V.**(

**Toh, Y.**(

*Periplaneta americana.*

**Watson, J. T. and Ritzmann, R. E.**(

*Blaberus discoidalis*: I. Slow running.

**Ye, S., Leung, V., Khan, A., Baba, Y. and Comer, C. M.**(