Skip to Content
MathematicsMathematics
  • Feature Paper
  • Article
  • Open Access

17 October 2026

27 Pages

Direct Neural Dynamic Programming Adaptive Control of Knee and Ankle Joints in a Simulated Prosthetic Leg Model

,
,
and
1
Department of Systems and Control, Technical University of Sofia, 1700 Sofia, Bulgaria
2
Department of Electrical Measurement, Technical University of Sofia, 1700 Sofia, Bulgaria
*
Author to whom correspondence should be addressed.

Abstract

Effective control of prosthetic legs is essential for restoring natural mobility and enhancing the quality of life for amputees. This paper presents a Direct Neural Dynamic Programming (DNDP) algorithm that leverages coupled action and critic neural networks to solve the optimal control problem for prosthetic gait trajectory tracking. By continuously learning and adapting to individual gait patterns, the DNDP action networks generate the control for the knee and ankle joints to reduce the gait tracking error. The proposed approach enables real-time optimization of control strategies without relying on precise system models, offering adaptability to subject-specific dynamics and varying conditions.

1. Introduction

The lower limb plays a crucial role in human mobility and quality of life. Robotic limb substitutes can significantly benefit individuals with impaired motor function due to trauma, amputation, or disease. However, controlling prosthetic legs presents numerous challenges, including variations in gait, ground reaction forces, and terrain inclination. While robotized lower limb prostheses are commercially available, their capabilities continue to advance. Controlling these prosthetic legs presents significant mechanical challenges. One major hurdle is the substantial variability in gait patterns among individuals, making it difficult to accurately predict the current gait based solely on measurements.
The ATALANTE exoskeleton [1] employs virtual constraints and partial hybrid zero dynamics to assist individuals with paraplegia. This system uses 12 motors and two coordinate frames to enhance stability and maneuverability. Transcutaneous functional electrical stimulation offers an alternative approach, utilizing muscle energy to produce torque instead of relying on external power sources. A Lyapunov redesign approach coupled with dynamic surface control learning synergies can optimize muscle activation patterns in a 4DOF system [2,3].
Backdrivable exoskeletons [4] utilize volitional human motion and energy shaping to augment body energetics. This approach eliminates the need for high torques required to track lower-limb kinematics. The system’s torque bandwidth is 10 Hz, while human walking occurs in the 4–8 Hz range. Unilateral prosthetics often lead to gait abnormalities, which can be compensated for by performing more work during the middle of stance [5]. Residual muscular activations can be mapped to idealized gait using an activation mapping paradigm and a digital locomotor clone [6].
Adaptive Dynamic Programming (ADP) has evolved to solve dynamic programming problems in real time [7]. Heuristic Dynamic Programming (HDP) and Action-Dependent HDP (ADHDP) have improved the efficiency of ADP methods [8,9]. Recent developments in Direct Neural Dynamic Programming (DNDP) leverage neural network architectures to learn optimal policies directly from experience. The distinction of the proposed approach from deep reinforcement learning methods such as Deep Q-Networks is that the DNDP implementation considered here is adapted online, in a model-free manner, with small two-hidden-layer networks and an action-dependent critic, requiring no large offline datasets. Adaptive critic design (ACD) is the major cornerstone in a novel fault tolerant control framework [10] that incorporates a Control Barrier Function (CBF) into the cost function to enforce system safety, ensuring all closed-loop signals are uniformly ultimately bounded. The line of research in [11] advances adaptive robust optimal control for uncertain nonlinear systems with state constraints, combining CBF and ACD within a differential game framework. Recent research also demonstrates the use of data-driven, off-policy reinforcement learning to control the non-affine yaw dynamics of helicopters [12]. Reinforcement-learning-based approaches have proven effective for tasks such as lane keeping and dense-traffic maneuvering [13]. In contrast to state-filtered disturbance rejection control [14] and multilayer neuroadaptive actor–critic reinforcement learning for disturbed nonlinear systems [15], which rely on disturbance observers and backstepping technique with Lyapunov stability guarantees, the proposed DNDP is model-free and observer-free. The presented Lagrangian dynamics in Section 2 are not used by the controller, and disturbances are compensated implicitly via online minimization of the Bellman residual by the coupled action/critic networks.
Closed-loop stability in DNDP systems is crucial and remains an active area of research [16]. Stability can be achieved by balancing exploration and exploitation processes and using regularization techniques [9,17]. Theoretical analyses of DNDP stability based on Lyapunov criteria provide insights into achieving stability [18].
Despite advances in robotics control, achieving natural and adaptive gait with lower-limb exoskeletons and active prostheses remains challenging. Most commercially available solutions face obvious limitations. Model-based approaches like PID are strongly model-dependent; therefore, inter-subject or temporal parameter variations result in suboptimal gait [19]. Controllers relying on fixed gait patterns lack the flexibility to adapt to personalized motion habits or environmental factors. Recent reviews on reinforcement learning for assistive and rehabilitation robotics [20] highlight that while learning-based methods offer high adaptability, deep RL techniques typically suffer from heavy training burdens, sample inefficiency, and stability uncertainties. Alternatively, adaptive force-based control strategies developed for dynamic legged locomotion [21] and single-network adaptive dynamic programming designs for constrained manipulators [22] demonstrate effective adaptation, but generally require explicit model knowledge or disturbance observers. Some advanced solutions use computationally intensive optimization techniques for individualized trajectory generation [23], but they may lack real-time performance. While adaptive control and machine learning have been explored, implementations rarely leverage online learning to optimize both immediate and long-term control objectives.
The DNDP approach addresses these limitations with coupled neural networks for action and critic online model-free learning based on dynamic programming principles. The research proposed in the present work extends the classical direct torque control with a dynamic optimization loop based on artificial neural networks for gait restoration devices. This approach adapts to the subject’s behavior by continuously learning to minimize a dynamic optimization criteria. The system uses a combination of action and critic neural networks to optimize long-term rewards and generate controls that balance the Bellman equation. The model of a human gait controller adaptively controls the knee and ankle joints and employs sigmoid-based feed-forward networks with two hidden layers for both knee and ankle joints.
The paper is organized as follows. Section 2 presents the dynamic model of a lower-limb prosthetic leg according to Lagrange mechanics. Section 3 details the proposed adaptive critic controller with presentation of the action and critic network structure and tuning rules. Section 4 comments on the stability conditions for the closed-loop system. Section 5 includes a discussion of the simulation results. Section 6 concludes the paper, followed by a dedicated Nomenclature defining the kinematic, dynamic, and neural network notations.

2. Dynamic Model of Lower Limb

