# Study of animal locomotion

The study of animal locomotion is a branch of biology that investigates and quantifies how animals move.

## Kinematics

Kinematics is the study of how objects move, whether they are mechanical or living. In animal locomotion, kinematics is used to describe the motion of the body and limbs of an animal. The goal is ultimately to understand how the movement of individual limbs relates to the overall movement of an animal within its environment. Below highlights the key kinematic parameters used to quantify body and limb movement for different modes of animal locomotion.

## Quantifying locomotion
### Walking

Legged locomotion is the dominant form of terrestrial locomotion, the movement on land. The motion of limbs is quantified by the kinematics of the limb itself (intralimb kinematics) and the coordination between limbs (interlimb kinematics).
To quantify the intralimb kinematics and interlimb coordination during walking, the stance and swing phases of the step cycle must be isolated. Stance is associated with the portion of the step where the leg contacts the ground, whereas, swing is where the leg lifts off the ground and moves forward along the body. High-speed videography is used to record the motion of the legs. Pose-estimation methods are then used to track key point(s) on each leg, typically at the joints of the leg. After extracting the positions of each leg throughout a recording, there are several ways of determining the stance and swing phases of the step cycle. One approach involves using peak and trough detection of the leg tip positions in ego-centric coordinates and after the animal has been aligned to a common heading (Fig. 1). Alternatively, swing and stance can be classified as leg tip velocities above and below a chosen threshold, respectively. In this case, leg tip velocities are calculated in allocentric, or world-oriented, coordinates. Once swing and stance phases are determined, the following kinematic and coordination parameters can be calculated.

#### Intralimb kinematic parameters:

* Anterior Extreme Position (AEP): the forwardmost position of the leg (i.e. usually the start of stance phase).
* Posterior Extreme Position (PEP): the rearmost position of the leg (i.e. usually the start of swing phase).
* Step duration: elapsed time between two onsets of stance.
* Step frequency: inverse of stride duration (i.e. number of strides per second)
* Stance duration: time elapsed between stance onset and swing onset.
* Swing duration: time elapsed between swing onset and the subsequent stance onset .
* Step amplitude: the distance a leg travels during swing in a ego-centric reference frame.
* Step length: the distance from the stance onset to stance onset in a world reference frame.
* Stride range of motion: the leg's integrated path between stance onset and swing offset.
* Joint angles: Walking can also be quantified through the analysis of joint angles. During legged locomotion, an animal flexes and extends its joints in an oscillatory manner, creating a joint angle pattern that repeats across steps. The following are some useful joint angle analyses for characterizing walking:
* Joint angle trace: a trace of the angles that a joint exhibits during walking.
* Joint angle distribution: the distribution of angles of a joint.
* Joint angle extremes: the maximum (extension) and minimum (flexion) angle of a joint during walking.
* Joint angle variability across steps: the variability between joint angle traces of several steps.

#### Interlimb kinematic parameters

* Phase offsets: the lag of a leg relative to the stride period of a reference leg.
* Number of legs in stance: The number of legs in stance at a single point in time.
* Tripod coordination strength (TCS): specific to hexapod interlimb coordination, this parameter determines how much the interlimb coordination resembles the canonical tripod gait. TCS is calculated as the ratio of the total time legs belonging to a tripod (i.e. left front, middle right, and hind left legs, or vice versa) are in swing together, by the time elapsed between the first leg of the tripod that enters swing and the last leg of the same tripod that exits swing.
* Relationship between several joint angles: the relative angles of two joints, either from the same leg or between legs. For example, the angle of a human's left femur-tibia (knee) joint when the right femur-tibia joint is at its most flexed or extended angle.

#### Measures of walking stability

Static stability: minimum distance from the center of mass (COM) to any edge of the support polygon created by the legs in stance for each moment in time. A walking animal is statically stable if there are enough legs to form the support polygon (i.e. 3 or more) and the COM is within the support polygon. Moreover, static stability is at its maximum when it lies at the center of the support polygon. Steps to calculate static stability are as follows:
* Find which legs are in stance and the location of the center of mass. Note, if there are less than 3 legs in stance then the animal is not statically stable.
* Form the support polygon by creating edges between these legs in a clock-wise manner.
* Determine if the center of mass lies inside or outside of the support polygon. The ray casting algorithm is a common approach of finding if a point is located within a polygon. If the center of mass is outside of the polygon then the animal is statically unstable.
* If the center of mass is inside the support polygon, calculate static stability by computing the minimum distance of the center of mass to any edge of the polygon.
Dynamic stability: dictates the degree to which deviations from periodic movement during walking will result in instability.

