Introduction

When human infants learn to walk, they essentially learn, albeit after extensive practice, to be “viable,” i.e., to take steps without falling1. Older adults frequently fall while walking, and the related injuries are a serious public health issue2,3. Thus, quantifying individuals’ fall risk is critical to minimizing fall incidence. However, the risk of a fall in humans likely depends on multiple biomechanical, neurological, cognitive, and environmental factors4. Taking one walking step after another while remaining upright is not entirely automatic, as even healthy humans need to actively cope with physiological motor noise and environmental disturbances. Here, we focus on the walker’s ability to reject large external disturbances (as might occur, e.g., while avoiding an unanticipated obstacle or from a “shove”), which is central to avoiding falls.

When walking is viewed as a behavior of a dynamical system, falling is a loss of stability. For a nominal motion of a dynamical system to be stable, disturbances to it cannot grow over time: while local stability precludes the growth of small disturbances, global stability characterizes the decay of large disturbances so that, in both cases, perturbed trajectories either remain near or approach a nominal motion of the system under its dynamics. Typically, disturbance-free, nominally periodic walking motions are modeled as limit cycles, thus facilitating their stability analyses. However, the ability to avoid falls per se does not require a walker to be constrained to pre-determined nominal motions, let alone a limit cycle. Indeed, a walker can, at least in principle, remain viable by staying upright and taking an arbitrary sequence of steps, without closely tracking or approaching any given limit cycle. Consequently, the aforementioned stability analyses, when applied to walking, can not fully capture the walker’s ability to avoid falls.

Viability of an actuated dynamical system (e.g., a walker with actuation) characterizes the system’s ability to avoid failure (e.g., falls during walking) forever by choosing appropriate sequence(s) of inputs within its actuator limits5. The set of all viable states in the system’s state space—the viable region—in which its viability is guaranteed, provides a measure of the system’s maximum possible ability to avoid failure. This is because for every state in the viable region, there exists at least one input that can keep the next system state in the viable region, too. Indeed, the walker can keep taking steps one by one without falling, provided no external disturbance pushes the walker’s state outside the viable region before actuation kicks in. Therefore, the bigger the viable region in a walker’s state space, the better is the walker’s ability to avoid falls, as it can reject a larger range of external disturbances6,7,8. Thus, viability generalizes stability by dispensing with the requirement of remaining near or approaching a specific nominal motion. When employing a specific control strategy, i.e., a specific function of state feedback, global stability does characterize the walker’s ability to avoid falls. However, viability, being agnostic to any specific controller, permits arbitrary sequences of inputs that avoid falls, including those constructed by switching between distinct control strategies. Evidently, the walker’s ability to avoid falls, after an unexpected external disturbance, using any given strategy is, in general, inferior compared to when it is allowed to employ combinations of multiple such strategies. Thus, viability characterizes the walker’s ability to avoid falls better than global stability does. Furthermore, the absolute performance of different specific control strategies in avoiding falls (i.e., their global stability) is upper bounded by, and can only be meaningfully assessed with respect to, the walker’s viability.

Typically, humans walk not just to stay upright and move forward, but also to perform one or more goal-directed tasks, i.e., to achieve task goals, like walking around an obstacle in their path or walking next to another person. Often, such task goals amount to achieving target values of one or more gait observables (i.e., empirically measurable variables), like speed or direction. Moreover, humans, in general, can perform any given walking task via multiple gait patterns, each specified by a set of gait parameters9,10. Such task-level redundancies also interact with biomechanical redundancies at the level of muscles and joints11. This non-uniqueness of solutions to a given motor task makes the problem of biological movement control mathematically ill-posed. The notion of viability5 is well-suited to handle the non-uniqueness of solutions to a given walking task as it does not target a specific gait pattern (like that of a limit cycle), but only to avoid falls. However, by itself, viability does not take into account goal-directedness in walking. Indeed, the walker could, at least in principle, step randomly (i.e., with no “intent”) forever within the viable region.

Task-level motor regulation allows the walker to achieve specific task goals by targeting relevant task-level observables from each walking step to the next. In many cases, a task goal can a priori be represented as a goal equivalent manifold (GEM)—a surface in the suitable space of task-level observables such that each of its points correspond to zero task-level error12. The GEM framework belongs to a class of “task manifold” approaches, including those that are primarily data-driven, to analyze movement variability13. Task-level regulation rapidly corrects deviations in stepping observables that interfere with achieving a specific goal (i.e., those perpendicular to the GEM), while allowing task-irrelevant deviations (i.e., those tangent to the GEM) to persist9,14. Thus, regulation, too, can permit walking at several limit cycles, as long as they do not violate the specific task requirements, especially while viability concerns are not paramount. However, by itself, task-level regulation does not aim to guarantee stability of the walker’s limit cycle, let alone maximize its global stability.

The paradigm of “limit cycle walking”15,16 has shown that continuous-time active control of walking trajectories between step transitions is not required to achieve stable limit cycles. Similar nominal limb trajectories, across a variety of human movements, have also been predicted within the optimal control framework consistent with the “minimum intervention principle”17. Many optimality-based approaches, like trajectory optimization, naturally seek walking solutions in the form of a single limit cycle having a specific set of gait parameters such as step length and step time, often known a priori. However, such solutions are excessively restrictive as they constrain walking motion around a single trajectory. In contrast, humans have necessarily learned to walk at many such limit cycles, both stably and efficiently, to remain versatile. Moreover, at least in principle, humans could remain viable using control strategies that quickly switch between multiple limit cycles. For tasks that have multiple uncertain goals with similar costs, humans deliberately select intermediate movements to maximize task success18. In walking, however, fall avoidance decidedly supersedes achieving other task goals, which themselves often have different priorities10. This makes the choice of an optimal strategy far less obvious.

In this vein, our work is motivated by the following fundamental questions: How does the nervous system manage redundancies while achieving task goals in a given walking context? Furthermore, how might this functional organization help minimize fall incidence? In response, we posit that humans achieve stable and efficient walking gaits via a hierarchical schema, consisting of what we will here distinguish as control versus regulation of movement. Specifically, we use “control” to refer to the processes required for a walker to remain viable while taking individual steps. Conversely, we use “regulation” to refer to the step-to-step processes needed to carry out specific goal-directed tasks. Evidently, the walker must remain viable at all times, including while carrying out specific walking tasks. Thus, control and regulation, while functionally distinct, are hierarchical by design.

Our recent work19 highlights a possible answer as to why humans might prefer one equally workable task-level regulation strategy over another from the perspective of fall avoidance. We studied this question by integrating the simplest mechanical template20 of walking on level ground with motor regulation templates, i.e., empirically motivated models of how humans manipulate task-level observables on a step-to-step basis10,14. In experiments, humans walking on a treadmill tightly regulate speed at successive strides, while allowing absolute position to drift for many strides9,14. We thus simulated a push-off powered compass walker21 that additionally regulated step-to-step speed or absolute position on a treadmill. We characterized global stability of the walker’s limit cycles (i.e., steady-state periodic gaits) by the size and shape of their basins of attraction in the state space, and found that task-level regulation, despite not being designed to do so, makes walking more robust to external disturbances: it yields superior local disturbance rejection and improved global stability, both by increasing the size of basins of attraction and by regularizing their geometric structure19. Furthermore, while both step-to-step speed and position regulation provide workable strategies for treadmill walking, we found that speed regulation enlarges and regularizes the unregulated walker’s basin much more than position regulation. These simulation results are consistent with experiments9,14 and thus demonstrate a functional connection between task-level motor regulation and global stability. However, that prior work did not assess motor regulation strategies within the context of viability.

Figure 1
figure 1