The authors use the Lagrangian equation of motion to describe the dynamic characteristics of the prosthetic leg. The formulation provides a general way to model the nonlinear behavior of a mechanical system. The notion of generalized coordinates provides a natural setting for modeling of multi-joint systems, where each joint has an impact on the others. This section presents a derivation of the Lagrangian equations facilitating a nonlinear model for realistic simulation of the prosthetic leg. Note that the derived equations are not explicitly utilized in the control strategy design; therefore, the DNDP controller aims to learn how to compensate for this nonlinear dynamics while achieving tracking performance.
A common approach in gait studies is to model the lower limb as a series of rigid links connected by rotary joints as in Figure 1. It includes rigid links representing the hip, leg, and ankle segments. The joints have a single rotational degree of freedom around the Z axis— θ 1 , θ 2 , and θ 3 , respectively. The translational degrees of freedom for the limb model are along the X and Y axis. Regarding the control architecture, the translational coordinates x and y of the hip origin are prescribed Fourier trajectories, and the hip angle θ 1 is regulated by a fixed inverse-kinematic feedforward law combined with a PD feedback term. The adaptive DNDP action networks generate only the two joint torques τ 2 and τ 3 for the knee and ankle joints. Henceforth, these knee and ankle joints are referred to as the two adaptively controlled joints. Throughout the manuscript, the rotational indices follow the physical order of the kinematic chain, so that index 1 is the hip, index 2 is the knee, and index 3 is the ankle.
Figure 1. Robotic limb diagram. Where θ 1 , θ 2 , and θ 3 are the rotational DoF of the hip, knee, and ankle, respectively, while x and y are translational DoF.
The coordinates of the hip segment origin are denoted as p 0 = ( x , y ) , which are used as a basis to calculate the coordinates of each segment end points based on the current joint angles θ j as
p i = x y + ∑ j = 1 i L j sin θ j − L j cos θ j , i = 1 … 3 .
Here p 1 , p 2 , and p 3 denote the coordinates of the knee, ankle, and toe endpoints, respectively, measured from the hip origin p 0 . The lengths from hip to knee, from knee to ankle, and from ankle to toe are respectively denoted as L 1 , L 2 , and L 3 . Note that coordinates p i uniquely define the configuration of the lower-limb model. Therefore, the velocities of the joints are
v i = x ˙ y ˙ + ∑ j = 1 i L j cos θ j L j sin θ j θ ˙ j
From here, we can write expressions for the kinetic energy for each rigid link consisting of translational and rotational terms. In this work, a lumped-parameter point-mass model is adopted: the equivalent mass of each link is assumed to be concentrated at the link’s distal endpoint p i , so that the self-rotational inertia of the links is not included and only the translational kinetic energy of the concentrated masses is considered.
T i = 1 2 m i x ˙ + ∑ j = 1 i L j θ ˙ j cos θ j 2 + 1 2 m i y ˙ + ∑ j = 1 i L j θ ˙ j sin θ j 2 ,
where m i are the equivalent masses assigned to the rigid links and located at the distal endpoints p i . Also, it can be seen that the potential energy expression will be
V i = m i g y − ∑ j = 1 i L j cos θ j ,
with g being the gravity acceleration constant. From here, we construct the Lagrangian
L = ∑ i = 1 3 T i − V i .
Then the equations of motion are given by the Euler–Lagrange equations for each degree of freedom ξ ∈ { x , y , θ 1 , θ 2 , θ 3 }
∂ ∂ t ∂ ∂ ξ ˙ L − ∂ ∂ ξ L = F ξ ,
where F ξ = ( F x , F y , τ 1 , τ 2 , τ 3 ) T represents the vector of generalized forces. This leads to five coupled second-order differential equations:
m x ¨ + ∑ j = 1 3 M ¯ j L j θ ¨ j cos θ j − θ ˙ j 2 sin θ j = F x ,
m y ¨ + ∑ j = 1 3 M ¯ j L j θ ¨ j sin θ j + θ ˙ j 2 cos θ j = F y − m g ,
∑ j = 1 3 M j k θ ¨ j + ∑ j = 1 3 ∑ l = 1 3 Γ j l k θ ˙ j θ ˙ l + M ¯ k L k x ¨ cos θ k + y ¨ sin θ k +   g M ¯ k L k sin θ k = τ k , k = 1 , 2 , 3 ,
where m = m 1 + m 2 + m 3 . Here
M ¯ j = ∑ i = j 3 m i
denotes the accumulated distal mass carried by joint j, and
M j k = ∑ i = max ( j , k ) 3 m i L j L k cos ( θ j − θ k )
are the symmetric entries of the joint-space inertia matrix; their off-diagonal, angle-difference-dependent terms express the inter-joint inertial coupling induced by the cumulative endpoint definition of (1). The Christoffel coefficients   
Γ j l k = 1 2 ∂ M j k ∂ θ l + ∂ M l k ∂ θ j − ∂ M j l ∂ θ k
then gather the resulting centrifugal and Coriolis terms.
Foot contact forces are calculated using a 2-point foot contact model, with a point contact located at the heel and metatarsal. The contact model calculates the normal force as a function of the penetration depth d, penetration rate d ˙ , material stiffness k 1 , and material damping k 2 . The normal component of the contact force is
F y = k 1 d a + k 2 d ˙
where d = L − y 3 is the surface penetration depth. The damping rate
k 2 = C m i n + C m a x − C m i n D m a x − D m i n ( d − D m i n ) ,
with D m i n ≤ d ≤ D m a x , for some positive constants C m i n , C m a x , D m i n , and D m a x . The gain k 2 saturates when d is outside the interval [ D m i n , D m a x ] . Here, D m i n and D m a x define the penetration depth range for which the damping coefficient is interpolated, with C m i n and C m a x being the corresponding lower and upper bounds of the damping coefficient. The tangential component of the reaction force is
F x = − μ F y sign ( x 3 ) .

3. Adaptive Critic Control

The manuscript introduces the DNDP approach for prosthetic leg control, leveraging two neural networks—action and critic networks—to optimize long-term rewards by approximating the optimal control policy [24]. The system operates in a closed loop, where the action networks propose actions, and the critic networks provide feedback to improve these actions over time. The action network computes the control torque for each joint based on the current kinematic state x θ ( k ) as
τ θ ( k ) = f θ ( x θ ( k ) , p θ ( k ) ) .
Parameters p θ of the action network are updated via gradient descent to minimize a cost function representing the long-term tracking error for joint trajectory expressed as total cost to go [7,25]:
J θ ( k ) = ∑ j = 0 ∞ l ( x θ ( k + j ) , j ) .
This cost is not accessible for explicit calculation because it depends on the infinite future sequence. Therefore, we train the critic network J ˜ θ to approximate J θ as a function of current joint kinematic state
J ˜ θ ( k ) = g θ ( x θ ( k ) , w θ ( k ) ) .
The parameters w θ ( k ) of the cost approximating function are tuned with the goal to minimize approximation error. The tuning of the critic network aims to find a solution to the Bellman equation in the sense that
J ˜ θ ( k ) = J ˜ θ ( k + 1 ) + l ( x θ ( k ) , 0 ) .
The closed-loop control architecture implementing dual adaptive critic controllers for independent knee and ankle joint control in a robotic limb prosthesis is presented in Figure 2. The system consists of three main components: a robotic limb plant with hip, ankle, and knee joints ( θ i ), critic networks ( F K and F A ) that evaluate the system performance, and action networks ( K τ , 2 and K τ , 3 ) that generate control torque signals. The control structure uses precomputed joint reference trajectories r i consistent with experimental gait data [26,27] and compares them with the actual joint angles to compute tracking errors. These errors are processed by the action networks to produce appropriate torque commands ( τ 2 and τ 3 ) for knee and ankle joint actuation. The critic networks continuously evaluate the performance of the action networks and provide feedback signals for their real-time adaptation, enabling the system to optimize the control parameters over time and improve the tracking accuracy. This dual-controller architecture allows for independent yet coordinated control of the knee and ankle joints.
Figure 2. Closed loop diagram.
The hip segment torque is calculated as
τ 1 = f i n v ( r 1 , θ i , x , y ) + u 1 ,
where f i n v is the inverse kinematic function obtained from Equation (9) acting as a feed forward component, while
u 1 = K p , 1 ( r 1 − θ 1 ) + K d , 1 ( r ˙ 1 − θ ˙ 1 )
is a feedback proportional derivative signal. The hip torque τ 1 is not generated by the DNDP; the adaptive action networks produce only the torques τ 2 and τ 3 for the knee and ankle joints, respectively, which constitute the two adaptively controlled degrees of freedom.

3.1. Action Network

