DeepGait: Planning and Control of Quadrupedal Gaits using Deep Reinforcement Learning
Abstract
This paper addresses the problem of legged locomotion in nonflat terrain. As legged robots such as quadrupeds are to be deployed in terrains with geometries which are difficult to model and predict, the need arises to equip them with the capability to generalize well to unforeseen situations. In this work, we propose a novel technique for training neuralnetwork policies for terrainaware locomotion, which combines stateoftheart methods for modelbased motion planning and reinforcement learning. Our approach is centered on formulating Markov decision processes using the evaluation of dynamic feasibility criteria in place of physical simulation. We thus employ policygradient methods to independently train policies which respectively plan and execute foothold and base motions in 3D environments using both proprioceptive and exteroceptive measurements. We apply our method within a challenging suite of simulated terrain scenarios which contain features such as narrow bridges, gaps and steppingstones, and train policies which succeed in locomoting effectively in all cases.
I Introduction
Legged locomotion in nonflat terrain, both structured and unstructured, poses a significant challenge in robotics. Operating autonomously in such environments requires addressing the problem of multicontact motion planning and control. If a legged robot such as ANYmal [hutter2016anymal] is to traverse complex environments autonomously, it must possess the capability to select footholds appropriate for the terrain, while also retaining balance at all times. This work deals specifically with the problem of planning and executing sequences of footholds for quadrupedal locomotion in rigid nonflat terrain using proprioceptive and exteroceptive sensing.
Dynamically walking on nonflat terrain necessitates the optimization of continuous stateinput trajectories such as the motion of the base, as well as discrete decision variables such as which surface, and when, to make contact with. This has been addressed predominantly using modelbased approaches, such as those employing deterministic optimization techniques [kuindersma2016optimization, winkler2018gait], in conjunction with other heuristics [fankhauser2018robust], to plan motions for both the base and feet. Although some of the aforementioned approaches are able to solve such problems compromising both continuous and discrete variables [kuindersma2016optimization, winkler2018gait], these remain too computationally intensive to be executed online. Thus, only kinostatic approaches [doi:10.1002/rob.21610, fankhauser2018robust] have managed to perform online foothold planning. Also, most methods typically employ some form of parameterization or qualification of the terrain [Kalakrishnan:2011:LPC:1936801.1936805, fankhauser2018robust, tonneau2018reachability] in order to simplify the search for viable footholds.
One of the primary challenges in multicontact planning for multilegged systems lies in dealing with the combinatorial problem due to the vast number of contact configurations admissible for the terrain. Typical solutions involve either assuming the gait pattern [doi:10.1002/rob.21610, fankhauser2018robust] or employing samplingbased search techniques [tonneau2018efficient, tonneau2018reachability]. There also exist works that have combined both optimization and samplingbased methods [Kalakrishnan:2011:LPC:1936801.1936805, doi:10.1002/rob.21610, griffin2019footstep]. However, these typically resort to decoupling the selection of footholds from the optimization of base motions and thus remain kinostatic as they tend to neglect the dynamics of the system.
Some works have also incorporated machinelearning techniques for facilitating terrain perception [Kalakrishnan:2011:LPC:1936801.1936805, magana2019fast, klamt2019towards]. Others, have employed Deep Reinforcement Learning (DRL) [heess2017emergence, Peng:2017:DDL:3072959.3073602] for realizing endtoend terrainaware locomotion. The use of the latter, however, still poses several challenges, namely: (1) how to eliminate undesirable yet retain beneficial emergent behavior, and (2) reduce overall sample complexity and train policies efficiently.
We propose a new method that combines stateoftheart modelbased and modelfree methods to enable quadrupedal systems to traverse complex nonflat terrain. Our formulation consists of: (1) a terrainaware planner that generates sequences of footholds and base motions that direct the robot towards a target heading, and (2) a foothold and base motion controller which executes the aforementioned sequence while maintaining balance and dealing with disturbances. Both planner and controller are realized as stochastic policies parameterized using NeuralNetwork (NN) function approximation, which are optimized using stateoftheart Deep Reinforcement Learning (DRL) algorithms.
Our contributions with this work are: (1) A novel method for training kinodynamic motion planners, which employs a Trajectory Optimization (TO) technique for determining socalled transition feasibility between discrete support phases using a coarse model of the robot. This removes the need for a planner to interact with both physics and a controller during training, allows the two policies to be trained independently, and leads to a significant reduction in overall sample complexity. (2) A simple formulation for realizing dynamic walking controllers that use target footholds as references and rely solely on proprioceptive sensing. This allows us to train controllers that can fully exploit the kinematics and dynamics of the robot in order to track arbitrary target footholds, irrespective of the planner used to generate them.
We evaluate the performance of our method across a set of challenging locomotion scenarios using a physics simulator and present results thereof. Our experiments demonstrate that the planner can generalize well across terrain types, and the controller succeeds in tracking reference footholds while always balancing the robot. Moreover, we illustrate the advantages of our method by comparing it with a stateoftheart modelbased approach [fankhauser2018robust].
Ii Preliminaries
Iia Reinforcement Learning
We consider the problem of sequential decision making in which an agent interacts with an environment with the objective of maximizing cumulative reward. We model this problem as a discretetime infinite Markov Decision Processes (MDP) with a discounted expected return objective. Such an MDP consists of set of states , a set of actions , a transition dynamics distribution, an initial state distribution, a scalar reward function , and a scalar discount factor . The agent selects actions according to a policy with the objective of maximizing the expected return , where is the scalar reward resulting from the state transition at timestep . As we consider infinite MDPs in which and are infinite sets, we use parameterized stochastic policies , which are distributions over actions conditioned on observations given parameter vectors .
IiB Model of the System
The robot comprises an unactuated floating base and four articulated legs with actuated rotational joints. The state of the robot is specified as: the absolute
(1) 
where is a vector indicating for each of the feet a closed, , or open, , contact w.r.t the terrain, are the stacked absolute positions of the feet, and are the phase timing variables. For every phase , defines the time at which the switch to the current contact configuration occurred, while the switch to next. Fig. 2 (b) illustrates the aforementioned quantities.
Iii Methodology
We propose a twolevel hierarchy comprising a highlevel Gait Planner (GP) and a lowlevel Gait Controller (GC) operating at different timescales, inspired by [Peng:2017:DDL:3072959.3073602]. The GP, evaluated at roughly 2Hz, serves as a local terrainaware planner, and uses both exteroceptive and proprioceptive measurements to generate a finite sequence of support phases, i.e. a phase plan. The GC, evaluated at 100Hz, serves as a hybrid motion planner and controller, and uses only proprioceptive sensing in combination with the aforementioned phase plan to output joint position references. Finally, a jointspace PD controller (with zero target joint velocity) uses these joint position references to compute joint torques at 400Hz. The highestlevel command to the system is provided as the desired walking direction in the form of the deviation of base attitude w.r.t the goal. Fig. 2(a) provides an overview of the system.
Iiia Gait Planning
The GP operates by sequentially querying the planning policy to generate the aforementioned phase plan. We thus formulate an MDP in order to train using DRL, and our objective is to ensure that the resulting policy learns to respect the kinodynamic properties and limits of the robot, as well as contact constraints, when proposing phase transitions. Moreover, we aim to avoid direct interaction with the physics of the system, and instead craft the transition dynamics of the MDP by employing a transition feasibility criterion realized as a Linear Program (LP) using the framework defined in [fernbach2019ccroc]. Lastly, we avoid explicitly modeling or qualifying the terrain, as done in [fankhauser2018robust, tonneau2018efficient], and instead directly use measurements of local terrain elevation. The resulting MDP, allows us to train to infer a distribution over phase transitions, which are not only feasible but also maximize locomotion performance (refer to the discussion in Sec. V).
Support Phase Transition Feasibility
Transition feasibility amounts to evaluating if a feasible motion exists between a pair of support phases , where the former is assumed while the latter is a candidate successor. As previously mentioned, we employ the general framework defined in [fernbach2019ccroc] to design a convex LP using the Convex Resolution Of Centroidal dynamics trajectories (CROC) formulation. We use CROC to derive a set of linear equality and inequality constraints, forming a convex polytope, using the following terms:

A Centroidal Dynamics model of the system.

The contact force unilateral and friction constraints.

Assume angular momentum rate of zero.

Parameterization of CoM motion as a Bezier curve.

Restrict motion of the feet w.r.t. the base.

Restrict contact forces in magnitude and direction.
The specific variant of CROC we employ uses a trivial cost, a timediscretization of the CoM trajectory, and incorporates the parameterization of the contact forces into the decision variables of the optimization. We defer the reader to [fernbach2019ccroc] for further details regarding CROC. The resulting formulation allows us to realize the transition feasibility mapping . Therefore, we evaluate the LP for pairs of phases , to determine if the corresponding phase transition is feasible, 1, or not, 0.
MDP Specification
Modeling locomotion as discrete sequences of support phases , as defined in Sec. IIB, allows us to formulate phase transitions that exhibit the Markov property [Sutton:2018], and thus lends itself to modeling the overall problem of gait planning as an MDP. Specifically, we define the state of the MDP as the tuple , where is the current absolute position of the goal in the world, while observations and actions are defined as the tuples and , respectively. Observations, consist of terms pertaining to the current state of the robot and the coincident terrain in the form of: the attitude w.r.t the goal , the CoM velocity , the feet positions , the feet contact states and the local heightmap . Conversely, actions, contain terms pertaining to changes to the current phase , in the form of the CoM rotation , CoM translation , CoM velocity , feet positions , feet contact states and the phase timings . All action terms are scaled, offset and clipped to lie in . The exact definitions for actions and observations are provided in Tab. I.
GP Observation  GP Action  