Three snapshots of a 2D powered compass walker21 walking on a level ground (step speed, \(V_k\)): (a) just after \(k^{\text {th}}\), (b) just before \((k+1)^{\text {st}}\) and (c) just after \((k+1)^{\text {st}}\) heel strike. The walker has straight, massless, stance (red) and swing (blue) legs, and a mass at the hip (circle). The masses at the feet (not shown) are infinitesimally small compared to the hip mass. The push-off impulse, P, is applied instantaneously just before heel strike. At the beginning of the \(k^{\text {th}}\) step, the walker’s state in the inertial frame is \([\theta _{k}^{+},\dot{\theta }_{k}^{+}]^\top\).

Here, we extend this recent work and study the same powered walker (Fig. 1) to identify the viable region in its state space5, i.e., the set of all states beginning in which the walker can step forever by applying at least one sequence of its push-off inputs for every starting state. The viable regions of walking models with definite swing leg dynamics, including the compass walker studied here, have not yet been explicitly estimated. Conversely, in the nonviable set of states, the walker cannot avoid falls, let alone regulate to achieve task goals, with any possible active push-off control. Therefore, the viable region is also the set within which different motor regulation strategies can be meaningfully compared for their effect on the walker’s ability to avoid falls, i.e., their global stability. Taking step-to-step speed regulation as a model task-level motor regulation strategy9,14,19, we estimate the speed-regulated walker’s basins for several target speeds vis-à-vis the viable region. Not only do the speed-regulated walker’s basins occupy large regular regions, but we find that only a small collection of these basins covers nearly the entire viable region itself. Motivated by these results, we propose a hierarchical task switching controller that, at least in principle, allows the walker to avoid falls by appropriately switching between different task-level regulators at each walking step. Our work suggests a possible mechanism by which humans could avoid falls, by exploiting redundancy in previously learned regulation strategies to achieve task goals in a variety of walking contexts, including that of responding to a large, unexpected disturbance.

Results

We employ the simplest dynamic walker that walks on a level surface by means of impulsive push-off actuation, modeling ankle plantar flexion during toe-off in humans21 (see “Methods”). The walker’s state, just after heel strike, is fully described by the stance leg angle \(\theta ^+\) and its angular rate \(\dot{\theta }^+\), in the inertial frame attached to the stance foot (Fig. 1). We study the walker’s step-to-step dynamics as a hybrid Poincaré map, \({\varvec{F}}\), over the two-dimensional state space \((\theta ^+, {\dot{\theta }}^+)\) with push-off input P (Eq. 2).

We further impose viability constraints on the walker that yield restrictions on its states and inputs (see “Methods”): specifically, the stance foot must remain on the ground throughout the stance phase; the impulsive actuation must be small enough to not lift the walker off the ground when the swing foot’s heel strike is impending, and must be large enough to lift the stance foot off the ground after push-off.

Where are the compass walker’s dynamics viable?

1-step viable region

Walking motions can start in the feasible region \({\mathscr{V}\!\!\!\!}_0\) of the state space:

$$\begin{aligned} {\mathscr{V}\!\!\!\!}_0 \triangleq \{(\theta ^+,{\dot{\theta }}^+) \mid \theta ^+ \geqslant 0,\, {\dot{\theta }}^+ \leqslant 0\}. \end{aligned}$$
(1)

We further restrict \(\theta ^+ \leqslant 0.85\), which covers the range of stance angles observed in humans.

Figure 2
figure 2

Powered compass walker’s 1-step viable region \({\mathscr{V}\!\!\!\!}_1\), i.e., the set of states beginning in which the walker takes at least one step while remaining viable, bounded by the curves \(\Omega _{\text {low}}\), \(\Omega _{\text {high}}\), \(\Gamma _{\text {GRF}}^+\), and \(\Gamma _{\text {GRF}}^-\): (a) In the wedge-shaped region in the middle (“1-step” region19), demarcated by the curves \(\Omega _{\text {low}}\) and \(\Omega _{\text {high}}\), the walker has at least one heel strike though it may not necessarily maintain a nonnegative GRF at the stance foot. Indeed, in the nonviable region, the stance leg either moves too slowly to swing past the vertical, moves too fast so that the walker falls forward, or fails to maintain ground contact throughout the stance phase. Thus, \({\mathscr{V}\!\!\!\!}_1\) is a strict subset of the “1-step” region19. (b) To better visualize \({\mathscr{V}\!\!\!\!}_1\), we plot the state space with \({\dot{\theta }}^+\) scaled to \({\dot{\theta }}^+_{\text {sc}} \triangleq \frac{{\dot{\theta }}^+ - \Omega _{\text {low}}(\theta ^+)}{\Omega _{\text {low}}(\theta ^+)- \Omega _{\text {high}}(\theta ^+)}\) for any given \(\theta ^+ \in (0,0.85]\), so that the new variable \({\dot{\theta }}^+_{\text {sc}}\) is 0 on the upper \(\Omega _{\text {low}}\) curve and takes a value \(-1\) on the lower \(\Omega _{\text {high}}\) curve19 (freehand arrows). The period-1 gaits of the walker, viz., “long-period” and “short-period” gaits that repeat every step, along with their open-loop stability, are as in our previous work19: solid lines show open-loop-stable gaits, while broken lines depict open-loop-unstable gaits. Inset shows zoomed-in area where \(\Gamma _{\text {GRF}}^+\), and \(\Gamma _{\text {GRF}}^-\) intersect each other and the period-1 gaits.

Previously19, we identified the “1-step” region of the powered compass walker (Fig. 1) as the set of states from which the walker can have at least one heel strike. The 1-step region is the wedge-shaped region within \({\mathscr{V}\!\!\!\!}_0\), demarcated by the curves \(\Omega _{\text {low}}\) and \(\Omega _{\text {high}}\) (Fig. 2a). However, our previous work did not seek to identify the walker’s viability within this region.

Here, we find the viable subset of the 1-step region, i.e., the 1-step viable region \({\mathscr{V}\!\!\!\!}_1\), by imposing viability constraints on the walker’s dynamics over one step (Eq. 2). We visualize \({\mathscr{V}\!\!\!\!}_1\) in a scaled state space (Fig. 2b), which we introduced previously19.

The nonnegativity constraint of the ground reaction force (GRF) at the stance foot yields two curves, \(\Gamma _{\text {GRF}}^+\) and \(\Gamma _{\text {GRF}}^-\) defined by the equalities in Eq. (5). Each of these curves partition the 1-step region into viable and nonviable sets. Specifically, the walker’s stance foot maintains contact with the ground throughout when initialized from states on the sides of both \(\Gamma _{\text {GRF}}^+\) and \(\Gamma _{\text {GRF}}^-\) that contain the origin (0, 0) (Fig. 2b).

The actuation limits (Eq. 8) by themselves do not further limit the push-off-powered walker’s viability over a single step. Consequently, the walker’s 1-step viable region \({\mathscr{V}\!\!\!\!}_1\) is bounded by only four curves, viz., \(\Omega _{\text {low}}\), \(\Omega _{\text {high}}\), \(\Gamma _{\text {GRF}}^+\), and \(\Gamma _{\text {GRF}}^-\) (Fig. 2).

Also shown in Fig. 2 are the walker’s period-1 gaits, i.e., gaits that repeat every step. The walker admits families of “long-period” and “short-period” gaits16,21, which are fixed points \((\theta ^*,{\dot{\theta }}^*; P^*)\) of the map \({\varvec{F}}\) (Eq. 2), for a given \(P^*\). While the long- and short-period gaits admit distinct step times and contrasting open-loop stability as \(\theta ^+ \rightarrow 0\)22, their curves19 intersect at (0, 0) in the original state space (Fig. 2a). In contrast, in the scaled state space (Fig. 2b), those very gaits remain bounded away from each other as \(\theta ^+ \rightarrow 0\), which facilitates further analysis.