The controllers K τ , 2 for the knee joint and K τ , 3 for the ankle joint are parametrized as a 3-layer neural network with 2 hidden layers ( h K , 1 , h K , 2 ) and 1 output linear layer with weights w K such that the torque is
τ 2 = w K F σ V K , 2 F σ V K , 1 x K = w K F σ V K , 2 h K , 1 = w K h K , 2 ,
where
x K = e 2 e ˙ 2 θ 2 θ ˙ 2 T
is the input vector to the knee controller taking tracking error e i = r i − θ i . The weight matrix V K , 1 for the first hidden layer is with dimensions N K , 1 × 4 , such that the number of columns matches the dimension of x K . The activation function F σ , taken as the hyperbolic tangent function, is
F σ ( x ) = tanh 0.5 x = 1 − e − x 1 + e − x ,
applied to each of the N K , 1 components of the V K , 1 x K vector. The parameters of the second hidden layer are given with the matrix V K , 2 , which has dimensions N K , 2 × N K , 1 such that N K , 2 weights are applied over each of the N K , 1 input layer components. The weights of the output layer for the network K τ , 2 are provided in the row vector w K with N K , 2 elements to produce the scalar signal τ 2 .
Analogically, the behavior of the controller K τ , 3 for the ankle joint is described with
τ 3 = w A F σ V A , 2 F σ V A , 1 x A = w A F σ V A , 2 h A , 1 = w A h A , 2 ,
where
x A = e 3 e ˙ 3 θ 3 θ ˙ 3 T ,
and the number of units for the input and hidden layer are N A , 1 and N A , 2 , respectively, specifying the dimensions of the matrices V A , 1 , V A , 2 , and of the output vector w A . Generally the dimensions and values of the weighting matrices for the knee and ankle controller are different and will be tuned separately.
The parameters of the action networks are tuned in real-time to minimize quadratic cost functions J 2 ( k ) and J 3 ( k ) , respectively, for the motion of the knee and ankle joint, at each time instant t = k T S as
τ i k = argmin J i ( τ , k ) ,
where τ i k is the projection of the knee torque signal τ i on the interval t ≥ k T S . The quadratic cost functions are formed from the respective tracking errors and their derivatives with a discounting factor α ≤ 1 , in line with the standard infinite-horizon discounted-cost formulation of dynamic programming and adaptive critic designs [8,25]
J i ( k ) = ∑ j = 0 ∞ 1 2 α j e i 2 ( k + j ) + e ˙ i 2 ( k + j ) .
We look to obtain a parametric approximation J ˜ i ( k , p → ) to be used instead of J i ( k ) , where p → is the vector of 4 N i , 2 2 N i , 1 2 tunable parameters for joint i. We need to guarantee that there exists small enough ϵ such that
| J ˜ i ( k , p → ) − J i ( k ) | < ϵ , for k > k 0 .

3.2. Critic Network

In DNDP, the approximation J ˜ i ( k , p → ) is generated by the critic neural network which in this research is taken as a two-layer network
J ˜ i ( k , p → ) = w J i F σ V J i , 2 F σ V J i , 1 x J i = w J i F σ V J i , 2 h J i , 1 = w J i h J i , 2 , i = 2 , 3
where the input vector to the cost approximation network contains the tracking error e i , angular rotation θ i , and the control signal τ i
x J i = e i e ˙ i θ i θ i ˙ τ i T .
Since (28) can be represented in recursive form as the Bellman equation [25]
J i ( k ) = 1 2 e i 2 ( k ) + e ˙ i 2 ( k ) + α J i ( k + 1 ) ,
in order for J ˜ i ( k , p → ) to approximate J i ( k ) in the sense of (29), J ˜ i ( k , p → ) is necessary to minimize the Bellman error
ϵ k = 1 2 e i 2 ( k ) + e ˙ i 2 ( k ) + α J ˜ i ( k + 1 , p → ) − J ˜ i ( k , p → ) ,
which can be used in the criterion for tuning the weights for the critic network in a criteria
J c = 1 2 ϵ k 2

3.3. Parameter Gradient for Action Network

The procedures for tuning the action and critic network weights depend on the derivative with respect to any scalar parameter p from the vector p →
∂ J ˜ ( k , p → ) ∂ p = ∂ J ˜ ( k , p → ) ∂ τ i ∂ τ i ∂ p ,
where
∂ J ˜ ( k , p → ) ∂ τ i = w J i G σ ( a 1 ) V J i , 2 G σ ( a 2 ) V J i , 1 ∂ x J i ∂ τ i ,
a 1 = V J i , 2 F σ ( a 2 ) , a 2 = V J i , 1 x J i ,
∂ x J i ∂ τ i = 0 0 0 0 1 T ,
and the gradient of the activation function is
G σ ( x ) = d F σ d x = 0.5 ( 1 − F σ 2 ) .
The derivative with respect to the elements of the row vector w are given by the output of the second hidden layer
∂ τ 2 ∂ w K = F σ V K , 2 F σ V K , 1 x K = h K , 2 ,
i.e., the bigger the output of the second hidden layer, the bigger the sensitivity of the final torque command to the respective weight gain tuning.
The derivative of the knee torque with respect to the second hidden layer weights are
∂ τ 2 ∂ V K , 2 = w K G σ V K , 2 h K , 1 h K , 1
The derivative of the knee torque with respect to the first hidden layer weights are
∂ τ 2 ∂ V K , 1 = w K G σ V K , 2 h K , 1 V K , 2 G σ V K , 1 x K x K
Similar expressions can be obtained for the ankle torque sensitivity.
Pay attention that the action-dependent critic input x J i enables the critic-gradient to improve the action network through the chain rule of (35). The critic input x J i of (31) explicitly contains the control signal τ i as its fifth entry, the sensitivity ∂ J ˜ i / ∂ τ i in (36) is nonzero, and its multiplication with the action-network sensitivities ∂ τ i / ∂ p derived above produces the action network parameter gradient g p ( k ) that drives the update of p with (55). The scalar ∂ J ˜ i / ∂ τ i acts as the common critic-based multiplicative error feedback that is distributed over all action-network weights. Note, also, that it is computed through the critic networks only and therefore does not require the leg dynamics or any plant model.

3.4. Parameter Gradient for Critic Network

The derivatives with respect to any parameter p defined for the sample interval k of the critic networks will be
∂ J c ∂ p = ϵ k ∂ ϵ k ∂ p = − ϵ k ∂ J ˜ i ( k , p → ) ∂ p
In particular, for w J i
∂ J ˜ i ∂ w J i = h J i , 2
for V J i , 2
∂ J ˜ i ∂ V J i , 2 = w J i G σ V J i , 2 h J i , 1 h J i , 1
and for V J i , 1
∂ J ˜ i ∂ V J i , 1 = w J i G σ V J i , 2 h J i , 1 V J i , 2 G σ V J i , 1 x J i x J i

3.5. Initial Conditions

Since the network weight adaptation is gradient-based, only a local extremum of the functional can be reached. Therefore, the initial conditions for weights are of primary importance. The closed loop system must run from a stable solution, which is close enough to the reference trajectory. In this research, we manually tune the initial action network weights to behave as a PD controller. For knee action network initial conditions, we set
V K , 1 = I 2 0 2 … … ,
which after multiplication with input x K will produce a vector with blocks ( e 2 , e ˙ 2 ) T ,
V K , 2 = I N K , 2 , N K , 1
to pass through error values from the first hidden layer to output layer, and
w K = k p , 0 k d , 0 k p , 0 k d , 0 …
to apply the actual PD gains k p , 0 and k d , 0 . In result, for the initial knee torque signal we get
τ 2 = N K , 2 2 k p , 0 F σ 2 ( e 2 ) + k d , 0 F σ 2 ( e ˙ 2 )
Here, the notation F σ 2 ( · ) stands for the composition F σ ( F σ ( · ) ) , i.e., the two successive applications of the activation function in the two hidden layers of (22). This composition is applied componentwise, and it is the N K , 2 / 2 occurrences of the gain pairs in (49) that produce the scalar factor N K , 2 / 2 in (50). To see this, note that multiplying the input x K by the block structure of (47) yields a vector composed of N K , 1 / 2 identical blocks ( e 2 , e ˙ 2 ) T . Passing the result through the first activation layer gives the hidden vector h K , 1 with N K , 1 / 2 blocks ( F σ ( e 2 ) , F σ ( e ˙ 2 ) ) T . Since (48) is a rectangular identity matrix I N K , 2 , N K , 1 , V K , 2 h K , 1 retains only the first N K , 2 components, i.e., the first N K , 2 / 2 blocks, and after the second activation the vector h K , 2 contains N K , 2 / 2 blocks ( F σ 2 ( e 2 ) , F σ 2 ( e ˙ 2 ) ) T . Finally, the scalar product with (49) sums the N K , 2 / 2 identical pairs of terms and directly yields (50). Therefore, the initial torque is a bounded monotone function of the tracking error and its derivative, obtained by a double saturation of a linear proportional–derivative law.
To make this claim precise, note that the activation F σ ( x ) in (24) is smooth, odd, and monotonically increasing with F σ ( 0 ) = 0 and F σ ′ ( 0 ) = 0.5 . Consequently, the composition F σ 2 is smooth, odd, and monotone, with F σ 2 ( 0 ) = 0 and
d F σ 2 d x x = 0 = 0.25 .
Hence, in a sufficiently small neighbourhood of the reference, where e 2 and e ˙ 2 are small, (50) reduces to the local linear law
τ 2 ≈ N K , 2 8 k p , 0 e 2 + k d , 0 e ˙ 2 ,
which is exactly the torque of a proportional–derivative controller with effective gains
K P = N K , 2 8 k p , 0 , K D = N K , 2 8 k d , 0 ,
whereas away from the reference, the double saturation bounds the torque magnitude. Thus, the initial action network implements a saturating PD controller, providing a stable and smooth closed-loop start close to the reference trajectory without excessive initial torque.
After this setup, a small Gaussian perturbation is added to all the weights, to guarantee non-degenerate gradients during adaptation. The initial weights of the critic network are sampled from a Gaussian distribution as well.