#### Analyzing kinematics across steps

Quantifying walking often involves assessing the kinematics of individual steps. For more information on methods for acquiring this data, see Methods of Study. The first task is to parse walking data into individual steps. Methods for parsing individual steps from walking data rely heavily on the data collection process. At a high-level, walking data should be periodic with each cycle reflecting the movements of one step, and steps can therefore be parsed at the peaks of the signal. It is often useful to compare or pool step data. One difficulty in this pursuit is the variable length of steps both within and between legs. There are many ways to align steps, the following are a few useful methods.
* Stretch step: steps of variable durations may be stretched to the same duration.
* Step phase: the phase of each step can be computed which quantifies how far through the step each data point is. This normalizes the data by step length, allowing data from steps of variable lengths to be compared. The Hilbert transform may be used to calculate phase, however a manual phase calculation may be better for aligning peak (swing and stance start) alignment.
Fruit flies have six legs and four joints per leg with many joints moving in multiple planes. Thus, there are many kinematic degrees of freedom. Therefore, the continuous variability in coordination patterns across walking speeds and across individual flies can be visualized in a low dimensional embedding, using techniques such as principal components analysis and UMAP.
In addition to stability, the robustness of a walking gait is also thought to be important in determining the gait of a fly at a particular walking speed. Robustness refers to how much offset in the timing of a legs stance can be tolerated before the fly becomes statically unstable. For instance, a robust gait may be particularly important when traversing uneven terrain, as it may cause unexpected disruptions in leg coordination. Using a robust gait would help the fly maintain stability in this case. Analyses suggest that flies may exhibit a compromise between the most stable and most robust gait at a given walking speed.

#### Speed-dependent kinematic changes

Many animals alter walking kinematics as they modulate walking speed. An interlimb kinematic parameter that is commonly speed dependent is gait, the stepping pattern across legs. While some animals alternate between distinct gaits as a function of speed, others move along a continuum of gaits. Similarly, animals commonly modulate intralimb parameters across speed. For example, fruit flies decrease stance duration and increase step length as forward speed increases. Importantly, kinematics are not only modulated across forward velocity, but also rotational and sideslip velocities. In these cases, asymmetry in the modulation between left and right legs is common.

### Flight

Aerial locomotion is a form of movement used by many organisms and is typically powered by at least one pair of wings. Some organisms, however, have other morphological features that allow them to glide. There are many different flight modes, such as takeoff, hovering, soaring, and landing. Quantifying wing movements during these flight modes will provide insight about the body and wing maneuvers that are required to execute these behaviors. Wing orientation is quantified throughout the flight cycle by three angles that are defined in a coordinate system relative to the base of the wing. The magnitude of these three angles are often compared for upstrokes and downstrokes. In addition, kinematic parameters are used to characterize the flight cycle, which consists of an upstroke and a downstroke. Aerodynamics are often considered when quantifying aerial locomotion, as aerodynamic forces (e.g. lift or drag) are able to influence flight performance. Key parameters from these three categories are defined as follows:

#### Angles to quantify wing orientation

Wing orientation is described in the coordinate system centered at the wing hinge. The x-y plane coincides with the stroke plane, the plane parallel to the plane that contains both wing tips and is centered at the wing base. Assuming the wing can modeled by the vector passing through the wing base and wing tip, the following angles describe the orientation of the wing:
* Stroke position: angle describing the anterior-to-posterior motion of the wings relative to the stroke plane. This angle is computed as the projection of the wing vector onto the stroke plane.
* Stroke deviation: angle describing the vertical amplitude of the wings relative to the stroke plane. This angle is defined as the angle between the wing vector and its projection onto the stroke plane.
* Angle of attack: angular orientation of the wings (i.e. tilt) relative to the stroke plane. This angle is computed as the angle between the wing cross section vector and the stroke plane.

#### Kinematic parameters

* Upstroke amplitude: angular distance through which the wings travel during an upstroke.
* Downstroke amplitude: angular distance through which the wings travel during a downstroke.
* Stroke duration: time elapsed between the onset of two consecutive upstrokes.
* Wingbeat frequency: inverse of stroke duration. The number of wingbeats per second.
* Flight distance per wingbeat: the distance covered during each wingbeat.
* Upstroke duration: time elapsed between the onset of an upstroke and the onset of a downstroke.
* Downstroke duration: time elapsed between the onset of a downstroke and the onset of an upstroke.
* Phase: if an organism has both front and hind wings, the lag of a wing pair relative to the other (reference) wing pair.