Viability kernel: \(\infty\)-step viable region

While the walker can definitely take a step in the 1-step viable region \({\mathscr{V}\!\!\!\!}_1\) (Fig. 2), it is not guaranteed to walk forever, even with the best-possible push-off control. This is because the walker’s state after taking a step need not remain in \({\mathscr{V}\!\!\!\!}_1\), but is only guaranteed to lie in \({\mathscr{V}\!\!\!\!}_0\) (Eq. 1). We therefore identify the largest closed subset \({\mathscr{V}\!\!\!\!}\) of \({\mathscr{V}\!\!\!\!}_1\) in which the walker can remain viable forever, i.e., for an infinite number of walking steps. That is, for any state \(\varvec{\mathbf {x}}_k :=[\theta _k^+,\dot{\theta }_k^+]^\top \in {\mathscr{V}\!\!\!\!}\), there exists at least one push-off input \(P_k\) such that \(\varvec{\mathbf {x}}_{k+1} :=[\theta _{k+1}^+,\dot{\theta }_{k+1}^+]^\top ={\varvec{F}}(\varvec{\mathbf {x}}_k;P_k) \in {\mathscr{V}\!\!\!\!}\), satisfying viability constraints. The set \({\mathscr{V}\!\!\!\!}\) is thus the \(\infty\)-step viable region or the viability kernel5,8 of the powered compass walker. It also follows that \({\mathscr{V}\!\!\!\!}\) is the largest positively invariant set (i.e., invariant in forward time)23 under the walker’s closed-loop dynamics, i.e., with state-dependent push-off input. Alternatively, \({\mathscr{V}\!\!\!\!}\) is the largest controlled-invariant set23 of the push-off-powered compass walker. Outside \({\mathscr{V}\!\!\!\!}\), the states are nonviable as no sequence of push-offs can prevent the walker from eventually failing (i.e., either violating at least one of the viability constraints or falling).

Figure 3
figure 3

The \(\infty\)-step viable region or the viability kernel \({\mathscr{V}\!\!\!\!}\) in the scaled state space (Fig. 2b) of the powered compass walker, numerically approximated via Algorithm 1 as the 18-step viable region \({\mathscr{V}\!\!\!\!}_{18}\) after convergence on a grid. The set \({\mathscr{V}\!\!\!\!}\), bounded by the curves \(\{\Gamma _{\text {b}}, \Gamma _{\text {t}}, \Gamma _{\text {GRF}}\}\), is a strict subset of the 1-step viable region \({\mathscr{V}\!\!\!\!}_1\) (Fig. 2): indeed, states within \({\mathscr{V}\!\!\!\!}_1\) (or “1-step” region19) that are either below \(\Gamma _{\text {b}}\) or above \(\Gamma _{\text {t}}\) are nonviable. The boundary \(\Gamma _{\text {GRF}}\) is common to both \({\mathscr{V}\!\!\!\!}\) and \({\mathscr{V}\!\!\!\!}_{1}\). The curves of long- and short-period gaits are from Fig. 2. (a) The two unreachable subsets (hatched regions) of \({\mathscr{V}\!\!\!\!}\), demarcated by the boundaries \(\Gamma _1\) and \(\Gamma _2\), cannot be traversed by the walker. (b) The open-loop basin of attraction with zero push-off (\(P^*=0\)) is a subset of \({\mathscr{V}\!\!\!\!}\), within which trajectories approach the steady-state long-period gait \(\mathbf{S}\) at \(\{(\theta ^*,\dot{\theta }^*);P^*\}=\{(0,0);0\}\). The basin boundaries form the stable set19,48 of the unstable short-period gait \(\mathbf{U}\) (a saddle point) at \(\{(\theta ^*,\dot{\theta }^*);P^*\}=\{(0,0);0\}\) and also contain the boundaries \(\Gamma _{\text {b}} \setminus \Omega _{\text {high}} :=\{(\theta ^+,\dot{\theta }^+) \in \Gamma _{\text {b}} \mid \theta ^+ \lessapprox 0.37402 \}\) and \(\Gamma _{\text {t}}\) of \({\mathscr{V}\!\!\!\!}\).

We employed the viability kernel algorithm5 that avoids brute-force computation by utilizing the positive invariance property of \({\mathscr{V}\!\!\!\!}\) for its estimation (see “Methods”). Our implementation of that algorithm converged after 18 iterations so that the set \({\mathscr{V}\!\!\!\!}_{18}\), i.e., the 18-step viable region where the walker can take at least 18 steps, is the final estimate of the \(\infty\)-step region \({\mathscr{V}\!\!\!\!}\) (Fig. 3a) to within the resolution of the grid on the state space.

We estimated the areas of different regions in the original state space using the composite Simpson’s rule. The \(\infty\)-step viable region \({\mathscr{V}\!\!\!\!}\) (Fig. 3a) occupies \(\approx 97.46\%\) area of the 1-step viable region \({\mathscr{V}\!\!\!\!}_1\) (Fig. 2): This indicates that the walker’s push-off can be chosen to make it walk forever beginning in almost all states for which it can have a legitimate heel strike (Eq. 4).

Unreachability within the viability kernel

We found the unreachable subset \({\mathscr{V}\!\!\!\!}_{\text {UR}}\) of \({\mathscr{V}\!\!\!\!}\) that cannot be traversed by the walker’s trajectories (see “Methods”). The set \({\mathscr{V}\!\!\!\!}_{\text {UR}}\) consists of two disjoint subsets of \({\mathscr{V}\!\!\!\!}\), together occupying \(\approx 2.47\%\) of its area (Fig. 3a). As expected, the walker’s period-1 gaits lie entirely within the reachable subset of \({\mathscr{V}\!\!\!\!}\).

Evidently, any walking task or target that would require the walker to traverse such unreachable sets cannot be achieved. The walker’s state can end up in \({\mathscr{V}\!\!\!\!}_{\text {UR}}\) due to external disturbances or can be initialized within it; however, its state immediately (i.e., in one step) leaves \({\mathscr{V}\!\!\!\!}_{\text {UR}}\) under the walker’s dynamics (Eq. 14).

Viability kernel boundaries

The viability kernel algorithm guarantees that the trajectories of nonviable grid-point states (Fig. 3) cannot enter the viability kernel \({\mathscr{V}\!\!\!\!}\) while those originating in the interior of \({\mathscr{V}\!\!\!\!}\) always remain in it. However, \({\mathscr{V}\!\!\!\!}\) is a closed set5, so states on its boundary must also satisfy the positive invariance property (Eq. 13): That is, the boundary of \({\mathscr{V}\!\!\!\!}\) can be mapped into itself or into the interior of \({\mathscr{V}\!\!\!\!}\)24, provided appropriate input push-offs are chosen.

The boundary of \({\mathscr{V}\!\!\!\!}\) is a union of three curves: \(\Gamma _{\text {b}}\), \(\Gamma _{\text {t}}\) and \(\Gamma _{\text {GRF}}\) (Fig. 3). Our numerical results indeed show the positive invariance of the estimated boundaries of \({\mathscr{V}\!\!\!\!}\), which leads to their validation via the mathematical theory of dynamical systems (see “Methods”).

Task-level regulation, global stability, and fall avoidance

No strategy can avoid falls for states outside the viability kernel \({\mathscr{V}\!\!\!\!}\). Conversely, the walker can walk forever inside \({\mathscr{V}\!\!\!\!}\) by employing any one of infinitely many appropriate sequences of push-offs. However, the region \({\mathscr{V}\!\!\!\!}\) itself exists and is independent of any given control strategy the walker might choose. Thus, it is meaningful to assess the performance of different specific control strategies in avoiding falls only for the trajectories starting within \({\mathscr{V}\!\!\!\!}\).