3.6. Online Adaptation Algorithm

The controllers K τ , 2 and K τ , 3 for the knee and ankle joints are tuned online to minimize the approximate optimal cost-to-go J ˜ i ( k , p → ) with respect to the parameters contained in the matrices w i , V i , 2 , and V i , 1 . And the training of the critic network is with respect to a criterion J c ( ϵ k ) for the parameters contained in the matrices w J i , V J i , 2 , and V J i , 1 . Let p denote any scalar parameters of the weight matrices w i , V i , 2 , V i , 1 , w J i , V J i , 2 , and V J i , 1 . The elementwise parameter gradient g p ( k ) , computed for the action network through the (35) and for the critic network through the (43), is fed into the Adam optimizer with bias-corrected moments
m p ( k ) = β 1 m p ( k − 1 ) + ( 1 − β 1 ) g p ( k ) , v p ( k ) = β 2 v p ( k − 1 ) + ( 1 − β 2 ) g p 2 ( k ) .
The Adam parameter update step is
p ( k + 1 ) = p ( k ) − γ m ^ p ( k ) v ^ p ( k ) + ε , m ^ p = m p 1 − β 1 k , v ^ p = v p 1 − β 2 k ,
with β 1 = 0.9 , β 2 = 0.999 , and ε = 1 × 10 − 8 .
In the implemented algorithm, the squared critic output and the instantaneous quadratic error cost are first smoothed by a first-order exponential filter with constant ρ = 0.9999 :
J ¯ i ( k ) = ρ J ¯ i ( k − 1 ) + ( 1 − ρ ) J ˜ i 2 ( k ) ,
r ¯ i ( k ) = ρ r ¯ i ( k − 1 ) + ( 1 − ρ ) 1 2 e i 2 ( k ) + e ˙ i 2 ( k ) ,
and the Bellman residual used for the online training of the critic networks is formed as
ϵ i ( k ) = r ¯ i ( k ) + α J ¯ i ( k ) − J ¯ i ( k − 1 ) .
The complete online adaptation procedure is summarized in Algorithm 1. The loop is executed at every sampling instant k with step size T s . The plant state is integrated with a fourth-order Runge–Kutta method (RK4). The action networks are frozen during the warm-up interval k w , while the critic networks adapt from the first sample. Every k c samples the instantaneous tracking cost is compared with its best stored value. Here k c = 3000 samples, and k w = k c . If it has not improved, the action and critic weights are pulled 10% toward the stored best configuration, which prevents long-term degradation of the learned policy. An additive exploration noise of amplitude 0.001 is applied to the torque commands to maintain the persistence of excitation required for online identification of the optimal policy.
Algorithm 1 Online adaptation of the DNDP action and critic networks
1.
State integration: integrate the leg dynamics over [ k T s , ( k + 1 ) T s ] with RK4; compute the reference θ i , r e f ( k ) , θ ˙ i , r e f ( k ) and the errors e i ( k ) , e ˙ i ( k ) .
2.
Action network: form x i = ( e i , e ˙ i , θ i , θ ˙ i ) T , compute the torque τ i ( k ) = f i ( x i ( k ) ) + 0.001 η ( k ) , η ∼ N ( 0 , 1 ) .
3.
Critic input: form the action-dependent vector x J i ( k ) = ( e i , e ˙ i , θ i , θ ˙ i , τ i ) T and the critic output J ˜ i ( k , p → ) from (30).
4.
Smoothing: update J ¯ i ( k ) ← ρ J ¯ i ( k − 1 ) + ( 1 − ρ ) J ˜ i 2 ( k , w ) and r ¯ i ( k ) ← ρ r ¯ i ( k − 1 ) + ( 1 − ρ ) 1 2 ( e i 2 ( k ) + e ˙ i 2 ( k ) ) .
5.
Bellman residual: compute ϵ i ( k ) = r ¯ i ( k ) + α J ¯ i ( k ) − J ¯ i ( k − 1 ) , α = 1 .
6.
Critic adaptation (every step): for each critic weight p, compute g p ( k ) via (43) and update with Adam (54) and (55).
7.
Action adaptation (only if k ≥ k w ): for each action weight p, compute g p ( k ) via (35) and update with Adam (54) and (55).
8.
Checkpoint (every k c samples): if the tracking cost over the window exceeded its stored best value, pull all weights 10 % toward the best stored configuration.

4. Stability Analysis

As mentioned in the introduction, there are some important results for analysis of the stability of DNDP systems based on the Lyapunov criteria. However, the determination of appropriate Lyapunov function is mostly case specific. Here we formalize some of our observations on closed-loop stability with the provided controller in the following.
Theorem 1. 
Given a continuous nonlinear system
x ˙ = f ( x , u ) ,
control signal being obtained from a nonlinear feedback law
u = g ( x , p ) ,
adaptive law for tuning the parameter vector p as
p ˙ = − l p ∂ J ∂ p − k p p ,
and given that the closed-loop system is stable for initial parameter values p = p 0 , then there exists an upper bound l p * > l p > 0 for learning rate such that the closed-loop system will remain stable.
Proof of Theorem 1. 
A candidate Lyapunov function is selected as a composite function combining system state energy and parameter error energy
V ( x , p ) = V 1 ( x ) + V 2 ( p )
where V 1 is a positive definite function associated with the system state x and V 2 = 1 2 p T p is a quadratic positive definite function of adaptive parameters. Define the time derivative of V as
V ˙ ( x , p ) = ∂ V 1 ∂ x x ˙ + ∂ V 2 ∂ p p ˙
Given that the initial system is stable, we know:
∂ V 1 ∂ x x ˙ ≤ − α ∥ x ∥ 2
for some positive constant α . Substituting the adaptive law, the stability condition becomes
V ˙ ( x , p ) ≤ − α ∥ x ∥ 2 + p T − l p ∂ J ∂ p − k p p
Let β = max p ∂ J ∂ p . Then
V ˙ ( x , p ) ≤ − α ∥ x ∥ 2 + l p β ∥ p ∥ − k p ∥ p ∥ 2
To ensure V ˙ < 0 , we need:
α ∥ x ∥ 2 + k p ∥ p ∥ 2 > l p β ∥ p ∥
This inequality holds if
l p < α ∥ x ∥ 2 + k p ∥ p ∥ 2 β ∥ p ∥ < min x , p α ∥ x ∥ 2 + k p ∥ p ∥ 2 β ∥ p ∥ = l p *
Therefore, for any l p < l p * , we have V ˙ < 0 , ensuring stability of the closed-loop system.    □
This proof is in line with the intuitive argument that there is a trade-off between adaptation speed and stability, and provides a concrete expression for the upper bound on the learning rate that ensures stability is maintained during adaptation. Such a composite Lyapunov function is standard in adaptive systems analysis, allowing simultaneous consideration of both state stability and parameter convergence [28].
Remark 1. 
The abstract system of Theorem 1 maps directly onto the controller implemented for the prosthetic leg. The feedback law g ( x , p → ) corresponds to the action networks of (22) and (25), which generate the knee and ankle torques τ 2 and τ 3 from the reduced state x = ( e i , e ˙ i , θ i , θ ˙ i ) T . Here, the parameter vector p → collects the elements of the weight matrices of both action and critic networks, through which the online learning signal enters. The continuous adaptive law of the theorem specializes to the discrete Adam update of (54) and (55) applied elementwise, with the per-weight gradient g p computed from (35) for the action networks and from (43) for the critic network. For the bias-corrected Adam step the elementwise bound m ^ p 2 ≤ v ^ p holds, so that each weight is modified by at most the learning rate, | p ( k + 1 ) − p ( k ) | ≤ γ . The regularization term k p p of the theorem plays the role of the checkpoint pull of Algorithm 1, which pulls the weights toward the best stored configuration. The initial stable parameter vector p 0 required by the theorem is provided by the saturating-PD initialization derived in Section 3.5.
Finally, the sufficient condition is corroborated by the simulations of Section 5. The ankle action-network cost decreases by more than four orders of magnitude (Figure 3 and Figure 4), and all closed-loop signals remain bounded over the 1000-cycle evaluation.
Figure 3. Approximated action network cost J ˜ 3 ( k , w ) for the ankle ( θ 3 ) subsystem.
Figure 4. Approximated action network cost J ˜ 2 ( k , w ) for the knee ( θ 2 ) subsystem.