#### Aerodynamic parameters

* Reynolds number: ratio of inertial forces to viscous forces. This metric helps describe how wing performance changes with body size.

### Swimming

Aquatic locomotion is incredibly diverse, ranging from flipper and fin based movement to jet propulsion. Below are some common methods for characterizing swimming:

#### Fin and flipper locomotion

Body, tail, or fin angle: the curvature of the body or displacement of a fin or flipper.
Tail or fin frequency: the frequency of a fin or tail completing one movement cycle.

#### Jet propulsion

Jet propulsion consists of two phases - a refill phase during which an animal fills a cavity with water, and a contraction phase when they squeeze water out of the cavity to push them in the opposite direction. The size of the cavity can be measured in these two phases to compare the amount of water cycled through each propulsion.

## Methods of study

A variety of methods and equipment are used to study animal locomotion:

### Treadmills

    are used to allow animals to walk or run while remaining stationary or confined with respect to external observers. This technique facilitates filming or recordings of physiological information from the animal (e.g., during studies of energetics). Some treadmills consist of a linear belt (single or split belt) that constrains the animal to forward walking, while others allow 360 degrees of rotation. Non-motorized treadmills move in response to an animal's self-initiated locomotion, while motorized treadmills externally drive locomotion and are often used to measure the endurance capacity (stamina) of animals.

### Tethered locomotion

    Animals may be fixed in place, allowing them to move while remaining stationary relative to their environment. Tethered animals can be lowered onto a treadmill to study walking, suspended in air to study flight, or submersed in water to study swimming.

### Untethered locomotion

    Animals may move through an environment without being held in place and their movement can be tracked for analysis of that behavior. However freely moving animals are more challenging to track in 3d for detailed kinematic analysis of intralimb coordination.

### Visual arenas

    locomotion can be prolonged and sometimes controlled using a visual arena displaying a particular pattern of light. Many animals use visual queues from their surroundings to control their locomotion and so presenting them with a pseudo optic flow or context-specific visual feature can prompt and prolong locomotion.

### Racetracks

    lined with photocells or filmed while animals run along them are used to measure acceleration and maximal sprint speed.

### High-speed videography

    for the study of the motion of an entire animal or parts of its body (i.e. Kinematics) is typically accomplished by tracking anatomical locations on the animal and then recording video of its movement from multiple angles. Traditionally, anatomical locations have been tracked using visual markers that have been placed on the animal's body. However, it is becoming increasingly more common to use computer vision techniques to achieve markerless pose estimation.
   * Marker-based pose estimation: Visual markers must be placed on an animal at the desired regions of interest. The location of each marker is determined for each video frame, and data from multiple views is integrated to give positions of each point through time. The visual markers can then be annotated in each frame manually. However, this is a time-consuming task, so computer vision techniques are often used to automate the detection of the markers.
   * Markerless pose estimation: User-defined body parts must be manually annotated in a series of frames to use as training data. Deep learning and computer vision techniques are then employed to learn the location of the body parts in the training data. Next, the trained model is used to predict the location of the body parts in each frame on newly collected videos. The resulting time series data consists of the positions of the visible body parts at each frame in the video. Model parameters can be optimized to minimize tracking error and increase robustness.
    The kinematic data obtained from either of these methods can be used to determine fundamental motion attributes such as velocity, acceleration, joint angles, and the sequencing and timing of kinematic events. These fundamental attributes can be used to quantify various higher level attributes, such as the physical abilities of the animal (e.g., its maximum running speed, how steep a slope it can climb), gait, neural control of locomotion, and responses to environmental variation. These can aid in formulation of hypotheses about the animal or locomotion in general.Simultaneous measurement of ground forces (blue) and kinematics such as petiole trajectories (red) and stepping pattern (yellow) of walking desert ants in a laboratory environment in order to describe the alternating tripod gait. Recording rate: 500 fps, Playback rate: 10 fps.Marker-based and markerless pose estimation approaches have advantages and disadvantages, so the method that is best suited for collecting kinematic data may be largely dependent on the animal of study. Marker-based tracking methods tend to be more portable than markerless methods, which require precise camera calibration. Markerless approaches, however, overcome several weaknesses of marker-based tracking, since placing visual markers on the animal of study may be impractical, expensive, or time-consuming. There are many publicly accessible software packages that provide support for markerless pose estimation.