We are particularly interested in motor regulation templates, i.e., empirically motivated models of how humans manipulate task-level observables on a step-to-step basis10,14. As a model task-level regulation strategy, we here specify experimentally informed step-to-step speed regulation9,14 on the walker (Fig. 1): see “Methods”. Specifically, we pick a push-off impulse at each step by minimizing the squared discrepancy between the speed V at the next step and its desired target value \(V^*\), chosen a priori.

Global stability under task-level regulation: basins of attraction

Previously19, we demonstrated a functional connection between task-level motor regulation and the walker’s ability to reject large disturbances, i.e., its global stability. The maximal attainable global stability for the walker, capable of applying arbitrary sequence of push-offs within its actuation limits, is, indeed, its viability. Therefore, we assess a walker’s global stability via the basins of attraction of its steady-state gaits in the state space vis-à-vis the viability kernel \({\mathscr{V}\!\!\!\!}\) (Fig. 3).

As in our recent work19, we numerically estimated basins by simulating the open-loop (\(P_k :=P^*\)) walker’s trajectories for 50 steps and those of the speed-regulated (Eq. 16) walker for 25 steps, starting from every state on the same grid that we used for the estimation of \({\mathscr{V}\!\!\!\!}\). The walker’s trajectories that fail to satisfy viability constraints are not considered part of its basins.

Figure 4
figure 4

Evolution of the open-loop (\(P_k :=P^*\), constant) walker’s basin of attraction within the viability kernel \({\mathscr{V}\!\!\!\!}\) of its long-period steady-state gait () with increasing push-off impulse \(P^*\). Compare to Fig. 5. The open-loop basin at \(P^* = 0.001\) is similar in structure to that with no push-off (\(P^*=0\)) that shares boundaries with \({\mathscr{V}\!\!\!\!}\) (Fig. 3b). As \(P^*\) increases, the basins shift to the right within \({\mathscr{V}\!\!\!\!}\), while shrinking progressively for \(P^* \geqslant 0.01\). The first period-doubling bifurcation occurs at \(P^* \approx 0.13571\), so that the open-loop basin at \(P^* \approx 0.288\) is empty. Basin areas (\(\%\) of the area of \({\mathscr{V}\!\!\!\!}\)) for increasing \(P^*\): \(\{8.32, 8.36, 5.38, 3.11, 1.46, 0\}\%\).

Figure 5
figure 5

Evolution of the speed-regulated walker’s basin of attraction within the viability kernel \({\mathscr{V}\!\!\!\!}\) of its long-period steady-state gait () with increasing target step speed \(V^*\) (or, push-off impulse \(P^* \in \{0.001,0.01,0.05,0.1,0.1325,\approx 0.288\}\)). Compare to Fig. 4. For \(V^* \geqslant 0.113\), the basins are highly regular regions delimited by the level curves (\(\Gamma _{\text {left}}\) and/or \(\Gamma _{\text {right}}\) of the form \(\{\theta ^-=\text {constant}\}\)) and the boundaries of \({\mathscr{V}\!\!\!\!}\) themselves. The geometric structure and size of the speed-regulated basins at \(V^* \in \{\approx 0.016, \approx 0.051\}\) is affected by viability constraints, specifically, actuation limits (Eq. 8): the basin at \(V^* \approx 0.016\) is similar in structure to the open-loop basin for \(P^* \in \{0,0.001\}\) (Figs. 3 and 4). Basin areas (\(\%\) of the area of \({\mathscr{V}\!\!\!\!}\)) for increasing \(V^*\): \(\{8.12, 11.62, 20.59, 36.62, 44.83, 54.13\}\%\).

The open-loop basins (Fig. 4) are significantly smaller in area than those of the speed-regulated basins (Fig. 5). Moreover, the geometric structure of the open-loop basins becomes more intricate as push-off impulse \(P^*\) increases, with a growing number of disjoint boundaries (see19 for a discussion of the aspect of the noninvertibility structure of the open-loop basins). In contrast, the speed-regulated walker’s basins occupy large areas within \({\mathscr{V}\!\!\!\!}\) and are highly regular (Fig. 5): their boundaries are given by level curves of the form \(\theta ^-=\text {constant}\)19 and/or are shared with the boundaries of \({\mathscr{V}\!\!\!\!}\) themselves.

Figure 6
figure 6

Evolution of the basin sizes (percent of the area of the viability kernel \({\mathscr{V}\!\!\!\!}\), Fig. 3) for the open-loop and speed-regulated walkers. Both \(V^*\) and \(P^*\) correspond to the steady-state long-period gait. The markers denote sizes of the basins estimated via simulations (Figs. 34, and 5). The solid line for speed regulation denotes analytical approximations of basin sizes when basin boundaries can be predicted (either as level curves and/or coinciding with the boundaries of \({\mathscr{V}\!\!\!\!}\)): these predictions match simulations well except when actuation limits significantly affect the basin structure at low speeds or push-offs. The solid line for open loop corresponds to unstable gaits so that their basins are empty.

In Fig. 6, we compare the normalized areas of the basins of attraction within the viability kernel \({\mathscr{V}\!\!\!\!}\) for the open-loop and speed-regulated walkers for target speeds \(V^* \lessapprox 0.38301\) (or, push-offs \(P^* \lessapprox 0.79478\)), leading up to the transcritical bifurcation19.

The open-loop walker’s basin shrinks significantly as \(P^*\) increases from 0.01 to 0.1325, before the long-period gait loses open-loop stability at \(P^* \approx 0.13571\) via a period-doubling bifurcation. The open-loop basin occupies a maximum of \(\approx 8.4\%\) of the area of \({\mathscr{V}\!\!\!\!}\) at \(P^*=0.01\). In comparison, the speed-regulated walker’s basin of its long-period gait grows with speed until it achieves its maximum size, \(\approx 56.4\%\) area of \({\mathscr{V}\!\!\!\!}\), at \(V^* \approx 0.23308\) (\(P^* \approx 0.24214\)) before shrinking significantly at higher speeds.

Viability via hierarchical task switching control

The open-loop basins in Fig. 4 together occupy only \(\approx 20.36\%\) of the area of the viability kernel \({\mathscr{V}\!\!\!\!}\) with many hard-to-fill gaps in between. Furthermore, we estimate that all of the open-loop basins, corresponding to \(P^*\) values of all the long-period gaits, together can cover no more than 40% of the area of \({\mathscr{V}\!\!\!\!}\).

Figure 7
figure 7

Five of the speed-regulated walker’s basins from Fig. 5 of its long-period steady-state gait () corresponding to the target step speeds, \(\{V_1^* \approx 0.016, V_2^* \approx 0.051, V_3^* \approx 0.113, V_4^* \approx 0.178, V_5^* \approx 0.251\}\). These five basins together cover \(>99.99\%\) of the area of the viability kernel. Also, any two adjacent basins have some overlap with each other. We consider two examples of a scenario where the walker experiences a large disturbance while walking at some desired speed \(V_f^*\), such that its “disturbed” state (star pentagons) lies within the speed-regulated basin \({\mathscr {B}}(V_i^*)\) corresponding to some speed \(V_i^*\). A sequence of walking steps (broken lines joining squares) then illustrates the walker’s post-disturbance recovery back to the steady-state gait () corresponding to speed \(V_f^*\) via task switching control of speed regulators: in example 1 (star pentagon, red), \(V_f^*=V_3^*\), and \(V_i^*=V_5^*\); in example 2 (star pentagon, blue), \(V_f^*=V_2^*\), and \(V_i^*=V_4^*\). In both examples, the “high-level” task switching controller allows the walker to reach the desired \(V_f^*\)-manifold within the basin \({\mathscr {B}}(V_f^*)\) in only three steps. After that, the “low-level” regulator targeting speed \(V_f^*\) allows the walker to transiently approach the steady-state gait over many steps. See Fig. 8 for the corresponding sequences of step speeds and push-off inputs employed by the walker during its recovery.