5. Results and Discussion

This section is divided into two main parts. First, we examine the convergence behavior of the action and critic networks for both the knee and ankle joints, providing insights into the learning process and stability of the control system. Then, we focus on the actual performance of the prosthetic leg, comparing initial and final trajectories against reference patterns for joint angles, angular velocities, and torques. Throughout this section, claims of convergence are established and are reported numerically according to (59). We do not claim that the Bellman residual vanishes or that either joint reaches an optimal control law. The two joints are reported separately because their adaptation is markedly asymmetric. Through these analyses, we aim to demonstrate the effectiveness of the proposed direct neural dynamic programming (DNDP) algorithm in optimizing prosthetic leg control and its ability to adapt to individual gait patterns. For compactness in the figures, the knee quantities are additionally denoted with the aliases θ K ≡ θ 2 , θ ˙ K ≡ θ ˙ 2 , τ K ≡ τ 2 , e K ≡ e 2 , J K ≡ J 2 , w K , and V K , whereas the ankle quantities are denoted with the aliases θ A ≡ θ 3 , θ ˙ A ≡ θ ˙ 3 , τ A ≡ τ 3 , e A ≡ e 3 , J A ≡ J 3 , w A , and V A . All joint angles θ 1 , θ 2 , and θ 3 , together with their rates of change, are expressed in radians (rad and rad/s) throughout the manuscript and in all figures.

5.1. Experimental Setup

The simulation environment is MATLAB 2020b, where the prosthetic leg model is implemented as a system of first-order differential equations numerically solved using fourth-order Runge–Kutta integration (rkode45 function) with step size of 0.001 s internally subdivided by 5. The simulation applies the DNDP algorithm to the prosthetic leg model during the calculation of the torques for the knee and ankle joint at each integration step. The trajectories for the joints are generated using Fourier expansion based on reference gait studies. Simulation is performed for 1000 gait cycles corresponding to 987,000 simulation steps (see Table 1 and Table 2).
Table 1. Mechanical and ground contact parameters.
Table 2. Neural network architectures and DNDP hyperparameters.
We emphasize that the present investigation is strictly a numerical simulation study: the joint angles and angular velocities are obtained directly from the numerical integration of the dynamic equations of motion, without physical sensors, state observers, or hardware-in-the-loop apparatus. The controller operates in a model-free manner using these simulated joint states and reference trajectories. Physical sensor selection, sensor noise modeling, and embedded hardware instrumentation are not considered.

5.2. Adaptation Dynamics

To quantify the convergence of quantities of interest q —the two residuals ϵ 2 , ϵ 3 and the twelve network-weight norms normalized by their initial values—we employ the following criteria. The standard deviation σ of q over the final 100 gait cycles must be negligible relative to its full-run excursion,
ρ q = 100 σ t ∈ [ 886 , 986 ] q max t q − min t q ≤ 5 ,
where t is in seconds and the gait period is T G = 0.987 s. Such a criteria asserts only that the recent variability of q is small compared with the total excursion it underwent, i.e., that the algorithm has reached a bounded steady state; it does not require the residual to vanish.
Figure 3 shows the convergence behavior of an action network cost function for ankle control over a 1000 s time period. The cost exhibits a rapid initial decrease from approximately 10 − 3 to 10 − 5 in the first 100 s, followed by several distinct phases of learning. There is a plateau between 200–400 s, after which the cost drops significantly to reach its lowest point of approximately 10 − 9 around 600 s. The system then shows some minor oscillations and a slight increase in cost between 700–900 s, before settling to a final value around 10 − 8 by the end of the simulation. The ankle action-network cost falls from J ˜ 3 = 2.06 × 10 − 3 averaged over the first gait cycle to J ˜ 3 = 5.41 × 10 − 8 averaged over the final gait cycle, a reduction of more than four orders of magnitude ( 99.997 % ). Because this reduction is monotone in the long-term average, the ankle action cost satisfies criterion (59). The rise between 700 and 900 s visible in the figure is a fluctuation about a much lower mean and does not undo it.
Figure 4 illustrates the learning progression of an action network cost function for knee control. The cost function starts at approximately 5.5 and shows a sharp initial drop in the first few seconds, followed by a plateau around 5.0 until about 150 s. After this point, there is a steady downward trend with a few notable characteristics: a steeper descent between 150–300 s, a small fluctuation around 400–500 s, and then a continued gradual decrease until the end of the simulation. The final cost value reaches approximately 3.2 at 1000 s, demonstrating a consistent improvement in the network’s performance over time. The knee action network therefore adapts considerably less strongly than the ankle action network: its cost falls only from J ˜ 2 = 5.78 over the first gait cycle to J ˜ 2 = 4.54 over the final gait cycle, a reduction of 21.4 % against the 99.997 % obtained for the ankle.
Figure 5 displays the Bellman error evolution over a 1000 s period for both ankle and knee critic networks. The ankle critic network exhibits significant initial volatility, reaching a peak error of approximately 0.72 around the 50 s mark, followed by a second smaller peak of 0.3 near 200 s. After these initial oscillations, the ankle error stabilizes around 0.15 with minor fluctuations, though it shows a slight increase between 800–900 s before settling back to its stable value. In contrast, the knee critic network demonstrates remarkably stable behavior throughout the entire training period, maintaining a consistently low Bellman error of approximately 0.08 with minimal variations. We stress that this residual does not vanish. Averaged over the final evaluation window the ankle residual settles at 0.140 and the knee residual at 0.097 , and we make no claim of exact solution of the Bellman equation.
Figure 5. Bellman error ϵ k approximated from the critic networks.
What the two residuals do satisfy is (59), with ρ ϵ 3 = 0.39 % and ρ ϵ 2 = 0.88 % , so each residual is stationary late in the run even though its magnitude persists. The knee residual is roughly one third of the ankle residual throughout, indicating that the knee critic is identified more accurately by the data presented here than the ankle critic. We attribute this asymmetry to the larger ground-contact-induced disturbance acting on the ankle.
Figure 6 shows the relative change in weight norms for the ankle action network— W A (output weights) and two hidden layer weights V A , 1 and V A , 2 . All trajectories start at 1.0 and experience an initial sharp decline around 50 s, reaching a minimum of approximately 0.9975. After this initial dip, the weights recover and stabilize, with W A settling at 1.0 while V A , 1 and V A , 2 show slight oscillatory behavior above 1.0, occasionally reaching peaks of about 1.0005 around 400 and 900 s. Quantitatively, all three action weight norms satisfy (59) with ρ W A = 0.02 % , ρ V A , 1 = 0.38 % and ρ V A , 2 = 0.27 % , i.e., their variability over the final 100 gait cycles is at most 0.38 % of the total excursion they underwent.
Figure 6. Relative change of neural network parameter weights for the ankle action network (controller parameter adaptation, not physical limb mass).
Figure 7 illustrates the relative change in weight norms for the knee action network. While W K and V K , 1 maintain relatively stable values near 1.0 throughout the simulation with minimal fluctuations, V K , 2 exhibits a more dramatic evolution. The V K , 2 trajectory shows a steady decline from 1.0 to approximately 0.995 over the first 300 s, followed by a gradual recovery phase that continues until the end of the simulation, reaching about 0.997. This pattern suggests that while the output weights ( W K ) and first hidden layer weights ( V K , 1 ) quickly stabilize, the second hidden layer weights ( V K , 2 ) undergo more substantial adaptation before settling into their final configuration. All three satisfy (59), with ρ W K = 1.45 % , ρ V K , 1 = 2.27 % and ρ V K , 2 = 2.08 % .
Figure 7. Relative change of neural network parameter weights for the knee action network (controller parameter adaptation, not physical limb mass).
Figure 8 shows the relative change of weights for the ankle critic network. The output layer weights ( W J A ) demonstrate a consistent decrease from 1.0 to nearly 0.1, showing the most significant reduction among all weights. In contrast, the first hidden layer weights ( V J A , 1 ) exhibit a substantial increase, peaking at approximately 2.5 around 700 s before gradually declining to about 2.0 by the end of the simulation. The second hidden layer weights ( V J A , 2 ) maintain relatively stable behavior, fluctuating slightly around 1.0 throughout the entire period with a minor upward trend toward the end, reaching approximately 1.2. According to (59), we calculate ρ W J , A = 2.03 % , ρ V J , A , 1 = 1.65 % and ρ V J , A , 2 = 3.73 % .
Figure 8. Relative change of neural network parameter weights for the ankle critic network.
Figure 9 depicts the relative change of weights for the knee critic network. The output weights ( W J K ) show a stable behavior for the first 100 s at approximately 1.0, followed by a continuous decline to about 0.87 by the end of the simulation. In contrast, the first hidden layer weights ( V J K , 1 ) demonstrate a gradual but steady increase from 1.0 to approximately 1.04 over the entire period. The second hidden layer weights ( V J K , 2 ) remain remarkably stable, maintaining a nearly constant value of 1.0 throughout the simulation with minimal fluctuations. This pattern suggests different adaptation rates and stability characteristics for each weight component within the knee critic network. Quantitatively, ρ W J K = 3.39 % , ρ V J K , 1 = 4.17 % and ρ V J K , 2 = 3.19 % under (59). The 4.17 % obtained for V J K , 1 is the largest value over all twelve weight signals and remains within the 5 % threshold, though with the least margin, so the knee critic first hidden layer is the slowest-settling element of the adaptation.
Figure 9. Relative change of neural network parameter weights for the knee critic network.