### Force plates

    are platforms, usually part of a trackway, that can be used to measure the magnitude and direction of forces of an animal's step. When used with kinematics and a sufficiently detailed model of anatomy, inverse dynamics solutions can determine the forces not just at the contact with the ground, but at each joint in the limb.

### Electromyography

    (EMG) is a method of detecting the electrical activity that occurs when muscles are activated, thus determining which muscles an animal uses for a given movement. This can be accomplished either by surface electrodes (usually in large animals) or implanted electrodes (often wires thinner than a human hair). Furthermore, the intensity of electrical activity can correlate to the level of muscle activity, with greater activity implying (though not definitively showing) greater force.

### Optogenetics

    is a method used to control the activity of targeted neurons that have been genetically modified to respond to light signals. Optogenetic activation and silencing of neurons can help determine which neurons are required to carry out certain locomotor behaviors, as well as the function of these neurons in the execution of the behavior.

### Sonomicrometry

    employs a pair of piezoelectric crystals implanted in a muscle or tendon to continuously measure the length of a muscle or tendon. This is useful because surface kinematics may be inaccurate due to skin movement. Similarly, if an elastic tendon is in series with the muscle, the muscle length may not be accurately reflected by the joint angle.

### Tendon force buckles

    measure the force produced by a single muscle by measuring the strain of a tendon. After the experiment, the tendon's elastic modulus is determined and used to compute the exact force produced by the muscle. However, this can only be used on muscles with long tendons.

### Particle image velocimetry

    is used in aquatic and aerial systems to measure the flow of fluid around and past a moving aquatic organism, allowing fluid dynamics calculations to determine pressure gradients, speeds, etc.

### Fluoroscopy

    allows real-time X-ray video, for precise kinematics of moving bones. Markers opaque to X-rays can allow simultaneous tracking of muscle length.
Many of the above methods can be combined to enhance the study of locomotion. For example, studies frequently combine EMG and kinematics to determine motor pattern, the series of electrical and kinematic events that produce a given movement. Optogenetic perturbations are also frequently combined with kinematics to study how locomotor behaviors and tasks are affected by the activity of a certain group of neurons. Observations resulting from optogenetic experiments may provide insight into the neural circuitry that underlies different locomotor behaviors. It is also common for studies to collect high-speed videos of animals on a treadmill. Such a setup may allow for increased accuracy and robustness when determining an animal's poses across time.

## Modeling animal locomotion

Models of animal locomotion are important for gaining new insights and predications on how kinematics arise from the interactions of the nervous, skeletal, and/or muscular systems that would otherwise be difficult to glean from experiments. The following are types of animal locomotion models:

### Neuromechanical models

Neuromechanics is a field that combines biomechanics and neuroscience to understand the complex interactions between the physical environment, nervous system, and the muscular and skeletal systems that consequently result in anticipated body movement. Therefore, neuromechanical models aim to simulate movement given the neural commands to specific muscles, and how those muscles are connected to the animal's skeleton. The key components of neuromechanical models are:
* A morphologically accurate 3D model of the animal's skeleton consisting of rigid bodies (i.e. bones) that are arranged in a naturalistic manner. In these models, the properties of each rigid body, like mass, length, and width, need to be prescribed. Additionally, the joints between rigid bodies need to be defined, both in terms of type (e.g. hinge and ball-in-socket) and degrees of freedom (i.e. how the rigid bodies move relative to one another). The final step is to assign a mesh object to each rigid body that determines the appearance (e.g. outer surface of a bone) and other contact properties of the rigid bodies. These skeletal models can be built using a variety of 3D modeling programs, such as Blender and Opensim Creator.
* After the skeletal model is built, the next step is to accurately define the attachment points of muscle to the rigid bodies. This assignment is crucial for the rigid bodies to be articulated in a naturalistic way. There are several type of muscle models that simulate the dynamics of muscle activation, contraction, and relaxation, which include Hill-type and Ekeberg-type muscle models.
* Neural controllers that simulate motor neuron recruitment and activity by central commands are used to dictate the timing and strength of modeled muscle activation. There are many flavors of these controllers, such as coupled phase oscillator and neural network models.
* An environment that incorporates physics is essential in simulating realistic movement of neuromechanical models because they will abide by the laws of physics. Environments used for physics simulation include, Opensim, PyBullet, and MuJoCo.