Conversely, the task-level speed regulator, while achieving the specified goal of maintaining a target speed at each step, allows the push-off powered compass walker to reject a large range of external disturbances, despite not being designed to do so19. The speed-regulated walker’s basins occupy large, regular regions of \({\mathscr{V}\!\!\!\!}\) for a range of target speeds \(V^*\) (Fig. 6). Furthermore, as we show in Fig. 7, only five of the speed-regulated walker’s basins from Fig. 5 almost fully cover \({\mathscr{V}\!\!\!\!}\). Thus, starting from almost every state in \({\mathscr{V}\!\!\!\!}\), as might occur from an external disturbance, there is at least one task-level speed regulator (or \(V^*\)) that allows the walker to avoid falls as long as the state trajectory remains within the corresponding basin. Additionally, since a set of target speeds \(V^*\) can be chosen so that any two adjacent speed-regulated basins overlap (as in Fig. 7), there is flexibility to switch between the corresponding regulators immediately (\(V_i^* \leftrightarrow V^*_{i+1}\)) provided the walker’s state lies within the basin intersection. Thus, this suggests that task-level speed regulation, unlike open-loop dynamics, could, at least in principle, be used to keep the walker viable for almost all states in \({\mathscr{V}\!\!\!\!}\), i.e., allowing it to avoid falls forever, in response to any disturbance that does not push the system entirely out of \({\mathscr{V}\!\!\!\!}\). For example, a plausible task switching controller could appropriately switch target speed at each step to one of the five values \(\{V_i^*,i=1,\ldots ,5\}\), as in Fig. 7, so that the walker can move from one speed-regulated basin to another without falling. We posit that a similar adaptive hierarchical control/regulation strategy exists in human walking and provides a key mechanism used to avoid falling.

To further elucidate the function of such task switching control, we consider a scenario where the walker experiences a large disturbance while maintaining some desired speed \(V_f^*\). Let the state of the walker immediately after the disturbance lie within the viability kernel: \(\varvec{\mathbf {x}}_k \in {\mathscr{V}\!\!\!\!}\) at the \(k^{\text {th}}\) walking step. Moreover, we assume that \(\varvec{\mathbf {x}}_k \in {\mathscr {B}}(V_i^*)\), where \({\mathscr {B}}(V_i^*)\) is the task-regulated basin corresponding to some suitably chosen intermediate target speed \(V_i^*\). The walker then applies a push-off \(P_{k,i}^{\text {opt}}\) to achieve the target value \(V_i^*\) at the next step (\(V^*:=V_i^*\) in Eq. 15). We construct a possibly minimal set, \(\varvec{\mathbf {V}}_p\), of all such target speeds \(V_i^*\) such that the corresponding set of speed-regulated basins together can cover the viability kernel: \({\mathscr{V}\!\!\!\!} \approx \cup _i\, {\mathscr {B}}(V_i^*)\) (Fig. 7). Thus, specifying such a hierarchical control strategy amounts to specifying a suitable set of “task switches”, i.e., target speeds \(\{V_i^* \in \varvec{\mathbf {V}}_p\}\) at each step, for the regulators. Such task switching control can, in principle, allow the walker to get back to its original task goal \(V_f^* \in \varvec{\mathbf {V}}_p\) while remaining viable throughout its post-disturbance recovery phase: at the \((k+1)^{\text {st}}\) walking step, the walker’s state \(\varvec{\mathbf {x}}_{k+1}\) not only belongs to \({\mathscr {B}}(V_i^*)\) but also to \({\mathscr {B}}(V_j^*)\) for some \(V_j^* \in \varvec{\mathbf {V}}_p\), \(j \ne i\), by design. Once the walker’s state trajectory enters the basin \({\mathscr {B}}(V_f^*)\) corresponding to the original task, the relevant speed regulator to achieve that task goal is switched back on for subsequent walking steps, until the next large disturbance is encountered. See Figs. 7 and 8 for sample results illustrating the walker’s recovery in the aforementioned scenario. These results also demonstrate the basic behavioral feature of the two levels of our hierarchical control/regulation strategy: First, the “high-level” task switching controller brings the walker rapidly (i.e., in a few steps) to the desired \(V_f^*\)-manifold within the basin \({\mathscr {B}}(V_f^*)\). Then, the “low-level” regulator targeting speed \(V_f^*\) makes relatively small adjustments (possibly over many steps) as the walker approaches its steady-state gait. Thus, using task switching, it is possible to return to the basin of attraction for the desired task goal, and thereby recover from a disturbance without falling, in only a few steps. Responses such as these are comparable to those predicted in other simple biped models8 and also those observed in experiments in humans recovering from large balance perturbations25,26. Overall, following such a hierarchical strategy of switching between a small set of target speeds, the walker could walk forever while overcoming a wide range of large disturbances. Furthermore, because task switching is not mechanical, it is not affected by the the walker’s inertial properties. Thus, the time scale of task switching in humans would be limited not by mechanics proper, but by the speed of processes in the nervous system related to perception, motor activation, and cognition (particularly executive function). Therefore, task switching can, in principle, be accomplished almost instantaneously. This would have obvious benefits for recovering from sudden, unexpected disturbances.

Discussion

We studied the simplest dynamic walker’s viability, i.e., its ability to avoid falls forever by applying an appropriate sequence of push-off inputs. Specifically, for the push-off-powered compass walker21, we estimated the viability kernel \({\mathscr{V}\!\!\!\!}\) in its state space5 and verified that our numerical results are consistent with the mathematical theory of dynamical systems. We found that the walker’s push-off can be chosen to avoid falls forever beginning in almost all states that allow the walker to have a heel strike. Moreover, greater than \(97\%\) of the states within \({\mathscr{V}\!\!\!\!}\) remain reachable via push-off inputs, indicating a high degree of maneuverability of the viable walker.

We posited that humans could remain viable, i.e., avoid falls forever, via a hierarchical schema consisting of both control and functionally distinct task-level step-to-step regulation of gait observables. As a model task-level motor regulation strategy for the walker, we imposed speed regulation9,14 that, as we demonstrated in19, greatly enhances the walker’s global stability (large disturbance rejection) compared to open-loop (unregulated) dynamics. Here, however, we assessed the walker’s global stability relative to its viability—its maximal attainable global stability—via the basins of attraction of its steady-state gaits in the state space vis-à-vis \({\mathscr{V}\!\!\!\!}\). This facilitated a direct comparison between open-loop dynamics, task-level regulation, and theoretically best-possible control strategies from the perspective of fall avoidance alone.

We found that the speed-regulated walker’s basins, unlike the open-loop basins (Fig. 4), occupy large, regular regions within \({\mathscr{V}\!\!\!\!}\) (Figs. 5 and 6). Moreover, for a range of target speeds, their boundaries are given by simple level curves and/or are shared with the boundaries of \({\mathscr{V}\!\!\!\!}\) themselves. Furthermore, the speed-regulated basins corresponding to only a few target speeds together nearly cover the entirety of \({\mathscr{V}\!\!\!\!}\) even as any adjacent pairs of such basins overlap in the state space (Fig. 7). Our results thus strongly suggest a potential role of task-level regulation within high-level control strategies that are explicitly geared toward avoiding falls or attaining viability. In light of this, we proposed a high-level, adaptive task switching control strategy that, in principle, maintains viable walking by selecting between a small collection of task-level speed regulators corresponding to a few preselected target speeds—“task switches”—at each walking step. However, it is clear that, at least in principle, such task switching controllers could also employ qualitatively different regulators, based on gait observables other than walking speed (e.g., step length or time), or even a combination of such regulators. Thus, our proposed task switching schema is more general than the example implemented here using speed regulation alone.