5.3. Gait Dynamics

Figure 10 displays the ankle angle trajectories during a complete gait cycle over 2 s. The ankle angle ( θ A ) varies between approximately − 0.2 and 1.5 rad, with two distinct peaks occurring at around 0.2 and 1.4 s, reaching about 1.5 rad. All three trajectories closely align during the peak phases and the minimum points near 1 s, but show slight variations during the plateau phase between 0.4–0.8 s, which is highlighted in the inset magnified view. The reference trajectory maintains a slightly lower angle during these plateau regions compared to both the initial and final conditions, while the final trajectory shows minor improvements in tracking compared to the initial state, particularly during the transition phases.
Figure 10. Ankle angle θ 3 (plotted with the alias θ A ) during gait cycle, expressed in rad.
Figure 11 illustrates the ankle angular velocity ( θ ˙ A ) patterns. The velocity profile shows significant oscillations ranging from approximately − 8 to 7 rad/s, with sharp peaks occurring at regular intervals around 0.4 and 1.4 s. The magnified view highlights a critical transition period between 0.65–0.9 s, where the trajectories show notable differences in their descent patterns. The final trajectory demonstrates improved tracking of the reference signal compared to the initial state, particularly during the mid-stance phase, though some minor deviations persist during the rapid velocity changes.
Figure 11. Ankle angular velocity θ ˙ 3 (plotted with the alias θ ˙ A ) during gait cycle, expressed in rad/s.
Figure 12 shows the knee angle ( θ K ) trajectories. The knee angle oscillates between approximately − 1.0 and 0.5 rad, with two distinct peaks occurring at around 0.2 and 1.4 s. The magnified view focuses on the period between 0.94–1.06 s, revealing the subtle differences between the trajectories during the minimum angle phase, where the initial and final conditions show slightly lower values (around − 0.95 rad) compared to the reference trajectory ( − 0.92 rad). Throughout the cycle, all three trajectories maintain similar patterns, with the final trajectory demonstrating marginally better alignment with the reference signal compared to the initial state, particularly during the descent phases between 0.4–0.8 s and 1.6–2.0 s.
Figure 12. Knee angle θ 2 (plotted with the alias θ K ) during gait cycle, expressed in rad.
Figure 13 displays the knee angular velocity ( θ ˙ K ). The velocity profile exhibits significant oscillations ranging from approximately − 4 to 6 rad/s, with prominent peaks occurring at around 0.2 and 1.4 s. The magnified view focuses on the interval between 1.1–1.3 s, highlighting the differences in peak velocities where both initial and final conditions reach approximately 6.5 rad/s, notably higher than the reference trajectory’s peak of about 6 rad/s. During the mid-stance phase (0.6–0.8 s), there are noticeable discrepancies between the trajectories, with the initial condition showing more pronounced fluctuations compared to the final and reference trajectories.
Figure 13. Knee angular velocity θ ˙ 2 (plotted with the alias θ ˙ K ) during gait cycle, expressed in rad/s.
Figure 14 shows the ankle torque ( τ A ). The torque oscillates between approximately 2 Nm and − 10 Nm, with two major negative peaks occurring at around 0.7 and 1.7 s, reaching about − 9 Nm. The trajectories demonstrate significant differences in amplitude and timing, particularly during the peak negative torque phases, where the final condition shows less extreme values compared to the initial condition. During the positive torque phases (around 0.2–0.4 and 1.2–1.4 s), both conditions maintain similar patterns with peaks of about 1 Nm, though the final trajectory exhibits smoother transitions between positive and negative torques.
Figure 14. Torque at the ankle joint τ 3 (plotted with the alias τ A ).
Figure 15 illustrates the knee torque ( τ K ). The torque values range from approximately − 20 Nm to 15 Nm, with significant differences between the initial and final conditions. The initial trajectory shows more extreme negative peaks around − 18 Nm at 0.7 and 1.7 s, while the final condition demonstrates more moderate negative peaks of about − 5 Nm at similar time points. Notable differences also appear in the positive torque regions, where the final condition reaches higher peaks of approximately 15 Nm compared to the initial condition’s 8 Nm peaks. Again, the final trajectory exhibits smoother transitions and more controlled torque application throughout the gait cycle, consistent with a more settled torque command by the end of the run. We note that the reduction in peak negative torque from about − 18 Nm to about − 5 Nm coincides with the 18.4 % decrease in knee angle tracking error reported above, but the two are not claimed to be causally linked, since the torque figures are single-cycle snapshots rather than a statistical summary.
Figure 15. Torque at the knee joint τ 2 (plotted with the alias τ K ).

5.4. Experimental Patterns Reflecting Lagrangian Dynamics