Transition Dynamics
We define state transition dynamics for this MDP employing a formalism defining socalled termination condition functions , which determine if an episode terminates. By formulating an episode termination as a transition into an absorbing terminal state, we can say that, an episode under this MDP, terminates whenever . In this MDP, in particular, we employ the following termination conditions:

: Checks for obstacles or gaps within the vicinity of each foothold using an fixed eightpoint grid surrounding each foot.

: Checks for collisions between base and terrain.

: Evaluates .
Thus, each step of this MDP proceeds as follows: (1) Given a state , the MDP computes the corresponding observation , which is constructed according to the transformations in Tab. I, and is passed to the agent to select an appropriate action according to . (2) The selected action , is used to compute the candidate phase , again using the set of transformations defined in Tab. I. (3) The aforementioned terminations conditions are used to assert if the phase transition is feasible. This formulation therefore allows the agent to propose the phase transition directly, while the MDP only checks if it is feasible and otherwise terminate the episode.
In addition, we outline certain considerations regarding the computation of . First, if a foot would be in contact for both phases and , the new foothold is reset to that of since stance feet cannot change positions. Second, the zcoordinates of the feet and CoM positions are adjusted according to the height of the terrain at their respective locations, and for the CoM in particular, the height is set to a constant above the lowest foothold. Lastly, to evaluate the kinematic constraints of CROC, we need to infer the intermediate orientations. To this end, we use a firstorder approximation of the angular velocity of the base by linearly interpolating between the starting and next base attitudes of each transition. Doing so also renders zero angular momentum between consecutive support phases, which is inline with assumptions made by CROC. One can thus envision an extension to CROC that includes angular momentum, which we intend to explore in future work.
Reward Function
We design a reward function which drives the agent to learn behaviors for reaching the goal position, facing the goal as much as possible, minimizing kinematic effort during phase transitions and inhibiting long stance phases. The final reward function is specified as the combination of multiplicative and additive terms
(2) 
where rewards the agent for bringing the average foothold position closer towards the goal and penalizes moving it away, penalizes the robot for not facing the goal, penalizes for moving the feet away from the nominal footholds located beneath the shoulders and penalizes for not lifting a foot over multiple steps, therefore promoting exploration and prevents the policy from getting stuck in the local optimum of remaining in a constant stance.
Furthermore, we would like to emphasize certain features of the multiplicative term in the above reward function. Specifically, this term results in a penalty that is small when is small, i.e., beginning of training, and large when is large, i.e., towards the end of training, thus resulting in a form of automatic scaling of the overall multiplicative term. We found that using these multiplicative rewards results in beneficial gradients throughout all iterations of training, as their values are ensured never to be too large as to hinder exploration, and never too small as to have negligible effect. Furthermore, as is computed using the average position of footholds and not of the base, the agent is required to walk in order to maximize reward, as opposed to just merely leaning. The latter aspect is important, since leaning forward also inhibits the motion of the front legs, therefore making it much harder to walk. Tab. II details the aforementioned reward terms.
Policy Definition
We parameterize the GP’s policy as a Gaussian distribution with a diagonal covariance matrix . The mean is output by a NN which inputs both exteroceptive and proprioceptive measurements into a series of NN layers, similar to those proposed in [Peng:2017:DDL:3072959.3073602]. First, is input into three CNN layers, the output of which is subsequently input into one more fullyconnected layer. The resulting latent output from the heightmap is concatenated with the raw proprioceptive measurements, then fed into two more fullyconnected layers with ReLU and tanh nonlinearities, and finally passed through a linear output layer. The standarddeviation parameters are realized by an additional layer that is independent of the observations and is used to drive exploration during training. Fig. 3(a) provides a graphical depiction of the NN model. Due to the inclusion of highdimensional heightmap data in the observations as well as the relatively large dimensionality of the actions , we trained with a variant of Proximal Policy Optimization (PPO) using clipped loss and a Generalized Advantage Estimation (GAE) critic [schulman2017proximal].
IiiB Gait Control
The GC is responsible for executing the support phase sequence provided by the GP while maintaining balance at all times. It operates by tracking a series of footholds and base positions extracted from the support phase sequence generated by the GP. In order to learn this behavior, we define an MDP with transition dynamics which incorporates the physics of the system and specify an appropriate parameterization for . Training a GC agent in such an MDP requires only that a target phase sequence be provided, and does not assume that a GP is available a priori. In fact, the target phase sequence can be provided arbitrarily as long as the target footholds are feasible. However, in this work, we elected to utilize a GP for this purpose solely as a matter of convenience so to avoid the use of additional elements.
Target Foothold Extraction
Assuming the GP is queried at some time , we denote the resulting phase sequence as , where is the initial phase as measured by the GP before generating the sequence of length . This amounts to rollingout
MDP Definition
Given a phase sequence , the GC proceeds to extract the following target quantities: (a) target position for the base , (b) target feet contact states , and (c) target foothold positions for all legs. In the case of , targets are set by looking ahead into the phase plan so to ensure that both swing and stance legs have valid references at all times. Thus, the GC computes the foothold tracking errors , at 100Hz, while the target footholds are updated at approximately 2Hz. We specify MDP states , observations and actions defined as
(3) 
where is the gravityaligned zaxis of frame expressed in coordinates of frame , is the distance between the lowest stance foot and the base along the zaxis of , is the vector of previous target joint positions, and is a phase variable indicating the normalized time within a support phase. The transition dynamics of this MDP includes the generation of the phase plan using the GP, the physics of the system and the jointspace PD controller. As the PD controller is evaluated at 400Hz and the GC at 100Hz, we apply a zeroorder hold of the joint positions output by the policy when computing joint torques commands. For this MDP, we also define the following termination conditions:

: Angle between and exceeds .

: Base collides with the terrain.
We have found that these two simple, yet effective, termination conditions are those principally responsible for the balancing and recovery behaviors learned during training, and thus their importance must not be understated. Moreover, we designed a reward function that emphasizes tracking of target foothold positions and contact states, but also contains terms that inhibit extraneous and aggressive motions during locomotion. The resulting reward function is defined as
(4) 
where and are the taskspecific rewards penalizing deviations from the target foothold positions and contact states, penalizes footslip for grounded feet, penalizes large velocities for swing legs, penalizes joint torques, penalizes vertical linear and rollpitch angular velocities of the base and penalizes large angles between the unit vectors and of the base and world frame respectively.
Policy Definition
The GC’s policy, like that of the GP, is also parameterized as a Gaussian distribution with diagonal covariance matrix . While the mean is output by a simple NN with two fullyconnected layers using nonlinearities, shown in Fig. 3 (b), the standard deviation coefficients are, just as in the case of the GP, output by an additional layer of parameters which is independent of . Due to the relatively small dimensionality of the MDP and , we train the latter using TrustRegion Policy Optimization (TRPO) also employing a GAE critic [schulman2015high].
Gait Planner Rewards  Gait Controller Rewards  



Iv Results
Iva Experimental Setup
In order to evaluate our approach, we crafted a suit of terrain scenarios for training and testing the GC and GP agents, as depicted in Fig. 1. The first and most basic scenario consists of an infinite flat plane we refer to as FlatWorld, which we use to establish a baseline for performance and behavior. Secondly, the RandomStairs terrain presents a square area consisting of flat regions of randomly selected elevation. The elevation changes were generated in a way that results in an effective inclination diagonally across the map. The third terrain scenario is that which we call TempleAscent, and is a composite terrain consisting of gaps, stepping stones, stairs as well as flat regions. We realized the MDP environment for the GP using an own implementation of CROC in C++, while for the MDP environment of the GC we used the RaiSim [raisim] multibody physics engine. All DRL algorithms were implemented using the TensorFlow
IvB Gait Planner
Training Setup
Training of GP policies in the terrain suite consists of a set of episodes where the robot’s objective is to reach a a goal position from a sufficiently distant starting location. Both starting and goal positions are selected randomly at the start of each episode. However, this procedure differs depending on the features of the terrain, as we must avoid invalid starting positions and unreachable goal positions, which, would negatively impact the resulting policies during training. Once valid starting and goal positions have been sampled, the robot’s initial attitude and footholds are also sampled uniformly from within respective bounds.
We thus trained two separate GP policies for RandomStairs and TempleAscent respectively, using PPO with only parallel workers running on the respective desktop computer over iterations, which amounts to a total of two billion samples per run. Hyperparameter values are listed in Tab. IV. We did not need to train a separate GP in FlatWorld, and instead used that trained in TempleAscent for the respective performance evaluations.
Performance Metrics
In order to assess the performance of GP policies, we define the Episodic Success Rate (ESR), which measures the number of successfully reached goal positions over a finite number of episodes. Essentially, we execute a sufficiently large number of episodes where the robot tracks a reference goal position in the world and assert if the robot has reached within a vicinity of the goal and within a maximum permissible episode duration.
Training Results
GP training required approximately hours in each terrain scenario. Throughout our experiments we found that the randomization scheme mentioned above and used for realizing the initial state distribution of the MDP was crucial for successfully learning to traverse all parts of the terrains. This demonstrates that if the agent does not observe all aspects of the terrain from the very beginning of training, it is often unable to generalize to unseen cases at test time.
Furthermore, we observed that, as the centroidal dynamics model employed by CROC is relatively conservative, it tends to limit the set of transitions that the policy can generate. This conservativeness is furthered by the fact that in this work, we limit the possible contact states that the GP’s policy can output to only those with three and four active contacts. Such a restriction was helpful for reducing the complexity of the problem, and we intend to extend to the general case of two and single contact configurations in future work.
We tested the GP policies in their respective terrain scenarios and evaluated their performance using the ESR metric. In all cases, we have observed that fully trained policies can generate valid support phase sequences which lead the robot to the goal with at an average ESR nearing . The performance of GP policies trained and tested in the terrain suite are presented in Tab. IV, where they have been deployed together with respective GC policies.
Another important observation regarding the output of the GP has to do with the types of gaits it manifests. In the case of FlatWorld as well as in the flat regions of TempleAscent, we observe that the GP tends to output mostly cyclic support phases. This indicates that the agent learns to generate cyclic gaits even though no aspect of the MDP ever directed it to do so. In certain cases, however, such as the SteppingStones and Gaps bridges as well as when performing sharp pointturns, the GP outputs acyclic support phases.
Sample Complexity
One key contribution of this work is the significant reduction in sample complexity afforded by the use of transition feasibility instead of physical simulation to formulate the GP’s MDP. Using the transition feasibility check, we can evaluate the MDP’s transition dynamics at several thousands of stepspersecond, where each step corresponds to potentially several seconds of simulation time. Conversely, using a physics simulator typically requires several hundred or even thousands of steps to evaluate just one second of simulation time. Specifically, during training, we executed episodes with a maximum length of steps with each corresponding to an average duration of approximately , which amounts to of simulation time. However, the physics simulator using a timestep of would require steps to simulate the duration above. As the throughput of the transition feasibility LP and the physics simulator, for our formulation, is and respectively, we can estimate an fold effective reduction in samplecomplexity.
IvC Gait Controller
System  Metric  Flat  Gaps  SteppingStones  Stairs 