The theoretically best-possible control strategies that guarantee the walker’s viability could require specifying an entire sequence of push-offs for each different walking trajectory. In comparison, a hierarchical task switching controller seems advantageous from an information transmission and processing perspective: it needs specifying only a sequence of discrete task switches, each belonging to a small predetermined set. While we are agnostic as to how such hierarchical task switching control could be realized biologically, our results nevertheless suggest that its “information cost” could be relatively low for the nervous system. This is because the cognitive demands of discretely switching between a few (and likely already learned or “crystallized”27,28) tasks could be substantially lower than estimating/specifying appropriate control inputs “from scratch” at each walking step. Thus, humans might prefer cognitively less-demanding hierarchical control strategies based on task switching. Indeed, task switching (or “set shifting”) is already a well-established sub-component of executive function29. For older adults, executive function is crucial to their ability to avoid falling and impaired executive function predicts their fall risk30,31,32. The ability to task switch in particular declines in older adults33 and predicts both poor balance34 and fall history35. Our results thus provide direct theoretical support to the idea that the impaired ability to task switch appropriately and/or quickly enough likely contributes to increased fall risk in older adults.

Our 2D deterministic walker does not explicitly include the effect of motor noise present in the human nervous system, neither does it capture certain important aspects of human walking like stance phase actuation and control of mediolateral balance. While sufficiently large noise in the push-off input P could make some of the walker’s trajectories nonviable, we expect task switching to remain important in fall avoidance for the remaining majority of states within \({\mathscr{V}\!\!\!\!}\). Similarly, our study could be repeated for a more elaborate model, such as a 3D walker that requires a lateral stability controller to take individual steps, albeit at significantly higher computational expense. While the specific results of any such model would differ, our general conclusion that task switching via an adaptive hierarchical control/regulation strategy can help avoid falls is expected to hold.

It is well known that humans can adapt their stepping to avoid falls, even when experiencing substantial external disturbances36,37,38,39. Walking humans can also readily achieve a variety of task goals in different environments9,40,41,42,43. However, it remains unknown how the human “controller” adapts to such task goals at a neurophysiological level. As in our previous work19, the structure of our model is based in part on experimental evidence of task-level motor regulation in human walking9,14. Here, we developed a general theoretical framework to show how humans can, at least in principle, avoid falls by switching between regulation strategies used to perform already-learned goal-directed tasks. We expect that our framework will pave the way for more focused experiments in the future.

While our perspective is focused on goal-directed behavior of biological movement, our results have implications for robotics as well. Indeed, some high-level strategies based on switching between different controllers44 or between limit cycles with speed changes have demonstrated improved stability and versatility of bipedal walking45 and running46 robot models. For multi-degree-of-freedom robot models, it is computationally difficult to map out the viability kernel in their high-dimensional state spaces. However, the concept of task switching within a hierarchical control/regulation strategy could be potentially employed to enhance the robustness of walking robots and help reduce (or perhaps minimize) their falls.

Methods

Simplest dynamic walker

We employ a 2D compass walker (Fig. 1) that walks on a level surface by means of impulsive push-off actuation P. The continuous stance phase of this walker is unactuated with no foot placement control. This makes it the simplest actuated model having definite swing leg dynamics, unlike 2D inverted pendulum models8.

Every forward walking step (Fig. 1) consists of a continuous-time single-support stance phase followed by an instantaneous impulsive double-support phase. Thus, the walker’s step-to-step dynamics are inherently hybrid. The walker’s state, just after heel strike, is fully described by the stance leg angle \(\theta ^+\) and its angular rate \(\dot{\theta }^+\), in the inertial frame attached to the stance foot. The walker’s step-to-step dynamics can be studied as a hybrid Poincaré map, \({\varvec{F}} \triangleq [F_1,F_2]^\top\), over the two-dimensional state space \((\theta ^+, {\dot{\theta }}^+)\) with push-off input \(P_k\) applied just before heel strike at the end of step k19,21:

$$\begin{aligned} \theta _{k+1}^+&= F_1 (\theta _{k}^+, {\dot{\theta }}_{k}^+), \end{aligned}$$
(2a)
$$\begin{aligned} {\dot{\theta }}_{k+1}^+&= F_2 (\theta _{k}^+, {\dot{\theta }}_{k}^+; P_k). \end{aligned}$$
(2b)

The map \({\varvec{F}}\) is non-invertible19, i.e., any given state of the walker could have zero, one, or more than one preimage under \({\varvec{F}}\), even when P is fixed. Also, across heel strikes21 (Fig. 1):

$$\begin{aligned} {\theta }^+_{k+1}&= -\theta ^-_k, \end{aligned}$$
(3a)
$$\begin{aligned} {\dot{\theta }}^+_{k+1}&= {\dot{\theta }}^-_k \cos 2\theta ^-_k + P_k \sin 2\theta ^-_k. \end{aligned}$$
(3b)

The walker’s heel strike is legitimate (Fig. 1) when:

$$\begin{aligned} \theta ^- \leqslant 0,\, {\dot{\theta }}^- \leqslant 0,\,{\phi }^- = 2{\theta }^-,\, \text { and } {\dot{\phi }}^- \geqslant 2{\dot{\theta }}^-. \end{aligned}$$
(4)

We also assume no slipping at the foot-ground contact.

Viability constraints

For the walker to remain viable, its stance foot must remain on the ground so that the ground reaction force (GRF) at the stance foot is nonnegative throughout the stance phase. Since this GRF can be smallest either just after or before heel strike, we get two inequality constraints over the state space (Fig. 1):

$$\begin{aligned} \text {GRF}^+: \cos \theta ^+-({\dot{\theta }}^+)^2&\geqslant 0, \end{aligned}$$
(5a)
$$\begin{aligned} \text {GRF}^-: \cos \theta ^--({\dot{\theta }}^-)^2&\geqslant 0. \end{aligned}$$
(5b)

Moreover, this places a state-dependent limit on the maximum push-off, \(P_{k,\text {max}}\), since the walker cannot lift off the ground when the swing foot’s heel strike is impending8:

$$\begin{aligned} P_{k,\text {max}}= {\left\{ \begin{array}{ll} {\dot{\theta }}_k^- \tan 2{\theta }_k^- &{} \text { for }\, -(\pi /4) < {\theta }_k^- \leqslant 0,\\ \infty &{} \text { for }\, {\theta }_k^- \leqslant -(\pi /4). \end{array}\right. } \end{aligned}$$
(6)

Furthermore, the impulsive actuation cannot apply a braking force, i.e., \(P_k \geqslant 0\). Additionally, we assume that the stance foot must lift off the ground after push-off. This places a state-dependent limit on the minimum push-off, \(P_{k,\text {min}}\), so that the walking motion can continue (Eqs. 3b and 1):

$$\begin{aligned} P_{k,\text {min}}= {\left\{ \begin{array}{ll} 0 &{} \text { for }\, -(\pi /4) < {\theta }_k^- \leqslant 0,\\ -{\dot{\theta }}_k^- \cot 2{\theta }_k^- &{} \text { for }\, {\theta }_k^- \leqslant -(\pi /4). \end{array}\right. } \end{aligned}$$
(7)

Therefore, the push-off impulse at each step k needs to satisfy actuation limits (Eqs. 6 and 7) for the walker to remain viable:

$$\begin{aligned} P_{k,\text {min}} \leqslant P_k \leqslant P_{k,\text {max}}. \end{aligned}$$
(8)

Numerical estimation of the viability kernel

Estimating the viability kernel \({\mathscr{V}\!\!\!\!}\) for a given actuated dynamical system is in general a non-trivial task, even in low-dimensional state spaces23. For instance, \({\mathscr{V}\!\!\!\!}\) is more difficult to estimate than a basin of attraction, another positively invariant set. The trajectories originating in \({\mathscr{V}\!\!\!\!}\) can only be guaranteed to remain in an as yet unknown \({\mathscr{V}\!\!\!\!}\) ad infinitum by choosing an appropriate input sequence. Brute-force estimation of \({\mathscr{V}\!\!\!\!}\) requires the computation of many sufficiently long trajectories starting from each state, each of which differ due to distinct control input sequences. If at least one such trajectory satisfies viability constraints, then the corresponding starting state would likely belong to \({\mathscr{V}\!\!\!\!}\). Conversely, the trajectories of basin states approach an attractor that is often known a priori. Thus, brute-force estimation of a basin requires only a single sufficiently long trajectory starting from each state and a decision as to whether or not it will eventually reach the attractor. A recent study8 examined the viability of 2D inverted pendulum models of walking, which have a 1-dimensional state space and a 2-dimensional control input space. In contrast, the system considered here has a 2-dimensional state space and a 1-dimensional control input space.

The viability kernel algorithm5[pp. 153–154] avoids brute-force computation by utilizing the positive invariance property of \({\mathscr{V}\!\!\!\!}\), which for the walker (Eq. 2) can be written as:

$$\begin{aligned} {\varvec{F}}({\mathscr{V}\!\!\!\!};{\mathscr {P}}) \subseteq {\mathscr{V}\!\!\!\!}. \end{aligned}$$
(9)

Here, the set \({\varvec{F}}({\mathscr{V}\!\!\!\!};{\mathscr {P}}) \triangleq \{{\varvec{F}}(\varvec{\mathbf {x}};P(\varvec{\mathbf {x}})) \mid \varvec{\mathbf {x}} \in {\mathscr{V}\!\!\!\!}, P(\varvec{\mathbf {x}}) \in {\mathscr {P}}\}\), where \(P(\varvec{\mathbf {x}})\) is any appropriately chosen push-off P depending on the state \(\varvec{\mathbf {x}} :=[\theta ^+,\dot{\theta }^+]^\top\), and the set \({\mathscr {P}}\) is the collection of all such push-offs matched to states such that the relation (9) holds. The positive invariance property pertains to sets in the state space alone. Since \({\mathscr {P}}\) is not known a priori, we consider all push-offs within the actuation limits (Eq. 8) to eliminate \({\mathscr {P}}\) from the relation (9).

The dynamics of a powered compass walker, capable of applying any push-off within the actuation limits at each step, is described by a difference inclusion5, i.e., a set-valued map \(\tilde{\varvec{F}}\) satisfying

$$\begin{aligned} \varvec{\mathbf {x}}_{k+1} \in \tilde{\varvec{F}} (\varvec{\mathbf {x}}_k), \end{aligned}$$
(10)

where the set \(\tilde{\varvec{F}} (\varvec{\mathbf {x}}_k)\) is obtained from Eq. (2):

$$\begin{aligned} \tilde{\varvec{F}} (\varvec{\mathbf {x}}_k) :=\left\{ \left[ \theta ^+_{k+1},\dot{\theta }^+_{k+1}\right] ^\top \mid \, \dot{\theta }^+_{k+1} \in \dot{\Theta }_{k+1}\right\} , \end{aligned}$$
(11)

where \(\dot{\Theta }_{k+1}\) is an interval defined, using Eq. (3b) and the allowable range of push-offs \(P_k\) (Eqs. 6 and 7), as:

$$\begin{aligned} \dot{\Theta }_{k+1} :={\left\{ \begin{array}{ll} \left[ {\dot{\theta }}^-_k (1/ \cos 2\theta ^-_k),\, {\dot{\theta }}^-_k \cos 2\theta ^-_k \right] &{} \text { for }\, -(\pi /4) < {\theta }_k^- \leqslant 0,\\ (-\infty ,\, 0 ] &{} \text { for }\, {\theta }_k^- \leqslant -(\pi /4). \end{array}\right. } \end{aligned}$$
(12)

Thus, at step k, the set \(\tilde{\varvec{F}} (\varvec{\mathbf {x}}_k)\) is a vertical line segment, \(\dot{\Theta }_{k+1}\), in the state space at \(\theta ^+=\theta ^+_{k+1}=-\theta _k^-\) (Eq. 3a). Therefore, Eq. (9), expressed solely in terms of states, becomes:

$$\begin{aligned} \tilde{\varvec{F}}(\varvec{\mathbf {x}}) \cap {\mathscr{V}\!\!\!\!} \ne \emptyset \quad \text {for all} \quad \varvec{\mathbf {x}} \in {\mathscr{V}\!\!\!\!}. \end{aligned}$$
(13)

Thus, one can recursively obtain \({\mathscr{V}\!\!\!\!}\) via the following algorithm:

figure e

The intermediate estimates \(\{{\mathscr{V}\!\!\!\!}_{j+1} \subseteq {\mathscr{V}\!\!\!\!}_{j};\, j=1,2,3,\ldots \}\) form a nested sequence of j-step viable regions, whose limit is the viability kernel: \({\mathscr{V}\!\!\!\!} :={\cap}_{j=1}^{\infty} {\mathscr{V}\!\!\!\!}_j = {\lim}_{j} {\mathscr{V}\!\!\!\!}_j\). We numerically approximate \({\mathscr{V}\!\!\!\!}\) via a uniform 42500\(\times\)1002 grid of points over the scaled state space (Fig. 2b): \(\Delta \theta ^+=2\times 10^{-5}\) and \(\Delta {\dot{\theta }}^+_{\text {sc}}=1/1001\). However, all dynamics calculations are carried out in the original state space, for the corresponding grid over the wedge-shaped region (Fig. 2a).

Algorithm 1 is practically useful if it converges (stops) in a finite (preferably small) number of iterations. This requires an accurate representation of the boundaries of \({\mathscr{V}\!\!\!\!}_{j}\) (at the \(j^{\text {th}}\) iteration) so that the intersection \(\tilde{\varvec{F}} (\varvec{\mathbf {x}}) \cap {\mathscr{V}\!\!\!\!}_{j}\) in Algorithm 1 can be found reliably. The boundaries of \({\mathscr{V}\!\!\!\!}_1\) (\(\Omega _{\text {low}}\), \(\Omega _{\text {high}}\), \(\Gamma _{\text {GRF}}^+\) and \(\Gamma _{\text {GRF}}^-\) in Fig. 2) are smooth level curves, which we accurately represent via fitted piecewise cubic splines with continuous curvature (matlab’s spline). Since sets \(\{{\mathscr{V}\!\!\!\!}_j ; j\geqslant 2\}\) are recursively estimated as collections of j-step viable grid-point states, their boundaries are not known in closed form. We represent such boundaries by employing shape-preserving piecewise cubic polynomials (matlab’s pchip) to reduce potential artifacts (overshoots and oscillations) in the fitted curves over the grid. We passed such fitted boundary curves through nonviable grid-point states tightly enveloping estimates of \({\mathscr{V}\!\!\!\!}_{j}\) so as to avoid accidental removal of viable states during the iterations of Algorithm 1. Our implementation of Algorithm 1 converged at \(j=18\), so that the set \({\mathscr{V}\!\!\!\!}_{18}\) is the final estimate of the \(\infty\)-step region \({\mathscr{V}\!\!\!\!}\) (Fig. 3a) to within the grid resolution.

Unreachable subset of the viability kernel

The image of \({\mathscr{V}\!\!\!\!}\) under \(\tilde{\varvec{F}}\), i.e., \(\tilde{\varvec{F}}({\mathscr{V}\!\!\!\!}) :=\{\tilde{\varvec{F}}(\varvec{\mathbf {x}}) \mid \varvec{\mathbf {x}} \in {\mathscr{V}\!\!\!\!}\}\), does not cover \({\mathscr{V}\!\!\!\!}\) entirely, so that the unreachable subset of \({\mathscr{V}\!\!\!\!}\) is the open set:

$$\begin{aligned} {\mathscr{V}\!\!\!\!}_{\text {UR}} \triangleq {\mathscr{V}\!\!\!\!} \setminus \{\tilde{\varvec{F}}({\mathscr{V}\!\!\!\!}) \cap {\mathscr{V}\!\!\!\!}\} :=\{\varvec{\mathbf {x}} \in {\mathscr{V}\!\!\!\!} \mid \varvec{\mathbf {x}} \notin \tilde{\varvec{F}}({\mathscr{V}\!\!\!\!})\}. \end{aligned}$$
(14)

We found that the set \({\mathscr{V}\!\!\!\!}_{\text {UR}}\) consists of two disjoint subsets of \({\mathscr{V}\!\!\!\!}\) demarcated by the boundaries \(\Gamma _1\) and \(\Gamma _2\) (Fig. 3a). None of the grid-point states in \({\mathscr{V}\!\!\!\!}\) map above the boundary \(\Gamma _1\) with \(P=0\), and consequently for any \(P>0\) (Eq. 3b). Studies of non-invertible maps47,48 thus suggest that the boundary \(\Gamma _1\) belongs to a critical curve (often denoted as LC): the number of preimages of states on opposite sides of LC differs by two, which we also found to be the case for \(\Gamma _1\).

Validation of the viability kernel boundaries

The boundary of \({\mathscr{V}\!\!\!\!}\) is a union of three curves: \(\Gamma _{\text {b}}\), \(\Gamma _{\text {t}}\) and \(\Gamma _{\text {GRF}}\) (Fig. 3). The composite boundary \(\Gamma _{\text {GRF}}\) itself is a subset of the union of the boundaries \(\Gamma _{\text {GRF}}^+\) and \(\Gamma _{\text {GRF}}^-\) of the 1-step viable region \({\mathscr{V}\!\!\!\!}_1\) (Fig. 2b). The boundary \(\Gamma _{\text {b}}\) smoothly merges with the \(\Omega _{\text {high}}\) curve (\(\dot{\theta }^+_{\text {sc}}=-1\) in Fig. 3) at \(\theta ^+\approx 0.37402\). Thus, \(\Gamma _{\text {b}}\) is partitioned into two subsets, \(\Gamma _{\text {b}} \setminus \Omega _{\text {high}} :=\{(\theta ^+,\dot{\theta }^+) \in \Gamma _{\text {b}} \mid \theta ^+ \lessapprox 0.37402 \}\) and \(\Gamma _{\text {b}} \cap \Omega _{\text {high}} :=\{(\theta ^+,\dot{\theta }^+) \in \Gamma _{\text {b}} \mid \theta ^+ \gtrapprox 0.37402 \}\). We numerically verified that both \(\Gamma _{\text {GRF}}\) and \(\Gamma _{\text {b}} \cap \Omega _{\text {high}}\) can indeed be mapped in the interior of \({\mathscr{V}\!\!\!\!}\).

Furthermore, both boundaries \(\Gamma _{\text {b}} \setminus \Omega _{\text {high}}\) and \(\Gamma _{\text {t}}\) map into \(\Gamma _{\text {b}} \setminus \Omega _{\text {high}}\) after one step of the walker with zero push-off. Moreover, the boundary \(\Gamma _{\text {b}}\) is tangent to the curve of short-period gaits at the open-loop-unstable gait \(\mathbf{U}\) (a saddle point) at \(\{(\theta ^*,\dot{\theta }^*);P^*\}=\{(0,0);0\}\) (Fig. 3). These numerical results suggest that \(\Gamma _{\text {b}} \setminus \Omega _{\text {high}}\) and \(\Gamma _{\text {t}}\) belong to the stable set of the saddle \(\mathbf{U}\)19,48,49 of the walker’s non-invertible map \(\varvec{F}\) with \(P=0\) in Eq. (2). Consistently, we found that both \(\Gamma _{\text {b}} \setminus \Omega _{\text {high}}\) and \(\Gamma _{\text {t}}\) are contained in the open-loop basin boundaries for \(P^*=0\) (Fig. 3b), which constitute a stable set19. Since the stable set of a saddle is positively invariant, this confirms that the set \(\{\Gamma _{\text {b}} \setminus \Omega _{\text {high}}\} \cup \Gamma _{\text {t}}\) is also positively invariant.

Step-to-step speed regulation as a model task-level regulation strategy

We pick a push-off impulse at each step based on the discrepancy between the speed V at the next step that depends on the walker’s current state and its desired target value \(V^*\), chosen a priori. Thus, at step k, the smallest push-off, \(P_k^{\text {opt}}\), that minimizes the next-step quadratic cost is19:

$$\begin{aligned} P_k^{\text {opt}} := \underset{P}{{\,\mathrm{argmin}\,}}\, \left[ V_{k+1}(\varvec{\mathbf {x}}_{k};P)-V^*\right] ^2, \end{aligned}$$
(15)

where \(\varvec{\mathbf {x}}_{k} :=[\theta ^+_k,{\dot{\theta }}^+_k]^\top\) is the walker’s state at the beginning of step k. Then, the speed-regulated walker applies push-off \(P_k\) that satisfies actuation limits (Eq. 8) at step k:

$$\begin{aligned} P_{k} :={\left\{ \begin{array}{ll} P_k^{\text {opt}} &{} \text { for }\, P_k^{\text {opt}} \in [P_{k,\text {min}},P_{k,\text {max}}],\\ P_{k,\text {min}} &{} \text { for }\, P_k^{\text {opt}} < P_{k,\text {min}},\\ P_{k,\text {max}} &{} \text { for }\, P_k^{\text {opt}} > P_{k,\text {max}}. \end{array}\right. } \end{aligned}$$
(16)

We note that this speed regulation strategy (Eq. 15) does not explicitly utilize the location of the boundaries of \({\mathscr{V}\!\!\!\!}\) (Fig. 3) to infer \(P_k^{\text {opt}}\).

The push-off \(P_k^{\text {opt}}\) places the speed-regulated walker’s state \(\varvec{\mathbf {x}}_{k+1}\) on the target-speed manifold—a goal equivalent manifold12—that is a piecewise-smooth curve in the two-dimensional state space19, defined by:

$$\begin{aligned} V=V^* \qquad \text { or } \qquad \frac{\partial V}{\partial P}=0, \end{aligned}$$
(17)

whenever \(P_k^{\text {opt}} \in [P_{k,\text {min}},P_{k,\text {max}}]\) (Eq. 8). We efficiently simulated the speed-regulated walker’s trajectories by precomputing the target-speed manifold by solving Eqs. (17) using numerical continuation19.

Figure 8
figure 8

The sequences of step speeds \(V_k\) (a) and corresponding push-offs \(P_k\) (b) during the walker’s recovery (in two example scenarios depicted in Fig. 7) from large disturbances via task switching control of speed regulators. The walker’s speed rapidly switches to the target speed \(V_f^*\) in three steps so that \(V_4=V_f^*\): in example 1 (star pentagon, red), \(V_f^*=V_3^*\); while in example 2 (star pentagon, blue), \(V_f^*=V_2^*\). Subsequently, in example 1, the walker maintains its target speed throughout its approach to the steady-state gait: \(V_k=V_3^*\) for \(k \geqslant 5\). On the other hand, in example 2, the walker’s approach to its steady-state gait is transiently affected by actuation limits (Eqs. 6 and 8): \(V_k<V_2^*\) for \(5 \leqslant k \leqslant 9\), and \(P_k=P_{k,\text {max}}\) for \(4 \leqslant k \leqslant 8\).