The experimental results from the manuscript reveal several patterns learned by the action network that reflect dynamic compensations consistent with the underlying principles in the Lagrangian equations of motion.
The time series plots of ankle and knee torque (Figure 14 and Figure 15) show that the learned torques are not simply scaled versions of tracking errors but instead exhibit phase-specific variations. The knee and ankle torques feature distinctive peaks and troughs aligned with critical gait phases (push-off, stance, and swing), matching the periods when gravitational, inertial, or coupling effects (as described by Lagrangian dynamics) are most pronounced.
The action-network costs fall accordingly, from J ˜ 3 = 2.06 × 10 − 3 to 5.41 × 10 − 8 for the ankle and from J ˜ 2 = 5.78 to 4.54 for the knee. The network appears to reduce unnecessary corrective torque in phases where the Lagrangian model predicts passive dynamics should dominate, such as mid-swing, and to reserve larger commands for the phases of high dynamic demand. Because the improvement is strongly asymmetric between the two joints, we present this only as the adaptation trend that the data support, and we do not claim that the network has decomposed the Lagrangian dynamics into identifiable inertial, gravitational, and coupling terms, nor that it has recognized when passive dynamics dominate. Demonstrating either would require comparing the learned torque changes against those terms computed explicitly from the dynamics, which is left to future work.
Experimental plots reveal that compensation is not uniform: for example, during rapid flexion or extension, the network provides higher, precisely-timed torque bursts, which would be necessary to overcome inertial and gravitational terms of the lumped leg model during those transitions. Conversely, during slower or more stable phases, torque commands are much smoother or lower in magnitude, reflecting the compensation for reduced dynamic demands.
Lagrangian equations inherently account for coupling between joints. The experimental results illustrate that as the motion of one joint changes (e.g., during knee flexion), the action network simultaneously modulates the corresponding torque at both knee and ankle, which is consistent with the inter-joint coupling terms retained in the dynamics. We note that a consistent co-modulation is also what any two networks driven by a common gait phase would produce, so this observation is suggestive rather than a demonstration of learned coupling; separating the two would require an ablation in which one joint’s network is held fixed.

5.5. Sensitivity Analysis

The sensitivity analysis in Table 3 examines the sensitivity of the closed-loop performance to the body mass (m) and the hip length ( L 1 ). The examined parameter variations ( ± 20 % in body mass and a − 1 cm variation in hip length) represent realistic uncertainties or adaptation requirements in prosthetic applications. Across the examined variations the controller continues to reproduce the reference gait, with the error norms remaining close to the nominal values, so the closed-loop performance is not critically dependent on the nominal value of either mechanical parameter.
Table 3. DNDP controller performance under varying mechanical parameters.
Increasing the body mass by 20 % leads to a modest increase in the error norms, with the ankle angle error ( ∥ e 3 ∥ ) rising from 1.72 (nominal) to 1.76 and the corresponding ankle angular velocity error ( ∥ e ˙ 3 ∥ ) from 18.69 to 19.65. Reducing the mass by 20 % produces a comparable, slightly larger increase, reaching 2.01 and 21.77, respectively. The knee error norms remain close to the nominal values in both cases, spanning 0.87 – 1.08 for ∥ e 2 ∥ and 10.54 – 13.61 for ∥ e ˙ 2 ∥ , which indicates robustness to moderate mass fluctuations—crucial for real-world scenarios such as clothing or load changes.
Reducing the hip length ( L 1 ) by 1 cm decreases the error norms for both joints: the ankle angle error falls to 0.70 and the ankle angular velocity error to 7.71, while the knee errors fall to 0.75 and 8.36. The shorter leg thus reproduces the reference gait more accurately than the nominal configuration over the evaluated interval, indicating that a modest change in link geometry is accommodated by the same controller without modification.

5.6. Attribution of the Improvement to Online Adaptation

To attribute the improvement to online adaptation rather than to the stabilizing law, we repeated the 1000-cycle protocol with the action networks frozen at their initialization and the perturbation and exploration terms disabled. The resulting controller is exactly the saturating proportional–derivative law of Section 3.5, on the same plant, reference, initial state, and evaluation windows. The root-mean-square tracking error over the final two gait cycles is reported numerically in Table 4 against the frozen PD-like initialization. We see substantial improvement of DNDP compared to PD initialization for ankle angular velocity and knee angle, but also more marginal change for ankle angle and knee velocity.
Table 4. Tracking error and control effort of the adaptive controller against the frozen controller at its initialization.

6. Conclusions

The classical approaches for above-knee amputee prosthetics control are limited to an extent by their reliance on predefined mathematical models and manual fine-tuning to individual preferences. However, human locomotion is a complex and uncertain phenomenon that requires more adaptive solutions. The proposed adaptive neural network design addresses this challenge by embedding the ability for automatic fine-tuning into the control strategy. By updating network weights online to achieve the best fit to walking behavior, either of a non-amputee subject or to match the motion of the healthy limb, the system can adapt to individual variations and changing conditions. On the other hand, the proposed control design should be understood as an extension of the existing classical control approaches, since the adaptive neural controller’s primary goal is to progressively refine the control existing actions calculated by the basic control loops by learning specific motion behaviors of individual amputees.
A key strength of this approach lies in its ability to extract knowledge from accumulated data over time. This feature allows the prosthetic control system to continuously improve and personalize its performance based on the user’s unique gait patterns and preferences. Future research could focus on exploration of different controller architectures and application to more complex prosthetic designs with additional degrees of freedom, incorporating real-time environmental sensing for adaptive terrain navigation, and exploring the integration of user intent recognition for more intuitive control. Additionally, long-term studies on the practical implementation of this system could provide valuable insights into its effectiveness in improving the quality of life for amputees and its potential for broader applications in rehabilitation robotics.

Author Contributions

Conceptualization, J.K.K. and T.N.S.; methodology, J.K.K., T.N.S., A.M., and V.S.; software, J.K.K.; validation, J.K.K. and T.N.S.; formal analysis, J.K.K. and A.M.; investigation, J.K.K.; resources, T.N.S. and V.S.; writing—original draft preparation, J.K.K.; writing—review and editing, T.N.S., A.M., and V.S.; supervision, T.N.S. and V.S.; project administration, T.N.S.; funding acquisition, T.N.S. All authors have read and agreed to the published version of the manuscript.

Funding

This study is financed by the European Union–NextGenerationEU through the National Recovery and Resilience Plan of the Republic of Bulgaria, project no. BG-RRP-2.004-0005.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author due to some of the data is used in the ongoing research and still not ready for full public reveal.

Acknowledgments

The authors would like to thank the Technical University of Sofia for providing the computational resources and support for this research. The authors would like to thank the reviewers for their valuable comments and recommendations.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ADPAdaptive Dynamic Programming
ACDAdaptive Critic Design
CBFControl Barrier Function
DNDPDirect Neural Dynamic Programming
HDPHeuristic Dynamic Programming

Nomenclature

The following symbols and mathematical notations are used in this manuscript:
SymbolDescription
p 0 = ( x , y ) Cartesian coordinates of hip origin
p i = ( x i , y i ) Cartesian endpoint coordinates of link i
L 1 , L 2 , L 3 Lengths of thigh, shank, and foot segments
m 1 , m 2 , m 3 Concentrated masses of the three links
mTotal lower-limb mass ( m 1 + m 2 + m 3 )
M ¯ j Accumulated distal mass carried by joint j
T i , V i Kinetic and potential energy of link i
L System Lagrangian ( ∑ T i − V i )
M ( θ ) Symmetric joint-space inertia matrix
C ( θ , θ ˙ ) Coriolis and centrifugal matrix
G ( θ ) Gravitational torque vector
F x , F y Ground reaction contact forces
θ 1 , θ 2 , θ 3 Hip, knee, and ankle joint angles
θ K , θ A Joint aliases for knee ( θ 2 ) and ankle ( θ 3 )
τ k Applied control torque at joint k
e k , e ˙ k Joint tracking position and velocity error
J k , J ˜ k True and approximated cost-to-go for joint k
r k Instantaneous stage utility for joint k
e c , k Bellman temporal-difference residual
W a , V a Action network output and hidden weight matrices
W c , V c Critic network output and hidden weight matrices
X a , X c Action and critic input state vectors
l a , l c Action and critic nominal learning rates
α Bellman discount factor
γ , ϵ min          Adam base learning rate and epsilon
β 1 , β 2 Adam moment exponential decay rates
Γ j l k Christoffel symbols of the inertia matrix
ξ Generalized coordinates ( x , y , θ 1 , θ 2 , θ 3 ) T