Nominal  ESR  
FTS  
FTER  
ESR  
FTS  
FTER  
ESR  
FTS  
FTER  
ESR  
FTS  
FTER 
Parameter  Symbol  TRPO  PPO 

Batch Size  24k  200k  
MiniBatches    5  
Max. Episode Length  
Discount Factor  0.995  0.99  
Trace Decay  0.99  0.97  
Terminal Reward  
KL Constraint  0.01    
Clip    0.2  
Entropy Weight  
Initial Variance  
Adam Epochs    
Adam LearningRate    
Gradient Clipping    
CG Damping  0.1    
CG Steps  40   
Training Setup
Training a GC agent involves collecting MDP transitions over a rich set of target footholds. In order to achieve such a distribution of training samples, we ensure that both the initial state distribution of the MDP as well as the target footholds generated by the GP are appropriately and sufficiently randomized. Initial states are generated by first uniformly sampling initial and goal positions of the base from within the bounds of the world. We then orientate the base by sampling uniformly from attitudes centered on the current orientation facing the goal, and bounded by the vector of Euler angles . Moreover, we randomize the initial feet positions by uniformly sampling coordinates from a box defined in the base frame and centered around nominal values that would place the feet below the shoulders. Furthermore, to randomize the target footholds, we perform a randomized fixed rollout of the GP up to the maximum permissible length of an episode. Essentially, we rollout the GP however many times necessary such that the resulting phase sequence meets or exceeds the duration time of an episode, and randomize the target footholds at each step by adding a bias uniformly sampled from in the plane while ensuring that the coordinates are fixed to the terrain.
With the aforementioned sampling scheme, we trained a GC agent using TRPO in FlatWorld using only parallel workers for total of iterations. Moreover, as part of ongoing work to extend our method to full 3D foothold tracking, we present preliminary results for GC policies for stairclimbing by first pretraining in RandomStairs then also on the stairs section of TempleAscent. Tab. IV presents the hyperparameters most pertinent to the training of GC, for all of the cases mentioned above. We want to emphasize that in all cases, the same hyperparameters were used, as we only adapted the initial state distribution accordingly for each terrain. TRPO was employed using mostly the default hyperparameters specified in [schulman2015high, schulman2015trust].
Performance Metrics
We define two metrics for quantifying the performance of GC policies at testtime. First we define the Foothold Tracking Error Rate (FTER)
(5) 
that measures the mean foothold tracking error throughout an individual episode of length , and is computed as a function of the desired contact states , the desired foothold positions and the measured feet positions while in contact with the terrain for each foot and at every timestep. Secondly, we define the Foothold Tracking Score (FTS) as the ratio of successfully tracked footholds over the total generated by the GP within an episode. At the end of each support phase, we check if feet which were previously in swing phase have contacted the ground within of the target foothold in the plane, and increment the FTS by one for each foot with a successful touchdown in the aforementioned region. These metrics are important with regard to the combined use of the GP and GC as they quantify how reliably a GC can execute the footholds generated by the GP. The planner has been trained to select footholds within a minimum distance of from any changes in elevation exceeding . As long as the controller can maintain foothold tracking within this region, then the combined system is ensured to operate safely.
Training Results
GC training endured for approximately 58 hours for FlatWorld and approximately 116 hours for RandomStairs and TempleAscent. The discrepancy in durations is due to the increased computational cost incurred in the physics engine when evaluating contacts between the terrain mesh and the multibody system. Training in FlatWorld results in a policy that succeeds in generalizing well to planar foothold tracking, while training in RandomStairs and TempleAscent extends these capabilities to 3D. However, the stairclimbing agent trained in the latter case exhibits worse MER and FTS than those trained in the former. This difference is due to the difficulties in designing sampling schemes that always initialize the robot in valid initial states, but also to the similarity of the foothold targets generated by the GP as a result of the repetitive terrain features in the suite.
We evaluated the performance of the GC policies within TempleAscent across five runs, each consisting of episodes with a maximum length of . We also perturb the model of the robot (i.e., with which the GC was trained) to assess the robustness of the policies. Specifically, we increased the mass of the base by and varied the lengths of the shank links by . In each case, ESR, FTS, and FTER values were recorded in order to compute empirical means and standard deviations. The resulting performance measurements are presented in Tab. IV
IvD Comparison to Existing Approaches
As mentioned in Sec. I, most methods addressing planning and control of multicontact motions employ optimization, samplingbased search, or a combination thereof. Although those relying solely on optimization [kuindersma2016optimization, winkler2018gait, fankhauser2018robust] can be kinodynamic, they are not feasible online, yet those that employ samplingbased search [tonneau2018efficient, tonneau2018reachability], or both [Kalakrishnan:2011:LPC:1936801.1936805, doi:10.1002/rob.21610, griffin2019footstep] can be used online but remain kinostatic. The issue is that kinostatic methods are unable to fully exploit the dynamics of the system, and typically decouple foothold selection from the optimization of the base and feet motions, limiting their possible set of solutions. In addition, nearly all of the aforementioned approaches use some form of modelling [kuindersma2016optimization, Kalakrishnan:2011:LPC:1936801.1936805] or qualification [doi:10.1002/rob.21610, tonneau2018reachability, fankhauser2018robust] of the terrain. On the contrary, our approach relies on a minimal geometric representation of the terrain in the form of a heightmap, performs gaitfree kinodynamic planning by jointly optimizing base and swing feet motions together with the selection of footholds and is executable online.
Lastly, to illustrate how our method performs compared to others, we present an experiment in which the robot is to walk over a set of large gaps with different sizes. Specifically, we compare with FreeGait, a stateoftheart modelbased framework for perceptive locomotion [fankhauser2018robust] which jointly optimizes body poses and footholds using an Sequential Quadratic Programming solver. The experiment consists of two trials, corresponding to gaps of different sizes: . Fig. 5 provides snapshots of the respective trials. Only our policies were able to traverse the gap. FreeGait relies on a heuristic scoring of the surrounding terrain and selects footholds using a deterministic greedy search within the vicinity of a nominal foothold. As it ensures that the CoM remains within some margin of the support polygon, it does not sacrifice static stability, even momentarily, to extend the reach of the front legs. Conversely, our planner can identify valid footholds across the gap in a single shot, and our controller then orientates the base to extend leg reach while retaining balance at all times.
V Conclusion & Discussion
This work proposes a new approach for training a twolayer hierarchy of NN policies which realizes terrainaware locomotion for quadruped robots. We decompose locomotion into two parts trained independently using modelfree DRL, and which interface via a carefully designed parameterization of quadrupedal gaits. As physical simulation incurs a high computational cost for use with DRL, our method reduces samplecomplexity for training the gait planner by using a transition feasibility criteria realized as convex LP to formulate the transition dynamics of an MDP. Within a certain context, our formulation can resemble bilevel optimization schemes used in nonlinear programming. The upperlevel optimization performed by modelfree DRL optimizes the selection of footholds and instantaneous CoM motion for the coincident terrain. The lowerlevel optimization performed by the modelbased LP optimizes phase transitions, thus resulting in optimal CoM trajectories between the support phases proposed by the higherlevel. Although in this work we only used a trivial cost for the LP, we could instead formulate a cost that penalizes contact forces and CoM accelerations, and include it as an additional reward term in the MDP. Such a coupling of the LP and MDP optimization objectives would allow us to reason about both feasibility and optimality of the resulting gait plan. Furthermore, as the planner learns to generate relatively conservative foothold sequences due to the restrained centroidal dynamics model, the burden of realizing fully dynamic and optimal motions for the base and swingfeet is placed on the gait controller. Lastly, we have demonstrated the efficacy of this approach by successfully training and testing in a suite of challenging terrain scenarios. The resulting policies not only prove to be effective in the suite of rigid nonflat terrains but also manage to generalize well to previously unseen cases.
References
Footnotes
 We define a global inertial frame for the world, and local bodyfixed frames for the base and for the feet. Left subscripts denote the frame in which the vector is expressed, but omit it for absolute quantities.
 The small range and dimensions selected for the elevation map, in conjunction with the limitation on maximum step length assumed by the planner, allows us to extract multiple successive samples of from within the effective fieldofview afforded by exteroceptive sensing.
 https://github.com/leggedrobotics/tensorflowcpp
 For the GP, we used a PC with 2x Intel Xeon E52680v4 (@2.4GHz) CPUs, 128GB of RAM, and an Nvidia GTX Titan (Pascal), and for the GC a PC with a single Intel Core i78700K (@3.7GHz) CPU, 64GB of RAM and an Nvidia GTX 2080 Ti GPU
 Although mean performance for stairs is in the nominal case, the variance is noticeably higher for the perturbed models, indicating that the policy is more sensitive w.r.t model variations than that for other terrains.
 https://youtu.be/s1rrM1oczI4