Biologically-Plausible Six-Legged Running: Control and Simulation by Matthew David Malchano Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Master of Engineering in Electrical Engineering and Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY February 2003 @ Matthew David Malchano, MMIII. All rights reserved. The author hereby grants to MIT permission to reproduce and distribute publicly paper and electronic copies of this thesis document in whole or in part. A uthor ......................... Department of Electrical Engineering and Computer Science February 4, 2003 C ertified by ............................................... Hugh M. Herr Instructor, MIT/Harvard Division of Health, Science, and Technology Thesis Supervisor Accepted by.............. Arthur C. Smith Chairman, Department Committee on Graduate Students MASSACHUSETTS INSTITUTE OF TECHNOLOGY JUL 3 0 2003 LIRRARI.C BARKFP 2 Six-Legged Running: Control and Simulation by Matthew David Malchano Biologically-Plausible Submitted to the Department of Electrical Engineering and Computer Science on February 4, 2003, in partial fulfillment of the requirements for the degree of Master of Engineering in Electrical Engineering and Computer Science Abstract This thesis presents a controller which produces a stable, dynamic 1.4 meter per second run in a simulated twelve degree of freedom six-legged robot. The algorithm is relatively simple; it consists of only a few hand-tuned feedback loops and is defined by a total of 13 parameters. The control utilizes no vestibular-type inputs to actively control orientation. Evidence from perturbation, robustness, motion analysis, and parameter sensitivity tests indicate a high degree of stability in the simulated gait. The control approach generates a run with an aerial phase, utilizes force information to signal aerial phase leg retraction, has a forward running velocity determined by a single parameter, and couples stance and swing legs using angular momentum information. Both the hypotheses behind the control and the resulting gait are argued to be plausible models of biological locomotion. Thesis Supervisor: Hugh M. Herr Title: Instructor, MIT/Harvard Division of Health, Science, and Technology 3 4 Acknowledgments Hugh Herr, Gill Pratt, and Max Berniker, Joaquin Blaya, Bruce Deffenbaugh, Pete Dilworth, Jon Gonda, Andreas Hofmann, Frank Kirchner, Marko Popovic, and Rebecca Schulman: Thanks much, y'all. Mom, Dad, and Zach Malchano: My love. 5 6 Contents 1 Introduction 13 2 Background Material 2.1 A Short Introduction to Running . . . . . . . . . . . . . . . . . . . . 2.2 Biological Inspiration . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Hexapedal Robots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 15 15 16 3 Hexapedal Running Control Algorithm 3.1 Introduction . . . . . . . . . . . . . . . 3.2 Morphology . . . . . . . . . . . . . . . 3.3 Running Control Algorithm . . . . . . 3.3.1 Aerial Phase Control . . . . . . 3.3.2 Stance Phase Control. . . . . . 3.4 Details of Methodology . . . . . . . . . . . . . . . 19 19 20 22 22 25 28 . . . . . 29 30 34 38 40 42 4 5 Results 4.1 Motion Analysis . . . . 4.2 Perturbation Testing . 4.3 Robustness . . . . . . 4.4 Parameter Sensitivity . 4.5 Biological Plausibility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conclusions and Future Work 45 A Mechanical Designs 47 B Control Source Code B .1 6legs.h . . . . . . . . . . B.2 create-hexahop.c . . . . B .3 bug lhop.h . . . . . . . . B .4 bug lhop.c . . . . . . . . B.5 Miscellaneous Functions 51 54 55 58 58 61 . . . . . . . . . . . . . . . . . . . . . . . . . 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 List of Figures 3-1 3-2 3-3 3-4 The hexapod model. . . . . . . . . . . . . . . Diagram of hexapod model joint configuration, Block diagram of aerial phase control . . . . . Block diagram of stance control . . . . . . . . . . . view . . . . . . . . . from . . . . . . . . . . . . . sagittal plane . . . . . . . . . . . . . . Mean kinematic motions of the center of mass, system potential and kinetic energies, and pitch-axis angular momentum. . . . . . . . . . . 4-2 Mean ground reaction forces: horizontal and vertical components for front, middle, and rear legs of a tripod. . . . . . . . . . . . . . . . . 4-3 Mean hip joint kinematics: angle, angular rate, and torque. . . . . . 4-4 Mean knee joint kinematics: leg length, velocity, and applied force. 4-5 Mean mechanical joint power output. . . . . . . . . . . . . . . . . . 4-6 Impulse torque perturbations: resulting momenta vs. time . . . . . . 4-7 Horizontal impulse force perturbation: resulting linear and angular m om enta. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Vertical impulse force perturbation: resulting horizontal and vertical linear m om enta. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Robustness to initial height and forward velocity . . . . . . . . . . . . 4-10 Robustness to initial pitch and pitch rate of change . . . . . . . . . . 19 21 24 27 4-1 31 31 32 33 33 35 36 37 38 39 A-1 Assembly drawings and section view of first distal segment design. . . 47 A-2 Assembly drawing and section view of revised distal segment . . . . . A-3 Sectioned model of preliminary pneumatic distal segment . . . . . . . 49 49 9 10 List of Tables 3.1 3.2 3.3 Morphological parameters defining the simulated model. . . . . . . . Aerial phase control parameters . . . . . . . . . . . . . . . . . . . . . Stance controller parameters . . . . . . . . . . . . . . . . . . . . . . . 21 22 25 4.1 4.2 4.3 Summary of gait measurements. . . . . . . . . . . . . . . . . . . . . . Maximum magnitude of step perturbations resulting in stable gait. . Independent sensitivity of parameter values: minimum, nominal, and maximum values for which a stable gait of more than 10.0 sec results. Comparison of simulation measurements with biological model prediction s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 35 4.4 B.1 Variable names used in simulation source code and coresponding symbols from text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 40 42 52 12 Chapter 1 Introduction The difficulties of control in legged locomotion are well documented [28]: (1) the high dimensionality and nonlinearity of the dynamics; (2) the relatively short duration of and limited control provided by the ground reaction forces; (3) the complexity of environmental conditions; (4) mechanical limitations in power, bandwidth, and energy efficiency; and (5) operation in a gravitational field. Yet the promise of legged locomotion is obvious in nature's ability to efficiently walk, run, trot, gallop, leap, and bound over most of the Earth's terrain. The lack of machines capable of reproducing this range of biological behaviors is evidence of the numerous challenges still faced by researchers. Many of the controllers for six-legged (or hexapod) robots exhibit a high level of computational and conceptual complexity. Inverse kinematics, inverse dynamics, and complex models are common features. The systems are defined by large sets of high-precision parameters. The use of computational search methods, nonlinear optimizations, and machine learning techniques is often necessary. The usual focus is the production of a robust walking gait. Almost all of the resulting "hexapod literature has [up until 2001] concerned static or quasi-static walking machines." [2] Recent successes in legged locomotion have been reported using control techniques labeled "feedforward", "open-loop", or "preflex" [34, 8, 33]. In these techniques, motions are coordinated by a central oscillator or clock. The oscillator triggers the play-back of trajectories at each joint. Often the control targets a highly simplified morphology with only one actuated degree of freedom (dof) per leg. The oscillator frequency, trajectory, and physical parameters are searched computationally or empirically until a satisfactory form of locomotion emerges. The algorithm presented in this thesis diverges from both the static walkers and the "feedforward" approaches. In contrast to complicated control techniques used in the walkers, the controller studied consists of only a few hand-tuned position and velocity control loops and a two-state finite state machine. These loops servo joints to simple positions or velocities. The hexapod model runs dynamically. The controller resembles the "feedforward" methodology in its relative simplicity and its stabilization without the use of vestibular-type information, such as a gyroscope signal. A number of important distinctions separate this work from the "feedforward" class. The morphology, with two actuated degrees of freedom per leg, 13 lies between both the 3-dof insect leg design common in statically-stable walkers and the 1-dof legs found in the "feedfoward" morphologies. The control is not a purely clock-driven system, but rather it predicts approximate ground contact time using force information in order to signal leg retraction. A single parameter value selects from a range of forward velocities. Angular momentum information is used to couple stance and swing legs motions. The controller uses the feedback of a few high-level state variables and on-line calculation of dynamic quantities in generating leg trajectories. Finally, where "functional biomimesis" of cockroach locomotion inspires many "feedforward" algorithms, the basis for this controller is instead a model of horse trotting [15]. The organization of presentation here is as follows: 1. A short introduction of running locomotion, description of the horse trotting model, and survey of hexapedal control is made in Chapter 2. 2. The main goal of this work is the design of a novel hexapedal running control algorithm. It is described in depth in Chapter 3 3. The resulting motions of the gait produced in simulation, the evaluation of stability through perturbation, sensitivity, and robustness testing, and an argument for biological plausibility may be found in Chapter 4 4. Finally, a summary of the main conclusions and future directions of this thesis occurs in Chapter 5 5. I designed three mechanical leg segments to further physical testing, and they are documented in Appendix A. The controller source code is listed in Appendix B. 14 Chapter 2 Background Material 2.1 A Short Introduction to Running A run is a fast locomotory mode characterized by specific motions of the center of mass. In particular, these motions feature significantly in-phase sinusoidal kinetic and potential energies. The simplest model of running which exhibits these energy profiles is the monopod. It consists of a single massless linear stiffness leg and a point-mass body. It has been shown that many animals' legs approximate such linear stiffnesses during running gaits [5]. Additionally, many runs feature an aerial phase: a period during which no feet contact the ground [24]. These characteristics hold true for morphologies running with any number of legs [4, 10]. A common gait used by hexapods, both natural and artificial, is the alternating tripod gait [17]. This symmetric and alternating gait moves legs together in groups of three. The front and hind ipsilateral and middle contralateral legs combine to form a tripod. The legs of a given tripod alternate between stance phase (during which they contact the ground) and swing phase (during which they move forward through the air). Gaits, including running gaits, may be divided into those that are statically stable and those that are dynamically stable. This terminology was introduced by [23]. The points of ground contact of the stance legs define a support polygon. In a statically stable gait, the center of mass always lies directly above this polygon. In a dynamically stable gait, on the other hand, center of mass projects outside of this polygon for some significant portion of the gait cycle. The gait then relies on its momentum to carry it through these periods of instability. Cockroaches, even though six-legged, move dynamically [12]. Given these above definitions, the hexapod presented in this thesis may be said to move in a dynamically-stable, alternating-tripod running gait. 2.2 Biological Inspiration A biological model of horse trotting [15] provides the initial basis for the running controller presented in this work. This quadrupedal model has been shown to suc15 cessfully predict biologically observed metrics across a range of masses [14], and has been further adapted to model horse galloping gaits [16]. Trotting is a gait where diagonal limb pairs alternately strike the ground. This pairing resembles the motions of a hexapedal alternating tripod gait, where limbs are also grouped diagonally. Trotting occurs as a middle speed gait between walking and galloping in a variety of quadrupedal animals. The central ideas posed in the trotting model are: 1. Both diagonal limbs in a pair begin retraction simultaneously. 2. A trotting animal estimates when its feet will first strike the ground and begins limb retraction at this time. Hence, retraction may occur before foot contact. This estimation is performed on-line using the previous stance phase pitch and force information. It is believed that beginning retraction before ground contact may help stabilize those gaits which may be modeled as monopods [35], such as trotting and hexapedal running. 3. Stance leg retraction attempts to match a tangential target speed. 4. Vertebrate limbs behave like linear stiffness springs during ground contact. 5. Hind hip joints provide motive force. Forward hip joints provide braking force. 6. No active control of body orientation is used. The trotting study was conducted using sagittal planar models. These models possessed 4 radially compliant legs with rotary hip joints; back and neck joints with passive stiffnesses were included to replicate the horse morphology accurately. Stability was evaluated based on the number of gait cycles the simulation locomoted without significant change to pitch, aerial apex height, or forward velocity. Additionally, simulations were subjected to a ground impedance change while trotting to test disturbance rejection. The above ideas provide both the inspiration and starting framework for this work. Specific documentation of divergences and modifications may be found in Chapter 3. 2.3 Hexapedal Robots This section seeks to place this thesis' contribution in the context of other work in hexapedal control. The histories of the study of legged locomotion are long and broad, and more detailed accounts of the robotics [31], biomechanics [24], and recent advances [32] may be found elsewhere. The literature documents numerous approaches specific to hexapedal control. These approaches have focused mainly on producing robust walking gaits in 3-dof per leg morphologies. The advanced concepts and computational methods are applied. Parameter search techniques have been used to reduce the complexity of the resulting controllers. For example, neural nets [3], genetic algorithms [22], and varieties of reinforcement learning [18] have been used to define parameters. The problem 16 has been decomposed into a variety of subproblems, with restricted goals such as gait generation [39], fault tolerance [41], rough terrain navigation [40], and leg coordination [1]. Biological organisms have served as physical [38, 26] as well as behavioral models [11]. Many of these controllers are successful in their chosen objectives or introduce innovative approaches. Yet all of these hexapods, along with many others, locomote in only static or quasi-static regimes. Their focus includes neither fast running gaits nor simplicity. The MIT Leg Lab has previously developed two six-legged walking simulations similar to the aforementioned systems. The first controller targets a cockroach-sized morphology and uses a technique called "virtual model control" [37]. In virtual model control, desired forces are prescribed to the body link. For example, a "virtual" linear spring, attached between the center of mass and a "virtual" fixed frame, might counteract gravity's force on the body. The leg inverse kinematics and the Jacobian are used to map these "virtual" forces to leg joint torques, which exert real forces against the ground to produce the desired motion. The second hexapod, a simulated automobile-sized walking vehicle, also relies on this technique [27]. Neither controller claims biological plausibility. More recently, impressive successes have been had in a series of highly simplified approaches. These approaches are unified in their use of a clock to coordinate the playback trajectories on 1-dof actuated legs and their emergent passive stability. They are also unified by their "functional biomimesis" of cockroach locomotion. Below I discuss RHex [2, 34], Sprawlita [8, 6], and Wheg [30], three examples of this approach to control. The autonomous robot RHex possesses six actively controlled degrees of freedom, one per leg. The actuation is provided by rotary hip joints whose axes lie perpendicular to the sagittal plane. Legs move in complete rotations and group together in alternating tripods. A central oscillator coordinates the hips, which use local feedback loops to follow one of two velocities: a "retraction" velocity for stance phase and a faster "protraction" velocity for swing phase. Buhler et al. report a forward gait, with a speed of one body length per second, emerges after physical tuning of the system mass, leg spring stiffness, target velocities, and loop gains. Sprawlita is a pneumatically actuated, tethered robot. It's 1-dof legs are pneumatic cylinders attached to the body with passive stiffnesses. In Sprawlita, a central pattern generator again sends a periodic feedforward trajectory to the mechanical system. Cham et al. argue passive stiffnesses and pneumatic cylinders act as purely mechanical feedback (termed "preflexes") which stabilize the gait. Otherwise, no feedback occurs. The controller may also servo the angle of all hips, but does not do so during intra-stride operation. The feedforward trajectory is a simple "bang-bang", extend-or-retract command sent to all legs in a tripod. The frequency and duty cycle of this trajectory were determined empirically. Sprawlita has been shown to move at speeds of 2.5 body lengths per second. Wheg uses a morphology similar to RHex but with three radial-stiffness spokes per leg instead of one. Additionally, it reduces leg drive to a single motor. Its controller appears similar to RHex, but targets only a single angular rate per leg and switches its legs to an in-phase gait when climbing obstacles. It's forward velocity is 17 undocumented. Since the initial work on both Sprawlita and RHex, additional research has begun adding high-level adaptive feedback to these systems. In RHex, body orientation and foot contact information has been used to adjust for ground slope conditions [20]. This information is also being used to research adding an aerial phase to RHex's gait. In the above, Komsuoglu et al. state that, "experimental observations suggest higher forward speeds can be achieved provided an aerial phase is introduced....". In Sprawlita, a foot contact signal was used to modify the frequency and duty cycle of the feedforward trajectory to aid slop ascent [7]. Both of these recent incremental successes, I believe, validate the direction of the work pursued in this thesis, which utilizes a different set of high-level feedback terms in a simple control system. 18 Chapter 3 Hexapedal Running Control Algorithm 3.1 Introduction Figure 3-1: The hexapod model. The control algorithm presented in this chapter generates leg motions in the above 12-dof model (Figure 3-1). These leg motions in turn produce a fast tripod running gait in simulation. What are the salient features of this control? It is coordinated by a finite state machine. Foot contact switches signal FSM state changes. Proportional gain or proportional-derivative feedback loops mostly servo joints to constant positions or velocities. No active mechanism maintains body orientation; instead, level posture 19 emerges passively. Leg retraction matches the distal leg end velocity to the target forward velocity. Angular momentum information about the stance leg is used to coordinate opposing swing leg motion. Leg retraction occurs based on an on-line prediction of ground contact time. The resulting gait possesses an aerial phase. The rest of this chapter gives precise description of these features. Simulations of sagittal-planar and fully three-dimensional models were developed for a variety of masses. The results contained in this thesis focus only on the sagittalplanar model. The hexapedal sprawled posture causes most of the interesting dynamics to occur in the sagittal-plane. Reduction of orientation state to only pitch angle and derivatives allows a clear examination of the degree of passive orientation stability. For the three-dimensional simulations, only small changes to leg sprawl and increases in hip gains were necessary to achieve stable locomotion. Section 3.2 describes the model used in simulation. The control algorithm is discussed in detail in Section 3.3. As previously mentioned, this work draws inspiration from a model of quadrupedal trotting. Documentation of the specific differences between these systems, along with various notes on simulation development, may be found in Section 3.4. Results analyzing the gait produced by this control follow in Chapter 4. The complete source code for the controller, along with some supporting simulation code, may be found in Appendix B. 3.2 Morphology The hexapod model possesses 12 actuated degrees of freedom. Each leg has a rotary hip whose axis lies perpendicular to the sagittal plane and a prismatic knee oriented radially from that hip. The hip joints attach the thigh link to the body, with fore and hind hips located at the body's corners and at the vertical level of the body center of mass. Each hip joint acts to protract (swing forward) and retract (swing hindward) a given leg in the sagittal plane. The knee joints attach the thigh to the shin and act to lengthen or shorten the leg. Additionally, during stance phase, these knee joints behave as linear, high stiffness leg springs. Figure 3-2 diagrams these actuated joint motions in the sagittal plane. An un-actuated joint, co-located with the hip, splays the thighs outward within the frontal plane. A passive 40 N/in stiffness and 20 N-s/in viscosity hold these legs at an angle of 0.1 radians from vertical. The splay and stiffness maintain the necessarily sprawled posture in the 3D simulations. The hexapod inherits this general form from the quadrupedal trotting model. Similar morphologies also appear in other robots and biomechanical models, such as [31, 25, 36], in part due to common recognition of a tested hypothesis suggesting that the legs of many animals behave like linear-stiffness springs [5]. The physical parameters defining the hexapod are summarized in Table 3.1. The total mass, its distribution, body dimensions, and leg lengths roughly approximate the latest iteration of the Scorpion robot [19]. I chose to model these values on the Scorpion because of prospective plans to conduct physical tests using some of its 20 6A Figure 3-2: Diagram of hexapod model joint configuration, view from sagittal plane hardware. One consequence of this choice, the legs total nearly 50% of the system mass and hence contribute significantly to the system dynamics. Parameter Symbol Value Unit Body mass - 3.104 kg Thigh mass Shin mass Mthigh Mshin 0.464 0.029 kg kg 6.062 kg Total mass Body length - 0.64 m Body height Body width Thigh length Thigh radius Shin length - m m m m m Lshin 0.10 0.145 0.076 0.15 0.176 Shin radius - 0.024 m Max Leg Length - 0.252 m Min Leg Length Max Hip Angle - 0.052 m rad Min Hip Angle - - Lthg9 h - 7r/2 -7r/2 rad Table 3.1: Morphological parameters defining the simulated model. 21 3.3 Running Control Algorithm This section discusses the control algorithm which generates the hexapod's running gait. A centralized controller coordinates the motions of the legs. This controller is in one of two states during steady state locomotion: aerial phase (Section 3.3.1) or stance phase (Section 3.3.2). Each state performs a separate function. In the aerial phase, the hexapod moves in a ballistic trajectory through the air. The controller positions the legs to prepare for ground contact. During the stance state, the hexapod contacts the ground, and the controller moves the legs in order to propel the body forward and upward into the air. In both states, the legs are grouped into two tripods of three legs each. Each leg in a tripod is commanded similarly. At any time, one of the tripods is designated the stance tripod and the other the swing tripod. During stance phase, the legs of the stance tripod are in contact with the ground, while the legs of the swing tripod do not touch the ground. When control switches from the stance phase to the aerial phase, the designations for the tripods are swapped. The swing tripod becomes the stance tripod and vice versa. Hence, in aerial phase, the tripod designated as the stance tripod will contact the ground in the subsequent stance phase. 3.3.1 Aerial Phase Control Aerial phase control positions the legs to prepare the hexapod to enter into stance phase control. Aerial phase control begins when the hexapod's leg leave the ground and ends when ground contact is predicted to occur again. During aerial phase control, the legs are positioned to a ready position for the next stance phase's initiation. Figure 3-3 shows the aerial phase controller for both knee and hip joints in block diagram notation. Table 3.2 lists the numerical values of the controller gains and target positions. Parameter Kaerial knee Baerial knee Kaerial hip Baerial hip Lknee extend Lknee retract Ohip protract khip retract Value 2.0 1.086 40 Unit N/m Ns/m N/rad Description Aerial knee stiffness Aerial knee damping Aerial hip stiffness 20 0.0 0.2 Ns/rad Aerial hip damping m m rad rad knee target compression knee target compression hip target position hip target position -0.4 0.4 Table 3.2: Aerial phase control parameters At the beginning of the aerial phase, the swing tripod starts in a retracted position and with its knees fully extended. The stance tripod starts protracted and with its knees fully compressed. Proportional-derivative position control loops at the hips 22 apply torques to both tripods to brake the inertia from the previous stance phase's motions and to roughly position the tripods for entry into the next stance phase. The target angle for the stance tripod protraction was estimated by considering the return path of a spring-mass monopod dropped from the predicted average height of the hexapod center of mass apex and with the predicted velocity of the hexapod robot. The angle of attack of this monopod was used as the target protraction angle. This value was then hand-tuned until a steady state run in the hexapod model was achieved. The same angle from vertical is used for the swing tripod target retracted position. Hip loop gains were chosen to assure that legs were brought to a halt before they contacted the hip joint stops. Although it was intended that loop gains would be high enough to assure precise positioning to the desired target positions before the end of aerial phase, this behavior was not observed in the final simulation. Instead, some variation in protracted leg position was observed. Hip damping coefficients were chosen to critically damp the motion of the hips, assuring that no oscillation or overshoot occurs during leg motion. When aerial phase is entered, the controller estimates the time of the next ground contact, which is when stance phase should start. This estimation is accomplished using the vertical velocity of the center of mass of the hexapod at the moment aerial phase begins. From this, the duration of a parabolic flight path during aerial phase is predicted. A timer maintains the elapsed time from the onset of aerial phase control; when the timer exceeds the predicted duration, aerial phase ends and stance phase begins. The controller also switches into stance phase if a leg contacts the ground at any time during aerial phase motion. Just before aerial phase control ends, P-D controllers apply forces to the knees to extend the stance tripod to its maximal length and compress the swing tripod by 0.15 meters. Knee gains and damping coefficients were chosen to assure this motion completes before ground contact. 23 S 0.4 Protract Angle [rad] +_a[OUTPUT] Actuator Model +_K [STATE] STANCE/SWING Desired Hip Angle -m 4 Retract Angle [rad] K aerial hip [rad] Applied Hip Torque [SENSOR] Hip Position Derivative Baerialhip [Nm [m4lrdF 0.4 Extend Positon [m] STAE]N +_pie [rad] STNC/WIG Desire Ke Plos KK+n[UTUT K aerial knee Actuator Mde [m] -0.4 Compress Position [m] |[SENSORI Knee rPosition ud Derivative B aerial knee Figure 3-3: Block diagram of aerial phase control 24 Applie KNe Force [N] 3.3.2 Stance Phase Control Stance phase control determines the motions of the tripods during ground contact. The stance tripod usually contacts the ground shortly after the onset of stance phase control, and the control ends when that tripod again leaves the ground. During this control, the stance tripod moves from a protracted position to a retracted position and acts against the ground. Simultaneously, the swing tripod moves from a retracted position to a protracted position without contacting the ground. Figure 3-4 shows a control block diagram depiction of the control used during stance phase. Table 3.3 lists the gains and desired velocities used in the controller. Parameter Gvel Gve12 Value 6.0 -0.2 Xmax 1 compress Fore/Hind kleg Middle kie, bleg 1.5 0.22 750 1500 20 Unit N-sec/rad N-sec/rad m/sec m N/m N/m N-sec/m Description stance tripod loop gain swing tripod loop gain target forward velocity swing leg compressed length stance leg stiffness stance leg stiffness stance leg damping Table 3.3: Stance controller parameters Stance phase control begins when either the predicted duration of the aerial phase expires or when one or more legs contact the ground. In normal steady-state behavior, stance phase initiates slightly before ground contact. This preliminary acceleration results in "leg retraction", which was one of the hypotheses posed in the quadruped model. At the initiation of stance phase control, knees begin to act as high linear stiffnesses. The front and hind stance legs are set to a 750 N/m stiffness with 20 N-sec/m damping coefficient. The middle leg switches to a 1500 N/m stiffness; this stiffness is doubled to compensate for the asymmetry of the tripod. Without this adjustment, asymmetrical ground reaction forces, a body-roll moment, and insufficient rear leg ground clearance occur during stance. Swing tripod knee stiffness also increase. The hips of the stance tripod are controlled with proportional velocity loops. These loops attempt to match the distal end of a stance leg's tangential speed to the ground speed for speeds less than the desired forward velocity imax. The distal end of the leg has a velocity of v = Ileg * #hip where lie,(t) is the length of the leg and #hip(t) is the angular rate of the hip joint. The torque Thip(t) applied is: Thip(t) = Gvei * ((lieg(t) - hip(t)) - Ximax) (3.1) The swing leg control operates as follows. Proprioception information provides the compression of the stance leg Alstance(t), along with the velocity of the stance leg hip #stance(t) and of laterally-opposed swing leg hip #swing(t). The moment of inertia 25 for the stance leg about the hip joint is calculated: Istance I Mthigh - (0.5 - Lthigh) 2 + Mshin - (0.5Lihin - Lthigh - Alstance(t)) 2 (3.2) Hence, the angular momentum of the leg about the hip axis is Lh p(t) = 'eg(lieg(t)) The target velocity bswing(t) (3.3) - Oip. of the stance leg is set to cancel this angular momentum. Istance (t) = - (3.4) Iswing(t) -/Ostance(t) A proportional velocity control loop with negative gain speed to follow bswing(t). The applied hip torque is Thip(t) = Gvei 2 - (bswing(t) + Gel2 swing (t)). servos the swing leg (3.5) Since the swing leg length is always shorter than the stance leg length, Ising(t) < Istance(t) and therefore iswing(t) > &ance(t). The swing leg will hence be in position to enter aerial phase. We suspect that angular momentum about the center of mass plays an important role in dynamically stable locomotion. Swing leg control annuls the pitch-axis angular momentum about the hip, but this is only the smaller of the two terms expressing the effects of a leg's contribution to the angular momentum in the body frame. Further research is necessary before these speculations can be confirmed. The control outlined above for the hip and knee joints is maintained throughout stance phase. Stance phase ends when all feet leave the ground. At the transition, the controller starts the aerial phase timer, records the vertical velocity, and switches stance and swing tripod designations. It then enters aerial phase. 26 xdot-max d/dt x desired [m/sec] !: Stance Leg Length [m] [SENSOR] + G-vel [OUTPUT] Actuator Model -x Stance Hip Gain Product Stance Hip Torque Nm ESENSOR] Stance Hip Angular Velocit ty [rad/sec] Mx Swing Leg Length [in] x Stance Leg Moment of Inertia G_ve12 [PTPT Product Actuator Product. Swing Hip Gain Mdl Swing Hip Torque [N-m] [(SEN SOR] Swing Leg Moment of Intertia Invert [SE NSOR Swing Hip Angular Veloci ty [rad/sec] 0.25 Leg Ext Length [m] K-leg-, [OUTPUT] Stance Leg StiffnessJ[N/m] Derivative Actuator Model Stance Knee Force [N] Actuator Model. Swing Knee Stance Leg Damping [Ns/m] [0.22 Leg Comp Length [m] +~ Kswg -, Swing Leg Stiffness [N/m] d/t B-swg Derivative Swing Leg Damping [Ns/m] Figure 3-4: Block diagram of stance control 27 [OUPUT] Force [N] 3.4 Details of Methodology The control presented here uses the quadrupedal model as inspiration, but both morphology and control differ in a number of very significant ways. The hexapod morphology adds two legs, makes the body link rigid, and removes the head link. The mass, mass distribution, and dimensions have all been changed. Viscous damping has been added to the hexapod's stance leg springs to model mechanical losses. Control differs from the quadruped as follows. Symmetric target velocities and stiffnesses are used for fore- and hindlimbs; in the quadruped these targets are significantly different. The aerial state occurs when all feet leave the ground; in the quadruped it occurs when any single foot loses contact. Only vertical take-off speed is measured to predict ground contact; the quadruped also uses pitch sensor information. The swing leg follows the opposing stance leg's angular momentum; the quadruped's swing leg "mirrors" the position of the stance leg instead. Parameter values differ widely. The quadrupedal model documents that twenty-eight unique velocities, stiffnesses, gains, and feedback targets define its control. The hexapod control is defined by thirteen such quantities. Simulations were developed in Creature Library [21], an MIT Leg Lab extension to the commercial dynamics simulator SD-Fast [9]. A 4th-order Runge-Kutta integrator integrated the equations of motion generated by SD-Fast with a 200 nsec step size. The ground model was a linear spring and damper system with a stiffness of 400 N/in and a viscosity of 100 N-sec/m. All simulation results reported relied on hand-tuned control parameters. At one point, I attempted to computationally generate parameters using naive nonlinear optimization. The optimization attempted to minimize the basic cost function V = 1 (-i(t) - Xd) 2 + (z(t) - Zd)2 + (t) 2 (3.6) to<t<tf with V evaluated using the simulation. In the case of instability, out of range parameters, or other failure cases, V defaulted to its maximal value. The search space was over only five controller parameters. Computing an analytical gradient for the system appeared too difficult an undertaking, and hence Powell's method [29] was chosen as the nonlinear optimizer. It generates gradient information by sampling cost function values for changes in each parameter. It then line-minimizes along the direction which appears most promising. Initial parameter values were selected from a known-good starting point. This approach was proved infeasible due to a number of stumbling blocks. The cost function failed to capture the desired behavior. The optimization seemed to become trapped in local minima. Large portions of the parameter space produce no useful optimization information due to the "brick wall" nonlinearities in the cost function for gait failures. The simulation runs far slower than realtime and an evaluation of a parameter set requires on the order of tens of seconds of simulated time. Hence optimization trials took a long time. Numerical optimization was eventually abandoned in favor of hand-tuning. 28 Chapter 4 Results A mathematically rigorous, analytical evaluation of system stability is not tractable: the high dimensionality, nonlinearity, and dynamic complexity alone limit the ability to present such a treatment. Even if it were possible, the the value of the analyses obtained would be questionable. Yet, the existence of a stable gait in simulation provides thin proof unless its ability to handle the wide range of environmental conditions found in the real-world is demonstrated. This chapter presents evidence that argues for the system's convergence to a steady-state periodic gait over a range of initial conditions, in the presence of disturbances, and with an insensitivity to changes in parameter values. These tests offer a compelling argument that the algorithm exhibits long-term stability and is physically realizable. Simple metrics of the resulting gait (Table 4.1) allow performance comparison to other legged locomotion algorithms. Mean kinematic traces for joints and the center of mass motions describe periodic steady-state behavior (Section 4.1) . Error bars on these kinematic traces provide information as to the typical divergence seen from this mean motion. Torque and force perturbations quantify disturbance rejection (Section 4.2). Robustness testing samples the space of initial conditions to determine those which result in steady-state motion (Section 4.3). Parameter sensitivities measure the necessary precision of the values defining the controller (Section 4.4). Finally, the biological plausibility of the algorithm is discussed (Section 4.5). Throughout this chapter, a gait is termed stable or in a periodic steady state if, over some stated period of time, the gait occurs without a gait failure. A gait failure is defined as body ground contact or joint torques exceeding simulation integration limits. The system is considered stable if it exhibits a stable gait. Additionally, when initial conditions of a simulation are not given, it may be safely assumed they are standard initial conditions: J = 0.7 m/s; z = 0.3 m; 0 = 0.0 rad; 0 = 0.0 rad/sec; and test contact = 0.09 sec. 29 Parameter Mean Velocity Stride Length Stride Frequency Value 1.48 2.35 0.71 2.08 Units m/sec body lengths/sec meters Hz Tripod Duty Cycle 30.2 % Mean Mech Power Peak Mech Power 38.88 481.0 Watts Watts Froude Number 0.957 - Table 4.1: Summary of gait measurements. 4.1 Motion Analysis The gait analysis plots below display the mean motions of the hexapod during steadystate locomotion over a single gait cycle. This gait cycle includes the stance phases of both tripods along with two aerial phases and lasts an average duration of 0.435 sec. The stance phase for one tripod begins at t = 0.00 sec and ends at t = 0.13 sec; the opposing tripod's stance phase begins at t = 0.21 sec and ends at t = 0.34 sec. Figure 4-1 shows the motions of the center of mass along with the system's kinetic and potential energy and angular momentum in the center of mass frame. The remaining plots give leg specific information for the tripod initially entering stance. Since the gait is nearly symmetric, only a single tripod's motions needs be displayed. Figure 4-2 shows the ground reaction forces for the front, middle, and rear legs of this tripod. These forces are split into vertical (z-direction) and horizontal (x-direction) components. Positive horizontal forces point in the direction of robot motion. Figure 4-3 shows the hip joint position, velocity, and force for the same legs. Positive values correspond to retraction. Figure 4-4 shows the knee joint position, velocity, and force. Figure 4-5 shows absolute mechanical power output for the individual joints. These power graphs do not account for regeneration through negative work. They also neglect possible passive mechanical implementations. For example, if the knee joint stiffness in stance phase were implemented with a passive compression spring, no net power output would occur. Previous power numbers do take passive knee implementation into account. These plots were produced in a standard gait plot format. The data were collected over a 10 second simulation. They were then split into samples beginning at the instant of a specific tripod's first ground contact. These samples were resampled to a uniform length and filtered with a 10-point window, low-pass FIR filter. The mean across these samples was then taken and is plotted as the solid line. The two dashed lines delimit plus and minus one standard deviation from this mean. Some minor high-frequency noise is visible at the edges of a few of the plots. This noise is believed to be an artifact of the FIR filter; it should be stressed that it does not result from any system motion or dynamics. 30 Body Pitch COM Horz. Velocity COM Height -0.025 1.6 0.24 -1.5 E 0.22 '0 E -0.03 1.4 4)1.3 0.2 0.04 1.2 0.18 -0.0 5 1.1 0 0.2 0 0.4 0.2 0 0.4 Ang Mom Y Kin. Energy Pot. Energy 14 0.1 9.5 0.08 0.06 9. 13 8.5 12.. 0.04 0.02 8 11 7.5 0 71 10 0 0.2 6.5 0 0.4 0.4 0.2 -0.02 -0.04 -... 0 0.4 0.2 0.2 0.4 Figure 4-1: Mean kinematic motions of the center of mass, system potential and kinetic energies, and pitch-axis angular momentum. GRF Hind Leg (x) GRF Middle Leg (x) GRF Front Leg (x) 5 5 Z 0 0 z 2. z 0 -5 0. -5 - -10 0 0.2 0.4 0 0.2 0 0.4 40 30 0.4 GRF Hind Leg (z) GRF Middle Leg (z) GRF Front Leg (z) 0.2 70- 50 60 40 50 z 20 30 40 z3 z 20 10 20 10 10 0 0 0 0 0.2 0.4 0 0.2 0.4 0 0.2 0.4 Figure 4-2: Mean ground reaction forces: horizontal and vertical components for front, middle, and rear legs of a tripod. 31 Hind Hip Pos Mid Hip Pos Front Hip Pos 0.5 0.5 0' 0 01 0.5 -- 0 0.2 -0.5 -0.5 0.4 0.2 Mid Hip Vel 0 Front Hip Vel S5 0.4 0 5 5 0. 01 0.2 Hind Hip Vel 0.4 0.2 Hind Hip Tor 0.4 0. -5 -5 0 0.2 Front Hip Tor -5 0.2 Mid Hip Tor 0 0.4 0.4 0 4 E 3 3. 2 2 0 0.2 2. 0 02 0 - 0.4 0 00.2 0.4 0 0.2 0.4 Figure 4-3: Mean hip joint kinematics: angle, angular rate, and torque. 32 Hind Knee Len Mid Knee Len Front Knee Len 0.25 0.25 0.25 0.2 0.2 0.2 0.15 0.15- 0.15 -_ 0 0.4 0.2 0 0.4 0.2 Front Knee Vel 4 2 2 0 0- 0 0.4 0.2 Mid Knee Force 0 Front Knee Force 30 0.4 -4 -4 0.4 0.2 0.2 Hind Knee Vel -2 -2. 0 0 Mid Knee Vel 2 LL . 0.4 0.2 Hind Knee Force 40 60 20 40 20 0 20 -10 0 0 0 -_________ 0.4 0.2 0.2 0 0.4 0.2 0 0.4 Figure 4-4: Mean knee joint kinematics: leg length, velocity, and applied force. Hind Hip Power Middle Hip Power Front Hip Power 151 1 15 10 - -0 100 800 0.4 0.2 0 20 5 Front Knee Power 00 0 0 0.2 0.4 0.2 04 Hind Knee Power Mid Knee Power 400 40 0.2 0 0.4 0 0.2 0.4 0 0.2 0.4 Figure 4-5 Mean mechanical joint power output. 33 4.2 Perturbation Testing Perturbation testing measures the influence of environmental disturbances on the stability of a controlled system. In the case of the hexapod, torques and forces are applied to the center of mass during stable locomotion. The resulting linear and angular momentum response is examined. Impulse and step function perturbations are employed to measure the rejection of near-instantaneous and continuous changes to these momenta. Many detrimental environmental conditions, to a first approximation, might be modeled as unforeseen, sudden changes to system momenta. For example, impacts with small obstacles, abrupt ground height variations, or foot contact slips alter the hexapod's linear and angular momenta. Uneven ground impedance or hip torque mismatch change the angular momentum. Results demonstrating the return of momenta to pre-perturbation levels, along with upper bounds on rejected disturbance magnitudes, provide evidence that stable gait survives environmental disruption. Short duration (0.8 msec) torques were applied directly to the center of mass. These approximate a zero time duration impulse but, unlike a zero time duration force, cause a non-zero change in system angular momentum. Perturbations were applied at t = 5.1 sec, which corresponds to the instant of a stance phase initiation. Figure 4-6 shows the magnitudes of the pitch-axis angular momentum (top row) and x-axis linear momentum (bottom row) over two separate simulation runs. A dashed line delineates the instant of perturbation. In the left plot of this figure, a positive torque "impulse" of magnitude 75 N-m acts on the center of mass, producing a forward pitching motion. In the right plot, a negative torque of magnitude -100 N-m is applied to the center of mass again at t = 5.1 sec. In both cases, the disturbance induces a sudden visible pitching of the hexapod which continues as an oscillation for a number of gait cycles. Eventually, this oscillation dies off and a stable gait continues. As the plots indicate, pre-perturbation angular momentum amplitude initially lie almost entirely within a -0.5 to 0.25 kg -m 2 /sec range. At the time of impulse, it peaks sharply to a magnitude of nearly 0.65 kg - m 2 /sec. Shortly thereafter, it returns to its previous range. Similar to the use of torques to test dynamic rejection of sudden angular momentum changes, short-duration forces were used to study the effects of sudden changes in linear momentum. These forces acted on the center of mass, again at t = 5.1 sec, again for a duration of 0.8 msec , and in each of four directions (upward, downward, forward, and hindward). Figure 4-7 shows the angular momentum (top row) and x-axis linear momentum (bottom row) effects originating from horizontal force perturbations. Figure 4-8 shows the x- and z-axis linear momentum response to vertically-directed forces. A different class of perturbation tests were then performed. These tests measure the ability of the controller to reject continually applied, or "step" disturbances. At t = 5.1 sec, a force or torque is applied to the center of mass for the remainder of the simulation. If the hexapod completes the 10.0 seconds following perturbation without a gait failure, the magnitude of the perturbation is increased. This process is repeated until instability occurs after the step disturbance begins. In this manner, a 34 Angular M~tu (pitch) 0.6 0.6 0.4 0.2 0 02- _0.2 -0.4 _0A 4 5 6 9 7 10 11 5 12 a 7 9 10 11 12 10 11 12 Ur*& MOrantUmn (X) Ulnear Momnantumn (x) 9.5 9 -86.5 7.5 7 6.5 H7 4 5 6 7 a 9 10 11 6 5 12 7 a 9 (b) -100 N-m at t=5.1sec, 0.8 msec (a) 75 N-m at t=5.1sec, 0.8 msec Figure 4-6: Impulse torque perturbations: resulting momenta vs. time for (a.) positive and (b.) negative torques. loose upper bound on rejected step magnitudes is established to at least two significant figures. Table 4.2 lists these maximal step magnitudes. Perturbation Torque Step Force Step Units N-m N-m N Direction positive negative forward Max Mag 4.1 2.75 17.9 hindward 5.5 N upward downward 21.75 8.1 N N Table 4.2: Maximum magnitude of step perturbations resulting in stable gait, for at least 10.0 sec after perturbation. Perturbations applied for all time after 5.1 sec. The angular momentum of the hexapod during normal locomotion is relatively low compared with the bounds of disturbance generated momentum peaks. Recent research within the lab has produced preliminary evidence that human walking and other locomotive behavior possesses a near-zero instantaneous system-wide angular momentum magnitude. This may relate to the overall stability occurring in the model. Further investigation is necessary. What physical conditions can these step perturbations be seen to model? Continual forward and hindward forces occur during hill climbing and could be seen as velocity errors and certain ground conditions. Downward and upward forces also occur on slopes, test resilience to controller ground contact time mis-predictions, and evaluate operation in other gravitational fields. It is more difficult to reasonably interpret step torques; they should be considered as merely quantifying maximum 35 Angular Morentum (tch) Angular Mmentum (ptch) 0 0.6 .2- 0.4 0.1 0.2 0 0.1 -0.2 5 7 6 8 9 10 5 11 6 unear uear Momentrn (x) 12 I 9 13 - 6 8 7 7 1 9 10 11 12 10 11 12 Momrentum(x) I- . 8 11 '7 '10 6 9 8 5 6 8 5 L9 10 5 11 6 7 8 9 (b) Rearward 600N, at t=5.1 sec, 0.8 msec (a) Forward 600N, at t=5.1 sec, 0.8 msec Figure 4-7: Horizontal impulse force perturbation: resulting linear and angular momenta. rejected angular momentum error for lack of a natural cause. 36 Linear Momentum (z) Linear Momentum (z) 4 - 2 -2 0 -2-4 -6 -* -4 S 6 7 8 9 Uea Mmu 10 11 5 12 11 6170 x I 5 . [ 7 5 6 7 a 9 10 5 i1 a7 10 11 (b) Downward 400N, at t=5.1 sec, 0.8 msec (a) Upward 200N, at t=5.1 sec, 0.8 msec Figure 4-8: Vertical impulse force perturbation: resulting horizontal and vertical linear momenta. 37 4.3 Robustness To test the robustness of the controller, a subspace of initial dynamic conditions is sampled. The goal is to determine the area inside this subspace for which stable, long term locomotion results. If locomotion is maintained for some defined period of time, then the initial conditions are considered to lead to a steady-state periodic gait. Ideally, the area over which this convergence occurs should be large. The results of two separate tests are documented. The first test evaluates a subspace of the initial height and forward velocity. The height was varied over the range 0.3 m < z < 0.8 m in 0.1 m increments. Initial test contact was adjusted appropriately. The velocity was varied over the range 0.2 m/sec < i < 2.0 m/sec in 0.1 m/sec increments. In Figure 4-9, marked areas represent initial conditions from which stable gaits occur for a duration of at least 20.0 seconds. In all sampled cases, either the simulation converged to a periodic cycle or instability occurred within the first 5.0 seconds. Robustness to Initial Conditions 1.1 0.9 0.8 0.70.6 0.5- 0.4 0.30.2 . 0.2 0.4 0.6 0.8 1.4 1 1.2 Forward Velocity (nVsec) 1.6 1.8 2 Figure 4-9: Robustness to initial height and velocity: dark areas represent conditions converging to a stable gait with duration of at least 20 seconds. In the second test, the pitch and pitch derivative are varied to test orientation robustness. Figure 4-10 displays initial conditions which result in stable runs. The test samples initial pitch over the range -1.3 rad < 0 < 1.1 rad, in 0.01 rad increments, and the initial pitch derivative 0 over the range -1.0 rad/sec < 6 < 1.0 rad/sec, in 0.5 rad/sec increments. Gaits lasting at least 10.0 sec were denoted as stable. Somewhat surprisingly, a number of unstable initial pitch and derivative points lie 38 3 7E EI.IE F Robustness to Pitch Conditions 1111 I 1 S0 -1 -2 -3 inrir7 -1 -4--1 -0.5 0 Pitch (rad) 0.5 1 Figure 4-10: Robustness to initial pitch and pitch rate of change: dark areas represent conditions converging to a stable gait with duration of at least 10 seconds. inside regions surrounded by stable initial conditions. I cannot produce a satisfactory explanation of these unstable points. It may suggest that certain body orientations at the instant of ground contact are more susceptible to instability caused by non-zero angular momentum values. Further investigation of these conditions is necessary. 39 4.4 Parameter Sensitivity Parameter sensitivity testing measures the amount which parameter values may vary before the controller ceases to produce a stable long-term running gait. Very precise parameters indicate that using the algorithm on a physical platform will require very precise replication of the simulation and would therefore likely malfunction. Parameter sensitivity also hints at which values have the greatest effect on the stability of the system. Parameter kieg Minimum Nominal 675 750 Maximum 1100 13.5 6.0 3.5 -0.475 -0.2 -0-150 1.75 1.50 1.10 target khip protract 1.49 (-52%) 2.12 (-65%) 3.104 0.310 0.400 6.062 retract 0.4 0.00 kg 0.550 rad kg 0.94 rad (+134%) (-100%) Table 4.3: 5.23 (+68%) 6.79 (+12%) (+37.5%) (-23%) target #hip m/sec (+16%) (-27%) body mass (leg mass constant) total mass (leg and body changed) N-sec/m (+137%) (-25%) Xmax N-sec/m (+125%) (-42%) Gve1 2 N/m (+46%) (-10%) Gvel Units Independent sensitivity of parameter values: minimum, nominal, and maximum values for which a stable gait of more than 10.0 sec results. A variation is made to an individual parameter value, and then the simulation is tested from standard initial conditions. By varying only a single parameter and holding the other values constant, the effects of that parameter can be isolated. The parameter under test is reduced until a simulated trial fails to maintain a stable gait for at least 10 seconds. The last value for which a stable gait occurred is recorded. This lower bound is refined to a precision of at least two significant figures by binary search. The test is repeated, increasing the parameter to establish an upper bound. Results are tabulated in Table 4.3. This test should only be interpreted as a "zeroth-order" evaluation of sensitivities. Due to the nonlinearity of the system, the results are specific to the operating point and conclusions cannot be made about the simultaneous variation of multiple parameters. Furthermore, the results cannot guarantee all parameter values lying within the minima and maxima produce stable gaits. There exists the possibility that some "island of instability" lies between sampled points. Although only anecdotal, it is encouraging to note that no such regions were discovered during testing. 40 The parameters which permitted the smallest variation were kie, and the total system mass; both parameters changed by around 10%, but in opposite directions. One possible speculation supported by this is decreasing kie, and increasing system mass may produce similar effects on motion in the controller. Body mass could be increased by over 2 kg before instability. Since leg masses are held constant, the overall system mass is increased by 2 kg and the proportion of body-to-leg mass changes. But increase of total mass (while maintaining body-to-leg proportions) causes instability after only 0.73 kg. This argues that the effect of leg mass on stability is more critical than that of body mass. Additionally, without changing any other parameter value, speeds may be targeted over a 0.65 m/sec range without effecting stability. This single parameter speed selection was impossible in the quadruped trotting model; changing target speed required re-tuning a number of other parameters [13]. Finally, the insensitivity to the target leg protraction angle Ostance protract is surprising in that previous control approaches have required a high degree of precision to properly regulate a trade-off of velocity and apex height [31]. 41 4.5 Biological Plausibility How can the similarity of biological running gaits and the gait generated here be quantitatively evaluated? Since the morphology of the system models no specific species, a direct comparison is impossible. Instead, cross-species metrics from the literature are calculated for the simulated hexapod gait. These metrics are then compared to values predicted by two biological models. Table 4.4 tabulates these calculations and predictions along with the size of one standard deviation variance. The table also includes brief descriptions of the metrics and their sources. Gait Metric Sim Bio Fgrf 165 172.9 Al 0.042 0.073 00 0.40 0.56 to 0.13 0.089 0.139 Bio 1 Stdev Units Description / -38.54 +0.023 / -0.017 +0.10 / -0.86 N peak vertical GRF [10] meters peak leg compression [10] rad leg sweep half-angle [10] sec ground contact time [10] 0.086 / -0.014 +0.008 / -0.007 sec half resonant period [10] 1.18 4.63 +1.44 / -1.10 Watts/kg leg-spring work rate [10] kleg 3.956 2.39 +0.74 / -0.57 kN/m combined leg stiffness [10] kvert 7.86 1.78 +1.56 / -1.31 ±0.37 kN/m - equivalent vertical stiffness unitless peak force measure [10] F9 ,. 7.50 2.77 Fgrf leg- 1 0.92 0.78 ±0.29 - unitless peak force per leg [4] 0.168 0.096 ±0.02 - unitless leg comression [4] krel 16.48 18.60 ±1.68 - relative stiffness [4] krelleg- 1 5.48 7.82 ±2.26 - relative stiffness per leg [4] T 2 Pspring +49.61 +0.016 Source [4] Table 4.4: Comparison of simulation measurements with biological model predictions. These numerical predictions take one of two forms. Either they are logarithmic fits of observed data to functions of organism mass, or they are dimensionless quantities calculated from polypedal trotters. In both cases, they derive from simplified springmass models of running, and most are measured across multiple morphologies, gaits, and species. Limitations of space prevent the in-depth discussion of the meaning of the metrics, the assumptions of the models from which they derive, or the procedure by which biological values were obtained; instead, the reader is directed to the cited literature. The peak ground reaction forces (Fgf), ground contact times (t,), half-resonant 1 period (T/2), vertical stiffness (kvert), and normalized force per leg (Fgrjleg- ) all lie within a standard deviation of biological predictions. A possible conclusion: the "aerial to stance to aerial" bouncing behavior of the system is highly similar to bio42 logical systems. All metrics related to the stiffness of the leg lie within two standard deviations, indicating that the system stiffness may only partially replicate that of biological systems. It is worth noting the value furthest afield, Ppring, is not unexpected. The metric measures the energetic equivalence of the leg behavior with a passive linear spring. Since the model of the leg the hexapod is just that, a value near 1.0 is expected. Natural systems do not manage quite this level of mechanical efficiency. The deviation from biological is a consequence of the morphological model. 43 44 Chapter 5 Conclusions and Future Work This work makes the following contributions: 1. A new hexapedal locomotion controller which demonstrates a stable and fast gait in simulation. 2. Results indicating this gait responds favorably to variations in initial conditions and momenta during dynamic locomotion. 3. New numerical evidence suggesting that the class of controllers originating in the quadrupedal trotting model exhibit robust locomotion in hexapedal morphologies. Although the simulated control algorithm has evaluated favorably, at least three far-reaching challenges must be met before the system described here reaches its full potential. First, tests on a physical system must be performed. Without this confirmation, there is always the possibility some real-world factor was overlooked in these simulations. Currently, planned testing will be performed on the Scorpion robot. Should this fall through, or turn out mechanically implausible, physical trials will require the design and production of a new robot. In either case, such an evaluation is a necessary prerequisite to acceptance of the work here. Second, the tedious hand-tuning procedures need to be automated in some fashion. Hand-tuning requires significant effort from an experienced individual with intuition for parameter choices. Additionally, many of the hypotheses made about this algorithm take the form, "This algorithm can produce some behavior." The handtuning procedure can never disprove such a statement, it can only prove by example. There always exist more unchecked combinations of parameters. Hand-tuning's laborintensity and inability to negate certain conclusions make its automation a priority. Finally, a more fundamental understanding of this algorithm needs to be developed. How do the control parameters relate to the morphology? What additional high-level feedback control could enhance stability? Can the algorithm be further simplified? What biological conclusions can be confirmed? A more advanced theoretical 45 framework is necessary to address these questions. Mechanisms such as leg retraction, angular momentum matching, and ground contact prediction need additional theoretical explanation. I hope the simple algorithm presented in this thesis, one of only a documented few capable of producing dynamically-stable hexapedal running gaits, will encourage and aid further legged locomotion research. 46 Appendix A Mechanical Designs This appendix briefly documents three mechanical designs I completed. The parts detailed here attempt to retrofit the Scorpion, a statically-stable walking hexapod robot, to enable it to operate with the algorithm detailed above. These segments replace the most distal segment of the legs. They increase the stroke length and stiffness to the values required by the simulation. The initial passive distal segment design provides a stroke length of two inches. An interchangeable helical compression spring sets the stance stiffness, and a linear-stroke potentiometer measures segment compression. Figure A-i shows CAD drawings of the complete distal assembly. I II1 -0--------- Figure A-1: Assembly drawings and section view of first distal segment design. Due to external deadlines, time pressure dictated a simple design. Parts were 47 conceived to be produced by a novice machinist with only a week of machining time; nine segments were produced in seven business days by a commercial shop. The unit is housed in an aluminum tube casing chosen from stock tubing sizes and turned down to a requisite thickness. Two interior rings affix to the inner housing, oriented coaxially, with a small gap between them. These rings hold a polymer thrust bushing. A smaller tube moves in and out of the housing along this bushing. A motion stop, consisting of a washer pressfit onto the slide, holds the slide inside the housing during extension. An additional light compression spring provides return force for the potentiometer. After production, trials found that the overall weight of the initial design may be too high. Plans were also altered, focusing on the eight-legged model of the Scorpion. This necessitated manufacture of more segments, so I took the opportunity to tune the design. Figure A-2 shows the revised passive distal segment design. Its function is essentially the same as the initial design. The revision's improvements include: 1. Replacement of exterior screws. These screws may bind on the environment, over-constrain the design, and add a disassembly risk. The screws were replaced with interior threads. 2. Unnecessary metal was removed, reducing weight. 3. Reduced part count and assembly. 4. The bearing holder was eliminated, and instead the bearing is secured directly to the outer distal housing. This reduces weight and part count, rotationally confines the bearing, and presents easier assembly. 5. The washer pressfit to the top of the lower slide was removed. This washer acts as a motion stop. There was concern that the pressfit glue would fail, allowing the slide to separate from the distal segment. It was replaced with a machined lip integral to the slide. 6. Grooves to hold the spring in position were added. 7. A metal sleeve on the potentiometer holder protects the potentiometer from buckling due to misalignment. 8. The interface screw was too long, causing a visible gap between the hip and the distal segment. Finally, additional work went into a preliminary pneumatic design (Figure A-3). The appeal of this design was its ability to inject energy during stance. Questions had arisen as to the Scorpion's eventual ability to provide the hip power required in the running algorithm. The initial power and energy analyses indicated that a small air tank could provide sufficient energy to operate the legs for the duration of battery life. The design was eventually scrapped for non-technical reasons. 48 Figure A-2: Assembly drawing and section view of revised distal segment Figure A-3: Sectioned model of preliminary pneumatic distal segment 49 50 Appendix B Control Source Code The source code contained in this appendix: 8legs.h (Section B.1) is the header file which defines morphological values. create-hexahop.c (Section B.2) contains the code which generates the hexapod morphology. bug-hop.h (Section B.3) is the header file for control code. bug-hop.c (Section B.4) is the code of the control presented in this thesis Miscellaneous Functions (Section B.5) lists utility functions necessary for a complete understanding of the listed code. I reduced the code to contain only functions directly relevant to the controller presented in this thesis. Utility functions, data collection, and experimental code has been removed. These files require Creature Library and SD-Fast in order to build the simulation. Table B.1 describes the identifiers used in the source below, along with correspondences with the variable names used previously in the thesis. 51 Table B.1: Variable names used in simulation source code and coresponding symbols from text. Physical State ls.t q.x q.z q.pitch q.hipn-z q.hipn-x q.kneen qd.x qd.z qd.pitch On qd.hipn-z #n qd.kneen tau.hipn-z tau.kneen Controller State Is.current-state ls.next-state Is. test-contact gcifootn.fs ls.tripod Is.tangvel-d Is.ttakeoff Is.moi-n Controller Parameters in ls.k-aerial-kn ls.b-aerial-kn Is.kLaeriallhip Is.b-aerial-hip ls.k-leg Is.bknee ls.maxvel ls.hip-retract ls.hip-extend ls.knee-extend ls.leg-ratio t x z 0 in simulation current time body COM x position (in laboratory frame) body COM z position (in laboratory frame) body pitch angle hip n protract/retract angle hip n outward splay angle knee n length of compression body COM x velocity body COM z velocity body pitch rate of change hip n protract/retract angular rate knee n compression velocity Tn Fkn test contact In Kaerial knee Baerial knee Kaerial hip Baerial hip kieg bleg Xmax Oretract #protract lextend 1compress ls.G-vel Gvei ls.Gvel2 continued on next page Gvel2 FSM current state (AERIAL or STANCE) FSM next state estimated time of AERIAL phase end foot n ground contact foot switch current stance tripod target leg retraction speed time of STANCE phase end moment of intertia of leg n about hip joint AERIAL phase knee position gain AERIAL phase knee position damping AERIAL phase hip position gain AERIAL phase hip position daming front/rear linear stance leg spring stiffness front/rear linear stance leg damping maximum forward velocity AERIAL phase hip retraction target position AERIAL phase hip protraction target position AERIAL phase knee extension length swing knee retraction distance for STANCE defined as 'extend - ls.leg-ratio STANCE phase stance tripod hip velocity gain STANCE phase swing tripod hip velocity gain 52 continued from previous page Simulation Parameters ls.control-dt ls.plant-dt ls.check-dt ls.servo-dt gnd-footn.k-x gndifootn.bx gnd-footn.k-z gndlfootn.b-z Servo Interface ls.k-joint Is.bjoint ls.ff-joint q-d.joint ls.utau-joint ls.ltau-joint ls.k-stop ls.b-stop time increment to execute control code step size for dynamic state evolution time increment to check for dynamic drift time increment to update servo control ground model stiffness (x direction) ground model viscosity (x direction) ground model stiffness (z direction) ground model viscosity (z direction) joint position gain joint position damping joint feedforward torque desired joint position joint applied torque upper limit joint applied torque lower limit joint stop contact model stiffness joint stop contact model viscosity 53 B.1 6legs.h /* 6legs.h */ /* defined constants for hexahop body morphology */ /* Matt Malchano */ #define NUM-LEGS 6 /* number of legs */ #define BODYX 0.620 #define BODYY 0.145 #define BODY-Z 0.100 body length (sagittal plane) */ body width (frontal plane) */ body height (transverse plane) */ #define SHIN-Z 0.176 #define SHINM 0.0565 #define SHIN._RAD 0.024 shin length */ shin mass shin cylinder and end-cap radius */ 10 #define PIN-Z 0 #define PIN-M 0.0 /* pin link length (unused) */ /* thight link length (m) */ #define THIGH.Z 0.076 #define THIGH-M 0.0908 /* thigh link mass */ #define THIGH-RAD 0.15 /* thigh cylinder and end-cap radius */ #define BODY-M 3.104 20 /* body segment mass */ #define TOTALM (BODYM + NUMLEGS*(THIGHM + SHINM + PIN-M)) #define KNEE-MIN 0.0 #define KNEEMAX 0.2 /* knee joint stop, min compression */ /* knee joint stop, max compression */ #define HIPX-MIN -PI/2 #define HIPXMAX PI/2 /* hip joint stop, min angle */ /* hip joint stop, max angle */ #define HIPZMIN -PI/2 #define HIPZ-MAX PI/2 /* hip joint stop, min angle */ /* hip joint stop, max angle */ 30 #define SPONGEZ 0.005 /* ground contact max penetration */ #define CONTACTZ (SHIN-Z+SHINRAD-SPONGEZ) //the x positions of hip joint connections to the // body indexed by hip joint number // Oth ignored, since legs numbered from 1. static const double PX[NUM-LEGS+1] = { 0.0, 0.5 * BODYX, 0.0, -0.5 * BODYX, -0.5 * BODYX, 0.0, 0.5 * BODYX }; 40 // the y positions of hip joint connections to body // indexed by hip joint number // Oth ignored, since legs numbered from 1. static const double PY[NUMLEGS+1] = { 0.0, 50 -BODY-Y, -BODY.Y, -BODY-Y, BODY-Y, BODYY, BODY-Y, }; // the z positions of hip joint connections to // indexed by hip joint number // Oth ignored, since legs numbered from 1. static const double PZ[NUMLEGS+1] = { body 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; 60 54 B.2 createlhexahop.c #include <stdio.h> #include <cl-lib.h> #include "8legs.h" // function prototypes void make-leg(int n); void body-shape(; void thigh-shape(int legno); void shin-shape(int legno); void pin-shapeo; void subn(char*, int); 10 int main(int argc, char* argv[]) { int i = 0; command-line(argc, argv); begin-species("hexahop"); // confine the model to sagittal plane new-link("base"); set-parent(GROUND); new-joint("trainer"); set-planar-joint("x", "z", "pitch", 'x', 'z', 'y'); // this servo set limp. servo(1, "pitch", PDFFSERVO, "ls.k.pitch", "is.b.pitch", "1s.ff.f.pitch"); 20 new-link("body"); body-shape(; 30 } //set-parent(FREE); // uncomment for 3D simulations for(i = 1; i <= NUMLEGS; i++) make-leg(i); end-specieso; /* make-leg(int n) constructs the morphology of leg n. " It perfoms some string replacement to generate the " names for the required variables. It then calls all * the CreatureLibraryroutines nececssary 40 void make-leg(int n) { // various labels that appear in final sim application char hip-z[12] = "hip#_z"; char hip-x[12] = "hip#_x"; char char char char char k-hip-z[15] = "1s.khip#_z"; b-hip-z[15] = "1s.bhip#_z"; ff-hip.z[15] "is.ffhip#_z"; utau-hip-z[20] = "1s.utauhip#_z"; ltau-hip-z[20] = "is.itauhip#_z"; char char char char k-hip-x[15] = b-hip-x[15] = ff-hip-x[15] = utau-hip-x[20] 50 "1s.khip#_x"; "is.bhip#_x"; "1s.ffhip#_x"; = "is.utauhip#_x"; 55 char ltau-hip-x[20] char char char char char char knee[12] = "knee#"; k-knee[15] = "is.k-knee#"; b-knee[15] = "1s.bknee#"; ff-knee[15] = "is.ff-knee#"; utau-knee[20] = "1s.utauknee#"; ltau-knee[20] = "1s.itauknee#"; char char char char shin[12] = "shin#"; foot[12] = "foot#"; thigh[12] = "thigh#"; pin[12] = "pin#"; = "1s.itau-hip#_x"; 60 70 // replace '#' above with leg number subn(hip-z, n); subn(hip-x, n); subn(k-hip-z, n); subn(b.hip-z, n); subn(ff-hip-z, n); subn(k-hip-x, n); subn(b-hip-x, n); subn(ff-hip-x, n); subn(knee, n); subn(k-knee, n); subn(b-knee, n); subn(ff-knee, n); subn(shin, n); subn(foot, n); subn(thigh, n); subn(pin,n); subn(utau-hip-z, n); subn(tau.hip-z, n); subn(utau-hip-x, n); subn(tau-hip-x, n); subn(utau-knee, n); subn(ltau-knee, n); // create the hip protraction/retraction joint jointpin(hipz,'y'); limit(hip-z, HIPZMIN, HIPZ.MAX); servo(i, hip-z, PD-FFSERVO, k.hip-z, b-hip-z, ff-hip-z); user-servo(5, hip-z, "pd-ff.taulimit-servo", 5, k-hip-z, b-hip-z, ff-hip-z, utau-hip-z, set-parent("body"); set-joint-offset(PX[n], PY[n], PZ[n]); 80 Itau-hip-z); // the pin link allows us to seperate the joint axes, but currently //its length is 0. newilink(pin); pin-shapeo; 90 // create the hip sprawl joint joint pin(hip-x, 'x'); limit(hip-x, HIPZ-MIN, HIPXMAX); servo(i, hip-x, PDFFSERVO, k-hip-x, b-hip-x, ff-hip-x); user-servo(5, hip-x, "pd-ff taulimit -servo", 5, k-hip-x, b-hip-x, ff-hip-x, utau-hip-x, set-joint-offset(0.0,0.0,0.0); Itau-hip-x); 100 // generate the thigh link and give it the appropriate shape new-link(thigh); thigh-shape(n); // generate the knee joint joint-slider(knee,'z'); limit(knee, KNEEMIN, KNEEMAX); servo(i, knee, PDFF-SERVO, k-knee, b-knee, ff-knee); user-servo(5, knee, "pd-ff taulimit-servo", 5, k-knee, b-knee, ff_knee, utau-knee, set-joint-offset(0.0, 0.0, -THIGH-Z); Itau-knee); 110 // // finally, generate the shin and create a ground contact test point at the tip of the foot. new-link(shin); shin-shape(n); ground-contact(foot, 0.0,0.0,-CONTACTZ); I /* subn(char* s, int n) destructively modifies string s, * replacing all occurences of '#' with the single digit * number n's character value. 120 void subn(char* s, int n) { while(*s != '\0') { 56 if(*s s++; } '#) *s = (char)(n+48); } /* body-shape() makes the body shape, a big rectangular box. * It also adds ground contact detectors to the bottom corners. 130 void body..shape() { begin-shape(; use-density(0.25 * 1.76 * ALUMINUMDENSITY/4.0); translate(0.0,0.0,-BODY-Z/2.0); shape(SBRICK, BODY_X, BODY-Y, BODY-Z); ground-.contact("body1 BODYTOT*0.35,-BODYY/2.0,-BODYZ/2.0); ground..contact("body2", BODYTOT*0.35,BODYY/2.0,-BODYZ/2.0); ground-contact("body3", -BODYTOT*0.35,BODYY/2.0,-BODY..Z/2.0); ground-contact("body4", -BODY-TOT*0.35,-BODY-Y/2.0,-BODY-Z/2.0); end-shapeo; 140 I /* pinshape() generates a cylindrical pin which connects * the two hip joints together. 150 void pin-shape() { begin-shape(; use-density(ALUMINUM-DENSITY/4.0); translate(0.0,0.0, -THIGH..Z/100.0); shape(SCYLINDER, THIGHZ/50.0,THIGH-RAD); end-shapeo; } 160 /* thigh-shape(int legno) creates the thigh shape. It * is optionally passed a legno to customize the leg's * mass (unused). void thigh-shape(int legno) { begin-shape(; if((legno == 2 1| legno == 5) && DBLMIDMASS) { use-density(2.0 * 0.25 * ALUMINUM-DENSITY/8.0); } else use.density(0.25 * ALUMINUMDENSITY/8.0); 170 shape(SSPHERE,JOINT-RAD); translate(0.0,0.0,-THIGH-Z); shape(SCYLINDER, THIGH-Z,THIGHRAD); shape(SSPHERE,JOINTRAD); end-shape(; 180 /* shin-shape(int legno) creates the shin shape. */ void shin-shape(int legno) { begin-shape(; if((legno == 2 11 legno == 5) && DBLMID-MASS) use-density(2.0 * 0.25 * ALUMINUM-DENSITY/8.0); else use-density(0.25 * ALUMINUMDENSITY/8.0); translate(0.0,0.0, -SHINZ); shape(SCYLINDER, SHIN_ZSHINRAD); 57 190 identity(; rotate('y', 180.0); translate(0.0,0.0,-SHINZ); shape(SHEMISPHERE,SHIN-RAD); end-shapeo; } 200 B.3 bug-hop.h #include #include #include #include <stdio.h> <math.h> "creature.h" "81egs.h" #ifndef __BUGHOPH #define __BUG-HOP-H #define AERIAL *define STANCE 00 20 #define LEG.LEN #define MTHIGH #define MSHIN (THIGH-Z + PINZ+ SHIN-Z) 0.46411 0.0293018 10 void bug-hop2(); static static static static void aerial-controller(); void stance..controller(); void angmo-instrumento; double angmo(int, double, double, double, double, double*, double*, double*); 20 #endif B.4 bugihop.c #include "bug-hop.h" /* bug-hop2() is the entry function into the control code. * It is called once every control-dt seconds, examines the " dynamic state of the robot, and sets the relevent servo * variables and tau torque output variables to generate the " gait. Depending on the FSM state, it calls either an aerial * control function or stance control function. void bug-hop2() 10 { = ls.next-state; switch((int)ls.current-state) { case(AERIAL): aerial controllero; break; case(STANCE): stance-controller(); break; ls.current-state } /* aerial-control() implements AERIAL phase control */ void aerial-controller() { 58 20 ls.k-aerialkn; ls.k-kneel Is.b-kneel = ls.b.aerial-kn * sqrt(Is.k-kneel * (THIGHM + SHINM)); ls.k-knee2 ls.b-knee2 = ls.k-knee3 = = ls.b-knee3 = ls.k-knee4 ls.b-knee4 = ls.k-knee5 = ls.k-knee6 =s.k.kneel; = ls.b-knee5 = ls.b-knee6 ls.b-kneel; ls.k.hiplz = ls.k-aerial-hip; ls.b-hipl-z = ls.b-aerial-hip; ls.k-hip2-z ls.b-hip2-z = ls.k-hip3_z = ls.k-hip4-z = ls.k-hip5_z = ls.k-hip6_z = ls.k-hipl-z; = ls.b-hip3_z = ls.b-hip4_z = ls.b-hip5-z = ls.b-hip6_z = ls.b-hipl-z; 30 if(ls.tripod == 0) { q-d.hiplz = q-d.hip5_z = q-d.hip3-z = ls.hip-retract; q-d.hip2-z = q-d.hip4_z = q-d.hip6-z = ls.hip-extend; q-d.kneel = q-d.knee5 = q-d.knee3 = ls.knee-extend + ls.leg.ratio; q-d.knee2 = q-d.knee4 = q-d.knee6 = ls.kneeextend; } else { q-d.hip2-z = q-d.hip4_z = q-d.hip6-z = ls.hip-retract; q-d.hiplz = q-d.hip3-z = q-d.hip5_z = ls.hip-extend; } q-d.knee2 = q-d.knee4 = q-d.knee6 = ls.leg.ratio + ls.kneeextend; q-d.kneel = q-d.knee3 = q-d.knee5 = ls.knee-extend; if(ls.t + ls.control-dt >= ls.t.est-contact) { // The controller will enter STANCE phase next // control execution. Prepare for the transition. if(ls.tripod ls.k-kneel = ls.k-knee3 ls.k-knee5 1) { ls.kleg; ls.k-kneel ls.b-knee5 + ls.k-knee3; = ls.b-knee3 = Is.b-knee; ls.k-knee6 = ls.k-knee4 = ls.b-knee6 = Is.b-knee4 = else 50 =s.rkileg-mult * ls.kleg; ls.b-kneel } 40 ls.k-knee2 ls.b-knee2 = 0.6 * ls.k.leg; = 0.3 * ls.b-knee; { ls.k-knee6 60 = Is.k-leg; ls.k-knee4 = ls.rk-leg.mult * ls.kileg; ls.k-knee2 = ls.k-knee4 + ls.k-knee6; Is.b-knee2 = ls.b-knee4 = Is.b-knee6 = ls.b-knee; Is.k-kneel = ls.k.knee5 = ls.k-knee3 = 0.6 * Is.b-kneel = ls.b-knee5 = ls.b-knee3 = 0.3 * ls.kileg; ls.b-knee; I ls.k.hiph-z = ls.k~hip3_z = ls.k.hip5..z =0.0; 70 Is.k-hip2..z = ls.k-hip4_z = Is.k-hip6_z = 0.0; Is.b..hipl-z = ls.b-hip3_z = ls.b-hip5_z = 0.0; ls.b-hip2-z = Is.b-hip4-z = ls.b-hip6-z = 0.0; ls.tangvel-d (ls.tripod?ls.maxvel:-ls.maxvel); Is.next-state STANCE; } 80 /* stance-controller() implements STANCE phase oid stance-controller() { // depending on the active tripod... if(ls.tripod == 1) { // stance leg velocity control loops ls.ff-hipl-z = -ls.G-vel * (qd.hipl.z * (0.25 Is.ff-hip5_z = -ls.G-vel * (qd.hip5_z * (0.25 ls.ff-hip3_z = -ls.G-vel * (qd.hip3-z * (0.25 control */v - q.kneel) - Is.tangvel-d); - q.knee5) - Is.tangvel-d); - q.knee3) - Is.tangvel-d); 59 90 // swing leg velocity control loops ls.ff-hip4_z = ls.G.vel2 * (qd.hip4_z + (ls.moi-3/ls.moi-4) * qd.hip3_z); ls.ff-hip2_z = ls.G-vel2 * (qd.hip2-z + (ls.moi_5/ls.moi_2) * qd.hip5_z); ls.ff-hip6_z = ls.G-vel2 * (qd.hip6-z + (ls.moi-l/ls.moi_6) * qd.hiplz); } else { // stance leg Is.ff-hip4_z = ls.ff-hip2_z = ls.ff-hip6_z = } velocity control loops -1s.G-vel * (qd.hip4_z * (0.25 - q.knee4) + ls.tangvel-d); -ls.G-vel * (qd.hip2_z * (0.25 - q.knee2) + ls.tangvel-d); -ls.G-vel * (qd.hip6.z * (0.25 - q.knee6) + ls.tangvel-d); 100 // swing leg velocity control loops Is.ff-hipl-z = ls.G-vel2 * (qd.hipl-z + (ls.moi_6/ls.moi-1) * qd.hip6_z); ls.ff-hip5-z = ls.Gvel2 * (qd.hip5_z + (ls.moiL2/ls.moi-5) * qd.hip2-z); ls.ffhip3_z = ls.G-vel2 * (qd.hip3_z + (ls.moi-4/ls.moi_3) * qd.hip4-z); if(gc-footl.fs I gc-foot2.fs | gc-foot3.fs I gc-foot4.fs |I // a ground contact has occurred during stance phase. // this prevents leaving stance phase prematurely. ls.gnd-contact = 1.0; (&.110 gc.foot5.fs || gc-foot6.fs) { if( !gcfootl.fs && !gc.foot2.fs && !gc.foot3.fs &&!gc-foot4.fs && !gc-foot5.fs && !gc-foot6.fs && ls.gnd-contact == 1.0) { // All the feet have left the ground after a ground // contact had occured, go ahead and switch into aerial phase. ls.next-state = AERIAL; // swap the swing/stance tripods ls.tripod = !(int)ls.tripod; ls.gnd-contact = 0.0; 120 ls.t.takeoff = ls.t; // predict next ground contact. Is.t-estcontact = ls.G.delay*(qd.z/9.812) + ls.ttakeoff; } /* angmo.instrument() calculates the moments of intertia for * each leg about the hip axis. void angmo-instrument() ls.moi1 = 9.5545e-4 + ls.moi_2 = 9.5545e-4 + ls.moi-3 = 9.5545e-4 + ls.moi_4 = 9.5545e-4 + ls.moi_5 = 9.5545e-4 + ls.moi_6 = 9.5545e-4 + 130 { 7.7044e-5 7.7044e-5 7.7044e-5 7.7044e-5 7.7044e-5 7.7044e-5 + + + + + + 0.0293*sq(0.25 0.0293*sq(0.25 0.0293*sq(0.25 0.0293*sq(0.25 0.0293*sq(0.25 0.0293*sq(0.25 - q.kneel); - q.knee2); - q.knee3); - q.knee4); - q.knee5); - q.knee6); I /* calcuate leg angular momentum in system center of mass frame. * currently unused. 140 double angmo(int leg, double theta, double dtheta, double lknee, double dknee, double* amx, double* amy, double*amz) { double double double double thighIcm, shinIcm; s-mrxr-x, s.mrxr-y, s-mrxr-z; t-mrxr-x, tLmrxr-y, t-mrxr-z; 1; 150 // location of shin com I = THIGHZ + (SHIN-Z/2) - lknee; // revolution term moments about com. thigh-Icm = (1/12)*M-THIGH*(sq(THIGHZ) + sq(THIGH-X)) + M-THIGH*(THIGH.Z/2)*(THIGHZ/2); shinIcm = (1/12)*MSHIN*(sq(SHIN-Z) + sq(SHIN-X)) + M-SHIN*l*1; 60 // M(r X rdot): orbital term for shin and thigh s-mrxr-x = M.SHIN*(-PY[leg]*cos(theta)*(-dknee) + PY[leg]*l*sin(theta)*dtheta); s-mrxr-y = MSHIN*(PX[leg]*cos(theta)*(-dknee) - (sq(l) + PX[leg]*l*abs(sin(theta)))*dtheta); s.mrxr-z = M-SHIN*(-PY[leg]*sin(theta)*(-dknee) + PY[leg]*l*cos(theta)*dtheta); 160 tLmrxr-x = M-THIGH*(-PY[leg]*(THIGH-Z/2)*sin(theta))*dtheta; t-mrxr-y = MTHIGH*(sq(THIGH-Z/2) + PX[leg]*(THIGH-Z/2)*abs(sin(theta)))*dtheta; t-mrxr-z = MTHIGH*(PY[leg]*(THIGHZ/2)*cos(theta))*dtheta; } // angular momentum totals for the leg. *amx = s-mrxrx + t-mrxr_x; *amy = thighIcm*dtheta + shin-Icm*dtheta; *amz = s-mrxry + t-mrxr-y + thighIcm*dtheta + shin-Icm*dtheta; //*amz = s.mrxr-z + tLmrxrz; B.5 170 Miscellaneous Functions These utility functions are excerpted from unlisted source files. /* do-pd-ff-servo implements a propotional-dervative-feedforward * torque servo. It is never directly called by the control code * but instead is called every servo-dt, where it examines the * Is state variables q, qd, q-d... and modifies the value of * tau as appropriate. void do-pd-ffJservo(tau, q, qd, q-d, k, b, double *tau, q, qd, q-d; double k, b, ff; { *tau = -k*(q } ff) 10 - q-d) - b*qd + ff; /* nonlinear-spring-damper-groundhandles ground contacts. * A PD feedback loop, along with the gnd-contact stiffness * and damping values generates unidirectionalforces which * prevent slipping and pentration. void nonlinear-spring-damperground(gc, x, y, z, dx, dy, dz) basic.gcontact *gc; double x, y, z, dx, dy, dz; { 20 if (z > 0.0) gc->fs = 0.0; if (z < 0.0) if (gc->fs < 0.5) { gc->fs = gc->td-x gc->td-y gc->tdz if (gc->fs { 1.0; = x; = y; = z; /* Note that td-z isn't actually used, zero is */ 30 > 0.5) /* Foot switch is on, need to apply forces. */ /* x direction */ gc->f-x = (gc->td-x - x); if (x > gc->td-x) /* f.x is positive, the force should be negative */ gc->Lx = -(gc->k-x)*gc->fLx*gc->f-x - gc->b-x*dx; else 61 40 gc->Lx = (gc->kx)*gc->f-x*gc->f-x - gc->b-x*dx; /* y direction */ gc->f-y = (gc->td-y - y); if (y > gc->td-y) /* f-y is positive, the force should be negative */ gc->Ly = -(gc->k-y)*gc->fLy*gc->f-y - gc->b-y*dy; else gc->f-y = (gc->k-y)*gc->f-y*gc->fLy - gc->b-y*dy; z direction */ gc->Lz = (gc->td-z - z); /* You know z < gc->td-z or you wouldn't be in this part of the code */ gc->f.z = (gc->k-z)*gc->Lz*gc->f-z - gc->b-z*dz; /* Zero z direction if it would result in sticky ground. */ if (gc->fLz < 0.0) gc->f-z = 0.0; 50 /* 60 gc->t-th = 0.0; } else { gc->Lx = 0.0; gc->Ly = 0.0; gc->Lz = 0.0; gc->tth = 0.0; 70 } } /* pdf-taulimit-servo adds output saturation to * the standard proportional-derivative-feedforward * servo model void pd-ffAtaulimit-servo(tau, q, qd, q-d, k, b, ff, utau, double *tau, q, qd, q-d; double k, b, ff; double utau, Itau; { 80 ltau) *tau = -k*(q - q.d) - b*qd + ff; if(utau > 0.0 && *tau > utau) *tau = utau; ltau; if(ltau < 0.0 && *tau < ltau) *tau } 90 /* some math functions */ double sq(double a) { return a * a; } double dmin(double a, double b) if(a < b) return a; else return b; { 100 } double dmax(double a, double b) if(a >= b) return a; else return b; { } 62 Bibliography [1] Paul Alexandre and Andre Preumont. On the gait control of a six-legged walking machine. InternationalJournal of System Science, 27(8):713-721, 1996. [2] R. Altendorfer, N. Moore, H. Kumsuoglu, M. Buehler, H. B. Brown Jr., D. McMordie, U. Saranli, R. Full, and D. E. Koditschek. RHex: A biologically inspired hexapod runner. Autonomous Robots, 11:207-213, 2001. [3] R. D. Beer, H. J. Chiel, R. D. Quinn, K. Espenschied, and P.Larsson. A distributed neural net architecture for hexapod robot locomotion. In Neural Computation, volume 4, pages 356-365. M.I.T. Press, Cambridge, MA, 1992. [4] Robert Blickhan and Robert J. Full. Similarity in multilegged locomotion: Bouncing like a monopode. Journal of Comparative Physiology A, 173:509-517, 1993. [5] G.A. Cavagna, N. C. Heglund, and C. R. Taylor. Mechanical work in terrestrial locomotion: Two basic mechanisms for minimizing energy expenditure. American Journal of Physiology, 233:243-261, 1977. [6] J. G. Cham, S. A. Bailey, and M. R. Cutosky. Robust dynamic locomotion through feedforward-preflex interaction. In ASME IMECE Proceedings, Orlando, Florida, November 2000. [7] Jorge G. Cham, Jonathan Karpick, Jonathan E. Clark, and Mark R. Cutkosky. Stride period adaptation for a biomimetic running hexapod. In 10th Annual Symposium of Robotics Research, Lorne, Victoria, Australia, November 2001. [8] Jonathan E. Clark, Jorge G. Cham, Sean A. Bailey, Edward M. Froehlich, Pratik K. Nahata, Robert J. Full, and Mark R. Cutosky. Biomimetic design and fabrication of a hexapedal running robot. In IEEE InternationalConference on Robotics and Automation, 2001. [9] Parametric Technology Corporation. SD-Fast. Software. [10] Claire T. Farley, James Glasheen, and Thomas A. McMahon. Running springs: Speed and animal size. Journal of Experimental Biology, 185:71-86, 1993. [11] C. Ferrell. A comparison of three insect-inspired locomotion controllers. Robotics and Autonomous Systems, 16(2-4):135-159, 1995. 63 [12] Robert J. Full and Michael S. Tu. The mechanics of six-legged runners. Journal of Experimental Biology, 148:129-146, 1990. [13] Hugh M. Herr. personal communications. [14] Hugh M. Herr, Gregory T. Huang, and Thomas A. McMahon. A model of scale effects in mammalian quadrupedal running. Journal of Experimental Biology, 205:959 - 967, 2002. [15] Hugh M. Herr and Thomas A. McMahon. A trotting horse model. International Journal of Robotics Research, 19(6):566-581, June 2000. [16] Hugh M. Herr and Thomas A. McMahon. A galloping horse model. International Journal of Robotics Research, 20(1):26-37, January 2001. [17] G. M. Hughes. The co-ordination of insect movements. I. the walking movements of insects. Journal of Experimental Biology, 29:267-285, 1952. [18] Winfried Ilg and Karsten Burns. A learning architecture based on reinforcement learning for adaptive control of the walking machine Lauron. Robotics and Autonomous Systems, 15:321-334, 1995. [19] Frank Kirchner. personal communications. [20] Haldun Komsuoglu, Dave McMordie, Uluc Saranli, Ned Moore, Martin Buehler, and Daniel E. Koditschek. Proprioception based behavioral advances in a hexapod robot. In Proceedings of the 2001 IEEE InternationalConference on Robotics and Automation, Seoul, Korea, May 2001. IEEE. [21] MIT Leg Lab. Creature Library. Software. [22] M. Anothony Lewis, Andrew H. Fagg, and George A. Bekey. Genetic algorithms for gait synthesis in a hexapod robot. In Zheng, editor, Recent Trends in Mobile Robotics, pages 317-331. World Scientific, New Jersey, 1994. [23] R. B. McGhee and A. A. Frank. On the stability properties of quadruped creeping gaits. Mathematical Biosciences, 3:331-351, 1968. [24] Thomas A. McMahon. Muscles, Reflexes, and Locomotion. Princeton University Press, 1984. [25] Thomas A. McMahon and G.C. Cheng. The mechanics of running: How does stiffness couple with speed? Journal of Biomechanics, 23:65-78, 1990. [26] G. M. Nelson, R. D. Quinn, Bachmann, W. C. Flannigan, R. E. Ritzmann, and J. T. Watson. Design and simulation of a cockroach-like hexapod robot. In Proceedings of the 1997 IEEE InternationalConference on Robotics and Automation (ICRA '97), Alburquerque, New Mexico, April 1997. 64 [27] Gill A. Pratt, Daniel Paluska, Andreas Hofman, and Matt Malchano. Report on the UGCV. Presented to Omnitech Robotics LLC, Colorado, and DARPA, August 2001. [28] Jerry Pratt. Virtual model control of a biped walking robot. Master's thesis, Massachusetts Institute of Technology, 1995. [29] William H. Press, Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. Numerical Recipes in C : The Art of Scientific Computing. Cambridge University Press, 1993. [30] Roger D. Quinn, Gabriel M. Nelson, Richard J. Bachmann, Daniel A. Kingsley, John Offi, and Roy E. Ritzmann. Insect designs for improved robot mobility. In Berns and Dillmann, editors, Proc. 4th Int. Conference On Climbing and Walking Robots, pages 69-76, 2001. [31] Mark H. Raibert. Legged Robots That Balance. MIT Press, 1986. [32] Christian Ridderstrm. Legged locomotion control - a literature survey. Technical Report TRITA-MMK 1999:27, Dept. of Machine Design, Royal Institute of Technology, S-100 44 Stockholm, Sweden, November 1999. [33] Robert Ringrose. Self-Stabilized Running. PhD thesis, Massachusetts Institute of Technology, 1996. [34] Uluc Saranli, Martin Buehler, and Daniel E. Koditschek. RHex: A simple and highly mobile hexapod robot. InternationalJournal of Robotics Research, 20(7):616-631, July 2001. [35] A. Seyfarth, H. Geyer, R. Blickhan, and H. Herr. Leg retraction - a simple control strategy for stable running. (in preparation), 2002. [36] S. Talebi, I. Poulakais, E. Papadopoulos, and Martin Buehler. Experimental Robotics VII, chapter Quaruped Robot Running with a Bounding Gait, pages 281-289. Lecture Notes in Control and Information Sciences; 271. SpringerVerlag, 2001. [37] Ann L. Torres. Virtual model control of a hexapod walking robot. Technical Report AITR-1582, Massachusetts Institute of Technology AI Lab, 1996. [38] H. J. Weidemann, F. Pfeiffer, and J. Eltze. A design concept for legged robots derived from the walking stick insect. In Proceedings of the 1993 IEEE/RSJ International Conference on Intelligent Robots and Systems, Yokohama, Japan, July 1993. [39] David Wettergreen and Chuck Thorpe. Gait generation for legged robots. In IEEE International Conference on Intelligent Robots and Systems. IEEE, July 1992. 65 [40] David Wettergreen and Chuck Thorpe. Dante II: Technical description, results, and lessons learned. InternationalJournal of Robotics Research, 18(7):621-649, 1999. [41] Jung-Min Yang and Jong-Hwan Kim. Optimal fault tolerant gait sequence of the hexapod robot with overlapping reachable areas and crab walking. IEEE Transactions on Systems, Man, and Cybernetics A, 29(2):224-235, March 1999. 66