References

  1. Harib, O.; Hereid, A.; Agrawal, A.; Gurriet, T.; Finet, S.; Boeris, G.; Duburcq, A.; Mungai, M.E.; Masselin, M.; Ames, A.D.; et al. Feedback Control of an Exoskeleton for Paraplegics: Toward Robustly Stable, Hands-Free Dynamic Walking. IEEE Control Syst. Mag. 2018, 38, 61–87. [Google Scholar] [CrossRef] [Scilit]
  2. Alibeji, N.A.; Molazadeh, V.; Moore-Clingenpeel, F.; Sharma, N. A Muscle Synergy-Inspired Control Design to Coordinate Functional Electrical Stimulation and a Powered Exoskeleton: Artificial Generation of Synergies to Reduce Input Dimensionality. IEEE Control Syst. Mag. 2018, 38, 35–60. [Google Scholar] [CrossRef] [Scilit]
  3. Alibeji, N.A.; Andrew, K.N.; Nitin, S. A Muscle Synergy-Inspired Adaptive Control Scheme for a Hybrid Walking Neuroprosthesis. Front. Bioeng. Biotechnol. 2015, 3, 203. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  4. Lv, G.; Zhu, H.; Gregg, R.D. On the Design and Control of Highly Backdrivable Lower-Limb Exoskeletons: A Discussion of Past and Ongoing Work. IEEE Control Syst. Mag. 2018, 38, 88–113. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  5. Adamczyk, P.G.; Kuo, A.D. Mechanisms of Gait Asymmetry Due to Push-Off Deficiency in Unilateral Amputees. IEEE Trans. Neural Syst. Rehabil. Eng. 2015, 23, 776–785. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  6. Shu, T.; Shallal, C.; Chun, E.; Shah, A.; Bu, A.; Levine, D.; Yeon, S.H.; Carney, M.; Song, H.; Hsieh, T.-H.; et al. Modulation of Prosthetic Ankle Plantarflexion Through Direct Myoelectric Control of a Subject-Optimized Neuromuscular Model. IEEE Robot. Autom. Lett. 2022, 7, 7620–7627. [Google Scholar] [CrossRef] [Scilit]
  7. Werbos, D. Beyond Regression: New Tools for Prediction and Analysis in the Behavioral Sciences. Ph.D. Thesis, Harvard University, Cambridge, MA, USA, 1977. [Google Scholar]
  8. Sutton, R.S.; Barto, A.G. Reinforcement Learning: An Introduction; MIT Press: Cambridge, MA, USA, 1988. [Google Scholar]
  9. Mnih, V.; Kavukcuoglu, K.; Silver, D.; Rusu, A.A.; Veness, J.; Bellemare, M.G.; Graves, A.; Riedmiller, M.; Fidjeland, A.K.; Ostrovski, G.; et al. Human-Level Control through Deep Reinforcement Learning. Nature 2015, 518, 529–533. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  10. Zhang, D.; Wang, Y.; Meng, L.; Yan, J.; Qin, C. Adaptive Critic Design for Safety-Optimal FTC of Unknown Nonlinear Systems with Asymmetric Constrained-Input. ISA Trans. 2024, 155, 309–318. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  11. Dong, B.; Zhu, X.; An, T.; Jiang, H.; Ma, B. Barrier-Critic-Disturbance Approximate Optimal Control of Nonzero-Sum Differential Games for Modular Robot Manipulators. Neural Netw. 2025, 181, 106880. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  12. Zhang, K.; Luo, S.; Wu, H.-N.; Su, R. Data-Driven Tracking Control for Nonaffine Yaw Channel of Helicopter via Off-Policy Reinforcement Learning. IEEE Trans. Aerosp. Electron. Syst. 2025, 61, 7725–7737. [Google Scholar] [CrossRef] [Scilit]
  13. Zhang, K.; Su, R.; Zhang, H.; Tian, Y. Adaptive Resilient Event-Triggered Control Design of Autonomous Vehicles with an Iterative Single Critic Learning Framework. IEEE Trans. Neural Netw. Learn. Syst. 2021, 32, 5502–5511. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  14. Yang, G. State Filtered Disturbance Rejection Control. Nonlinear Dyn. 2024, 113, 6739–6755. [Google Scholar] [CrossRef] [Scilit]
  15. Yang, G. Multilayer Neuroadaptive Reinforcement Learning of Disturbed Nonlinear Systems via Actor-Critic Mechanism. IEEE Trans. Autom. Sci. Eng. 2026, 23, 1372–1381. [Google Scholar] [CrossRef] [Scilit]
  16. Lu, C.; Si, J.; Xie, X.; Tong, L.; Dankert, J. SVC Supplementary Damping Control Using Direct Neural Dynamic Programming. In Proceedings of the 2004 IEEE International Symposium on Intelligent Control, Taipei, Taiwan, 2–4 September 2004; pp. 270–274. [Google Scholar]
  17. Hinton, G.; Srivastava, N.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R.R. Improving Neural Networks by Preventing Co-Adaptation of Feature Detectors. arXiv 2012, arXiv:1207.0580. [Google Scholar]
  18. Sokolov, Y.; Kozma, R.; Werbos, L.; Werbos, P. Complete Stability Analysis of a Heuristic Approximate Dynamic Programming Control Design. Automatica 2015, 59, 9–18. [Google Scholar] [CrossRef] [Scilit]
  19. Gehlhar, R.; Tucker, M.; Young, A.J.; Ames, A.D. A Review of Current State-of-the-Art Control Methods for Lower-Limb Powered Prostheses. Annu. Rev. Control 2023, 55, 142–164. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  20. Sharifi, M.; Tripathi, S.; Chen, Y.; Zhang, Q.; Tavakoli, M. Reinforcement Learning Methods for Assistive and Rehabilitation Robotic Systems: A Survey. IEEE Trans. Syst. Man Cybern. Syst. 2025, 55, 4534–4551. [Google Scholar] [CrossRef] [Scilit]
  21. Sombolestan, M.; Nguyen, Q. Adaptive-Force-Based Control of Dynamic Legged Locomotion Over Uneven Terrain. IEEE Trans. Robot. 2024, 40, 2462–2477. [Google Scholar] [CrossRef] [Scilit]
  22. Li, B.; Zhan, H.; Zhang, X.; Yang, C. Single-Network Based Adaptive Dynamic Programming Optimal Control for Robotic Manipulator with Joint Limitation Under Input Saturation. Int. J. Syst. Sci. 2024, 55, 3355–3370. [Google Scholar] [CrossRef] [Scilit]
  23. Welker, C.G.; Voloshina, A.S.; Chiu, V.L.; Collins, S.H. Shortcomings of Human-in-the-Loop Optimization of an Ankle-Foot Prosthesis Emulator: A Case Series. R. Soc. Open Sci. 2021, 8, 202020. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  24. Barto, A.G.; Sutton, R.S.; Anderson, C.W. Looking Back on the Actor–Critic Architecture. IEEE Trans. Syst. Man Cybern. Syst. 2021, 51, 40–50. [Google Scholar] [CrossRef] [Scilit]
  25. Bertsekas, D.P.; Tsitsiklis, J.N. Neuro-Dynamic Programming; Athena Scientific: Belmont, MA, USA, 1996. [Google Scholar]
  26. Ziegler, J.; Reiter, A.; Gattringer, H.; Müller, A. Simultaneous Identification of Human Body Model Parameters and Gait Trajectory from 3D Motion Capture Data. Med. Eng. Phys. 2020, 84, 193–202. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  27. Cunado, D.; Nixon, M.S.; Carter, J.N. Automatic Extraction and Description of Human Gait Models for Recognition Purposes. Comput. Vis. Image Underst. 2003, 90, 1–41. [Google Scholar] [CrossRef] [Scilit]
  28. Ioannou, P.A.; Sun, J. Robust Adaptive Control; Dover Books on Electrical Engineering Series; Dover Publications: Mineola, NY, USA, 2012. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.