A Novel Adaptive Controller for Robot Manipulators based on Active Inference
Corrado Pezzato Riccardo Ferrari Carlos Hernandez

Baryon modes in string breaking from gauge/string duality
    Oleg Andreev
    December 30, 2023
=========================================================

empty
empty


More adaptive controllers for robot manipulators are needed, which can deal with large model uncertainties. This paper presents a novel active inference controller (AIC) as an adaptive control scheme for industrial robots. This scheme is easily scalable to high degrees-of-freedom, and it maintains high performance even in the presence of large unmodeled dynamics. The proposed method is based on active inference, a promising neuroscientific theory of the brain, which describes a biologically plausible algorithm for perception and action. In this work, we formulate active inference from a control perspective, deriving a model-free control law which is less sensitive to unmodeled dynamics. The performance and the adaptive properties of the algorithm are compared to a state-of-the-art model reference adaptive controller (MRAC) in an experimental setup with a real 7-DOF robot arm. The results showed that the AIC outperformed the MRAC in terms of adaptability, providing a more general control law. This confirmed the relevance of active inference for robot control. 


Biologically-Inspired Robots, Adaptive Control of Robotic Systems, Industrial Robots, Active Inference, Free-energy Principle




§ INTRODUCTION


Traditional control approaches for industrial manipulators rely on an accurate model of the plant. However, there is an increasing demand in industry for robot controllers that are more flexible and adaptive to run-time variability. Often, robot manipulators are placed in dynamically changing surrounding, and they are subject to noisy sensory input and unexpected events.
In these new applications, obtaining such a model is a major problem. For example, in pick and place tasks, the dynamics of the robot manipulators can change unpredictably while handling unknown objects. Recent research has focused on the use of machine learning methods to obtain accurate inverse dynamic models <cit.>.  In general, learning models using Neural Networks (NN) requires experts for defining the best topology for a particular problem <cit.>.  Even though it is possible to exploit the physical knowledge of the system to simplify and improve the learning performance <cit.>, the need of large amount of training data and several iterations for learning, still remains a problem and hard to generalise <cit.>. Controllers that can dynamically adapt are required, but existing solutions in adaptive control either need an accurate model, or are difficult to tune and scale to higher number of DOFs.
In this paper, we present a novel adaptive controller for robot manipulators, inspired by a recent theory of the brain, which does not require accurate plant dynamics, and that is less sensitive to large parameters variation. 

The proposed control scheme is based on the general free-energy principle proposed by Karl Friston <cit.>, and redefined in engineering terms <cit.>. The main idea at the basis of Friston's neuroscientific theory, is that the brain's cognition and motor control functions could be described in terms of energy minimization. It is supposed <cit.> that humans have a set of sensory data and a specific internal model to characterize how the sensory data could have possibly been generated. Then, given this generative model, the causes of sensory data are inferred. Usually, the environment acts on humans to produce sensory impression, and humans can act on the environment to change it. In this view, the motor control of human body can be considered as the fulfillment of a prior expectation about proprioceptive sensations <cit.>. Although the general active inference framework is mathematically well defined, its application to robotics remains a challenge. Active inference has mainly been applied to neuronal simulations (for handwriting <cit.> for instance), supposing to know the true dynamical process. However, this is not the case in robotics. Even if the neuronal simulations are a strong proof of concept for the neuroscientific theory, in the present form their extension to realistic robotic scenarios <cit.> does not provide advantages over other classical controllers. The main problems are the computational load and the definition of meaningful generative models. With our work we overcome these limitations, using active inference to derive a model-free control law. Instead of modeling the true unknown dynamical process, we define a reference model that active inference has to follow. The main contributions of this paper are twofold:

    
  * Derivation of an online active inference control law for a generic n-DOF robot manipulator in joint space.
    
  * Comparison of the adaptability of the AIC with a state-of-the-art model reference adaptive controller.

The contributions have been experimentally validated in a 7-DOF collaborative industrial manipulator.



 §.§ Related work

At present, the use of active inference for robot control is still limited. In <cit.>, the authors simulated a PR2 robot controlled in Cartesian space for a reaching task. The solution was offline, computationally expensive, open-loop, and it relied on an additional position controller. This makes the approach not suitable for online tasks. A recent MSc thesis <cit.>, based on <cit.>, derived an offline closed-loop scheme of active inference. The feedforward torque commands for a simulated 7-DOF manipulator are computed offline, relying on additional controllers for feedback control. The scheme failed to control the robot in presence of gravity since the feedforward torques did not include the gravitational effect. Both <cit.> and <cit.> were based on the Statistical Parametric Mapping (SPM) by Friston. This toolbox is suitable for several offline applications, but it is too computationally heavy for online control. In <cit.>, each iteration is reported to take about one second. Another recent work <cit.> formalised the use of the free-energy for static state estimation, using a real UR5 robot arm equipped with proprioceptive and visual sensors. Even though the results of the state estimation were promising, no control actions were included. The same authors presented in <cit.> the body estimation and control in the joint space of a simulated 2-DOF robot arm through active inference. This solution included state-of-the art regressors to estimate online the generative models. However, during the simulations, the estimation of the acceleration was unreliable and substituted with the ground truth. Regardless of the fact that only forward dynamics models had to be learned, the authors pointed out how this approach is not simpler compared with classical inverse dynamics techniques.  In a parallel, related work on active inference <cit.>, the authors successfully controlled a real 3-DOF robot arm using velocity commands. In our approach we formulate an AIC for online closed loop control of industrial robots, using low-level torque commands. We also provide a comparison with a state-of-the-art adaptive controller, and insights for design and tuning. On the other hand, the adaptive control branch of control theory <cit.>, offers solutions to deal with manipulators subject to parameters variation and abrupt changes in the dynamics. Within adaptive controllers, two main categories can be identified: the model reference adaptive systems, and the self-tuning regulators <cit.>. The first technique being studied for robot manipulators was the model reference adaptive control (MRAC) <cit.>. The idea behind this technique is to derive a control signal to be applied to the robot actuators which will force the system to behave as specified by a chosen reference model. Furthermore, the adaptation law is designed to guarantee stability using either Lyapunov theory or hyperstability theory <cit.>. The other most common approach for robot control is the self-tuning adaptive control <cit.>. The main difference between this technique and the MRAC is that the self-tuning approach represents the robot as a linear discrete-time model and it estimates online the unknown parameters, substituting them in the control law. Adaptive control of robot manipulators is required in presence of uncertain dynamics and varying payloads, however, the complexity of the controller usually increases with increasing number of DOFs. Among all the possible adaptive controllers, in this paper we choose the MRAC with hyperstability theory <cit.> for comparison. This approach provides adaptability to abrupt changes in the robot dynamics, and it does not require the kinematic or dynamic description of the manipulator, similarly to the AIC. 



 §.§ Paper structure

The paper is organised as follows: In Sec. <ref> we present the free-energy principle and active inference in control engineering terms. In Sec. <ref> we derive a novel AIC for a 7-DOF robot manipulator, and we explain the model assumptions and simplifications. In Sec <ref> the MRAC is presented for comparison. In Sec. <ref> we compare the adaptability of the AIC and MRAC in a simulated pick and place task, validating the results in the real setup. We also discuss the advantages of our AIC and the open questions. Finally, Sec. <ref> provides a summary and directions for future work.



§ THE ACTIVE INFERENCE FRAMEWORK


In this section we report the free-energy principle and active inference from <cit.>, rewriting only the necessary concepts in control terms, to understand the derivation of our novel AIC in Sec. <ref>.


 §.§ The free-energy principle

The free-energy principle is formulated in terms of Bayesian inference <cit.>. In this view, body perception for state estimation is framed using Bayes rule:

    p(x|y) = p(y|x)p( x)/p( y)

where p(x|y) is the probability of being in the n-dimensional state x given the current m-dimensional sensory input y. Instead of exactly inferring the posterior, which often involves intractable integrals, an auxiliary probability distribution r_d( x), called recognition density, is introduced. By minimizing the Kullback-Leibler divergence (D_KL) between the true posterior p(x|y) and r_d( x), the most probable state given a sensory input is inferred <cit.>. D_KL is defined as:

    D_KL(r_d( x)||p(x|y)) = ∫  r_d( x) lnr_d( x)/p(x|y)d x = ℱ+ln p( y)

In the equation above, the scalar ℱ is the so called free-energy. By minimizing ℱ, D_KL is also minimized and the recognition density approaches the true posterior. According to the Laplace approximation <cit.>, the controller only parametrises the sufficient statistics (e.g. mean and variance) of the recognition density. r_d( x) is assumed Gaussian and sharply peaked at its mean value μ. This approximation allows to simplify the expression for ℱ which results:

    ℱ≈ -ln p(μ, y)

The mean μ is the internal belief about the true states x. Minimizing ℱ, the controller is continuously adapting the internal belief μ about the states x based on the current sensory input y. 



 §.§ Free-energy equation

Equation (<ref>) is still general and it has to be further specified to numerically evaluate ℱ. To do so, the joint probability p(μ, y) has to be defined. This is done by introducing two generative models, one to predict the sensory data y, according to the current belief μ, and another to describe the dynamics of the evolution of the belief μ.  


  §.§.§ Generative model of the sensory data

The sensory data is modeled using the following expression <cit.>:

    y =  g(μ) + z

where g(μ) represents the non-linear mapping between sensory data and states of the environment, and z is Gaussian noise z ∼ ( 0,Σ_y). The covariance matrix Σ_y also represents the controller's confidence about each sensory input. 


  §.§.§ Generative model of the state dynamics

In presence of time varying states x, the controller has to encode a dynamic generative model of the evolution μ' of the belief μ. This generative model is defined as<cit.>:

    dμ/dt=μ' = f(μ)+w
 
where f is a generative function dependant on the belief about the states μ and w is Gaussian noise w ∼ ( 0,Σ_μ).


  §.§.§ Generalised motions

To describe the dynamics of the states, or better the belief about these dynamics, we have to introduce the concept of generalised motions <cit.>. Generalised motions are used to represent the states of a dynamical system, using increasingly higher order derivatives of the states of the system itself. They apply to sensory inputs as well, meaning that the generalised motions of a position measurement, for example, correspond to its higher order temporal derivatives (velocity, acceleration, and so on). The use of generalised motions allows a more accurate description of the system's states. More precisely, the generalised motions μ̃ of the belief under local linearity assumptions <cit.> are, up to the second order:

    μ '    =   μ^(1) =f(μ)+w
    μ”   =   μ^(2) = ∂f/∂μμ '+w'

In general, we indicate the generalised motions of the states up to order n_d[Generalised motions can extend up to infinite order but the noise at high orders is predominant, thus we can limit the chosen order to n_d <cit.>.] as μ̃ = [μ, μ', μ”, μ”', ..., μ^(n_d)].

Similarly, the generalised motions of the sensory input are:

    y   =   y^(0) = g(μ)+z
    y '   =   y^(1) = ∂g/∂μμ '+z'

We indicate the generalised motions of the sensory input up to order n_d as ỹ = [ y,  y',  y”,  y”', ...,  y^(n_d)].


  §.§.§ General free-energy expression
 
With the extra theoretical knowledge about the generalised motions, we can define an expression for the free-energy for a multivariate case in a dynamically changing environment:

    ℱ = -lnp(μ̃,ỹ)


The joint probability p(μ̃,ỹ) has to be specified. According to <cit.> and to the definitions previously given, the noise at each dynamical order is considered uncorrelated. Then, according to the generalised sensory input, the sensory data at a particular order relates only with the states at the same dynamical order. Similarly, for the state dynamics, the state at a certain dynamical order are related only with those which are one order below. Then, using the chain rule, it results:

    p(μ̃,ỹ) = ∏_i=0^n_d-1p( y^(i)|μ^(i))p(μ^(i+1)|μ^(i))

Using the Laplace assumption, and thus considering Gaussian distributed probability densities, we can write:

    p(μ^(i+1)|μ^(i))= 1/|Σ_μ^(i)|√(2π)exp{-1/2ε_μ^(i)⊤Σ^-1_μ^(i)ε_μ^(i)}
       p( y^(i)|μ^(i))= 1/|Σ_y^(i)|√(2π)exp{-1/2ε_y^(i)⊤Σ^-1_y^(i)ε_y^(i)}

where ε_y^(i)=(y^(i)-g^(i)(μ)) and ε_μ^(i)=(μ^(i+1)-f^(i)(μ)) are respectively the sensory and state model prediction errors. Furthermore it holds:

    g^(i)=∂g/∂μμ^(i), f^(i)=∂f/∂μμ^(i), g^(0)=  g, f^(0)=  f

Substituting (<ref>) in (<ref>) leads to:

    ℱ = -∑_i=0^n_d-1[lnp( y^(i)|μ^(i))+lnp(μ^(i+1)|μ^(i))]

Finally, according to (<ref>), ℱ can be expressed up to a constant as a weighted sum of squared prediction errors:

    ℱ = 1/2∑_i=0^n_d-1[ ε_y^(i)⊤Σ^-1_y^(i)ε_y^(i)+ε_μ^(i)⊤Σ^-1_μ^(i)ε_μ^(i)]+K

where n_d is the number of generalised motions chosen and K is a constant term resulting from the substitution. The minimisation of this expression can be done by refining the internal belief, thus performing state estimation, but also computing the control actions to fulfill the prior expectations and achieve a desired motion. The constant term K is neglected in the sequel since it plays no role into the minimisation problem. The next two subsections describe the approach proposed by Friston <cit.> to minimise ℱ, using gradient descent. 



 §.§ Belief update for state estimation

The belief update law for state estimation is determined from the gradient of the free-energy, with respect to each generalised motion <cit.>:

    μ̇̃̇ = d/dtμ̃ -κ_μ∂ℱ/∂μ̃

The learning rate κ_μ, can be seen from a control perspective as a tuning parameter for the state update. 


 §.§ Control actions

In the free-energy principle the control actions play a fundamental role in the minimisation process. In fact, the control input u allows to steer the system to a desired state while minimising the prediction errors in ℱ. This is done using gradient descent. Since the free-energy is not a function of the control actions directly, but the actions u can influence ℱ by modifying the sensory input, we can write <cit.>:

    ∂ℱ(μ̃,ỹ(u) )/∂u=∂ỹ(u)/∂u∂ℱ(μ̃,y(u) )/∂ỹ(u)

Dropping the dependencies for a more compact notation, the dynamics of the control actions can be written as:

    u̇=-κ_a∂ỹ/∂u∂ℱ/∂ỹ

where κ_a is the tuning parameter to be chosen. 


§ ROBOT ARM CONTROL WITH ACTIVE INFERENCE


In this section we derive the first model-free, computationally lightweight, online torque controller for joint space control using active inference. The established theory of Sec. <ref> is adapted to define a novel control scheme for a generic n-DOF manipulator. The challenging problem of finding suitable generative models f(·) and g(·), and the relation ∂ỹ/∂u in such a complex scenario is solved.


  §.§.§ Assumption 1
  The robot manipulator is equipped with position and velocity sensors, which respectively provide the two variables y_q,  y_q̇∈ℝ^n.


  §.§.§ Assumption 2
 Since only the position and velocity measurements are available, we will consider the generalised motions up to order two, so n_d=2. 













  §.§.§ Assumption 3
 The Gaussian noise affecting the different sensory channels is supposed uncorrelated <cit.>. The covariance matrices for sensory input and state belief are:

    Σ_y^(0) = σ_q I_n, Σ_y^(1) = σ_q̇ I_n,
    Σ_μ^(0) = σ_μ I_n, Σ_μ^(1) = σ_μ'I_n

where we supposed that the controller associates four different variances to describe its confidence about sensory input and internal belief. 


  §.§.§ Assumption 4
 The states of the environment x are set as the joint positions of the robot arm. Doing so, we can control the robot arm in joint space through free-energy minimization, and simplify the equations for states update and control actions.


 §.§ Generative models and ℱ for a robot manipulator

In order to numerically evaluate the free-energy as in (<ref>), the two functions g(μ) and f(μ) have to be chosen. 


  §.§.§ Generative model of the sensory data

g(μ) indicates the relation between the sensed values and the states. Since we chose the states to be the joint positions and the sensory data provides directly the noisy values y_q and y_q̇, it holds:

    g_q(μ) = μ, ∂g_q/∂μ = 1



  §.§.§ Dynamic generative model of the world
 Instead of modelling the true dynamics of the manipulator, we propose to define a reference model to specify the desired behaviour of the robot <cit.>. In particular, the world dynamics are chosen such that the robot is steered to a desired position μ_d. In other words, the controller believes that the states will evolve in such a way that they will reach the goal μ_d with the dynamics of a first order system with unitary time constant: 

    f(μ) = μ_d-μ

The value μ_d is a constant ∈ℝ^n corresponding to the desired set-point for the joints of the manipulator. Substituting (<ref>) and (<ref>) in (<ref>) and  (<ref>), it results:

    μ '     = μ_d-μ+w
    μ”    = -μ '+w'
     y_q     = μ+z
     y_q̇    =  μ'+z'
 
According to (<ref>) and (<ref>), the free-energy expression for a generic robot manipulator under the assumptions given is:

    ℱ   =   1/2(y_q-μ)^⊤Σ_y^(0)^-1(y_q-μ)
       +   1/2( y_q̇-μ')^⊤Σ_y^(1)^-1( y_q̇-μ')
       +   1/2(μ'+μ-μ_d)^⊤Σ_μ^(0)^-1(μ'+μ-μ_d)
       +   1/2(μ”+μ')^⊤Σ_μ^(1)^-1(μ”+μ')



 §.§ Belief update and state estimation for a manipulator

According to the free-energy principle, the states of the robot manipulator can be estimated using a gradient descent scheme. Applying (<ref>), having defined ℱ as in (<ref>), leads to the following state update law:

    μ̇   =   μ'+κ_μΣ_y^(0)^-1(y_q-μ)-κ_μΣ_μ^(0)^-1(μ'+μ-μ_d)
    μ̇'	   =   μ”+κ_μΣ_y^(1)^-1( y_q̇-μ')-κ_μΣ_μ^(0)^-1(μ'+μ-μ_d)
       -   κ_μΣ_μ^(1)^-1(μ”+μ')
    μ̇”   =    -κ_μΣ_μ^(1)^-1(μ”+μ')

Note that κ_μ is the tuning parameter for state estimation.


 §.§ Control actions for a robot manipulator

The final step in order to be able to steer the joints of a robot manipulator to a desired value μ_d, is the definition of the control actions. 


  §.§.§ General considerations

The general actions update is expressed by (<ref>). The partial derivatives of (<ref>) with respect to the generalised sensory input are given by:

    ∂ℱ/∂y_q = Σ_y^(0)^-1(y_q-μ),∂ℱ/∂ y_q̇ = Σ_y^(1)^-1( y_q̇-μ')
 
Having said that, the actions update is expressed as:

    u̇=-κ_a[ ∂ y_q/∂ uΣ_y^(0)^-1(y_q-μ)+∂ y_q̇/∂ uΣ_y^(1)^-1( y_q̇-μ') ]

Active inference requires then to define the change in the sensory input with respect to the control actions, namely ∂ y_q/∂ u and ∂ y_q̇/∂ u. This is usually a hard forward dynamic problem, which constituted a major complication in past control strategies. One approach to compute these relations is through online learning using high-dimensional space regressors. However, this increases the complexity of the overall scheme and can produce unreliable results, as shown by the authors in <cit.>. In this paper we propose to approximate the partial derivatives relying on the high adaptability of the active inference controller against unmodeled dynamics, as suggested in the conclusive remarks in <cit.>. 


  §.§.§ Approximation of the true relation between u and ỹ
 Let us first analyse the structure of the partial derivative matrices in (<ref>). The control action is a vector of n torques applied to the n joints of the robot manipulator. Each torque has a direct effect only on the corresponding joint to which it is applied. This allows us to conclude that ∂ y_q/∂ u and ∂ y_q̇/∂ u are diagonal matrices.  Furthermore, considering the second Newton's law, the total torque applied to a rotational joint equals the moment of inertia times the angular acceleration. The diagonal terms of the partial derivatives matrices are then time varying positive values which depend on the current robot configuration. In other words, this means that a positive torque applied to a joint will always result in a positive contribution for both position and velocity of that specific joint. In this control scheme we propose to approximate the true positive time-varying relation with a positive constant, making use of the learning rate κ_a as tuning parameter to achieve a sufficiently fast actions update. The control update law is finally given by:

    u̇=-κ_a[ C_qΣ_y^(0)^-1(y_q-μ)+C_q̇Σ_y^(1)^-1( y_q̇-μ') ]


    ∂ y_q/∂ u≈ C_q,∂ y_q̇/∂ u≈ C_q̇

The positive definite diagonal constant matrices C_q, C_q̇ are then set to the identity, meaning that we only encode the sign of the relation between u and the change in ỹ.


  §.§.§ Tuning parameters AIC
 The tuning parameters for the active inference controller are: 

    
  * σ_q, σ_q̇ , σ_μ, σ_μ': the standard deviations representing the confidence of the controller regarding its sensory input and internal belief about the states;
    
  * κ_μ, κ_a: the learning rates for state update and control actions respectively.

Algorithm <ref> reports the pseudo-code of our AIC. For state and actions update, first-order Euler integration is used.




§ MODEL REFERENCE ADAPTIVE CONTROLLER


The controller chosen for comparison is an MRAC. This adaptive controller allows to obtain decoupled joint dynamics, forcing every single joint i=1,...,n to respond as a second order linear system with transfer function:

    G_i(s)=ω_i^2/s^2+2ζω_is+ω_i^2q_ri(s)

The control architecture is taken from <cit.>, where the control is specified in terms of feedforward and feedback adaptive gain matrices. These time-varying gain matrices are adjusted by means of adaptation laws to guarantee closed loop stability in case of large parameters perturbations. Supposing zero initial conditions for the gains, and neglecting the derivative terms as described in <cit.>, it holds:

    K_0(t)   =    E_01q̅_e(t) q(t)^⊤+E_02∫_0^Tq̅_e(τ)q(τ)dτ
    
    	K_1(t)   =   E_11q̅_e(t)q̇(t)^⊤+E_12∫_0^Tq̅_e(τ)q̇(τ)dτ
    
    	Q_0(t)   =   F_01q̅_e(t) q_r(t)^⊤+F_02∫_0^Tq̅_e(τ) q_r(τ)dτ
    
    	Q_1(t)   =   F_11q̅_e(t)q̇_r(t)^⊤+F_12∫_0^Tq̅_e(τ)q̇_r(τ)dτ
    
    	f(t)   =   α_1q̅_e(t)+α_2∫_0^Tq̅_e(τ)dτ

The variables q_r and q̇_r are the desired references to track. The diagonal matrices E_jk and F_jk ∈ℝ^n× n, and the vector α_k ∈ℝ^n with j={0,1} and k={1,2}, are the tuning parameters for the proportional-integral adaptation law. 
The term q̅_e is called modified joint angle error vector <cit.>:

    q̅_e = P_2[ q_r(t)- q(t)]+P3[q̇_r(t)-q̇(t)]

with P2 and P3 diagonal weighting matrices. The MRAC, similarly to the AIC, does not need the dynamic description of the robot manipulator, and it is scalable to high DOF. However, the number of the tuning parameters increases with the degrees of freedom, unlike for the AIC. 



§ EXPERIMENTAL EVALUATION


The adaptive properties of AIC and MRAC are now compared: The controllers are tuned in simulation using an approximated model of the robot, and then transferred to the real system.  The tests performed are based on a pick and place cycle using the Franka Emika Panda 7-DOF robot manipulator, as in Fig. <ref>, with different payloads.



 §.§ Remarks about the tuning procedure for the controllers

Before presenting the simulations and experimental results, we provide some observations regarding the number of parameters and the different tuning procedures for the AIC and MRAC.


  §.§.§ Number of tuning parameters

The number of tuning parameters for the MRAC equals the number of DOFs times the number of weighting terms. According to Sec. <ref>, this results in 17× n parameters to be tuned. Regarding the AIC, instead, the number of tuning parameters is independent from the DOFs and it equals 6, following the formulation presented in Sec. <ref>. The lower number of parameters resulted in an overall easier tuning procedure for the active inference controller. 
As a final remark, to modify the behaviour of the step response for the AIC, such as rise time and settling time, one should change the internal reference model f(μ) instead of fine tuning the controller's parameters. 



  §.§.§ AIC tuning procedure

To obtain a satisfactory response for the AIC, we performed the following steps: 1) We set the controller confidence about sensory input and internal belief to one; 2) We disabled the control actions and incremented the learning rate κ_μ until the state estimation in a static situation was fast enough; 3)  We included the control actions and increased the learning rate κ_a until the robot was steered to the desired position, showing significant oscillations; 4) We dampened the oscillatory behaviour decreasing the sensory confidence about the most noisy sensors and the internal belief about velocities. 


 §.§ Simulations with approximated model

The performance of AIC and MRAC in simulation are now presented. The task is a pick and place cycle where the desired joint values are chosen such that the arm simulates the pick and place of an object from one bin to the other, positioning the end-effector in A, B or C, see Fig <ref>. This is achieved giving every 6 [s] a set-point in joint space following the sequence: q_A, q_B, q_C, q_B, q_A, where:

    
  * q_A=[1, 0.5, 0, -2, 0, 2.5, 0] [rad]
    
  * q_B=[0, 0.2, 0, -1, 0, 1.2, 0] [rad]
    
  * q_C=[-1, 0.5, 0, -1.2, 0, 1.6, 0] [rad]

The controllers have been tuned using a considerably inaccurate model of the robot arm on purpose. The links have been approximated as cuboids, and 20% random uncertainty in each link's mass has been assumed. This will allow to evaluate later on the adaptability performance while applying the controllers to the real manipulator. The joint values and control actions using AIC and MRAC, are depicted in Fig. <ref>. Note that, for the MRAC, saturation of the control input at ± 85Nm is reached for some of the joints, after providing the new goal position. 





 §.§ Experiments on the real setup

The same controllers tuned in simulation using the approximated model of the 7-DOF robot arm are now applied to control the real manipulator. Two tests are performed: first, the pick and place cycle of the previous section is repeated in the real robot, without re-tuning the controllers. Second, the AIC and MRAC are re-tuned in the real robot and used to pick and place different objects.  The real setup is controlled using a standard laptop running Ubuntu 16.04 with RT kernel, 8-cores Intel i7-4710MQ 2.50GHz.



  §.§.§ Pick and place cycle on the real robot

We applied the MRAC and AIC from simulation to the real 7-DOF Franka Emika Panda. It is important to notice that, besides having different physical parameters, the real setup is already gravity compensated. The AIC and MRAC are simply applied on top of this intrinsic controller. This is already a considerable change in the system's dynamics, but to further increase the level of uncertainties, an end-effector is attached to the robot. From a modeling point of view, the system used for tuning the controllers in simulation is completely different from the real one. Usually, a controller tuned in simulation will not directly work on a real setup, especially if the initial model was not accurate. This was indeed the case for the MRAC which, when transferred to the real robot, could not control the setup leading to an immediate safety stop. Nonetheless, this was not the case for our novel AIC: its strong capabilities to cope with unmodeled dynamics allowed to transfer the controller from the simulation to the real setup without re-tuning. For clarity, we only report the response of the AIC during the initial part of the pick and place cycle (q_B → q_A → q_B) in Fig. <ref>. Joint 7 is not reported to limit redundant information, since no motion was required. As can be seen the AIC can successfully control the manipulator, however, the effect of the large uncertainties introduced for the tuning, resulted in some initial jittering, especially in joint 6[ ]. In other words, the AIC tuned in simulation resulted too aggressive for the real robot. This is because in simulation the AIC had to compensate also for gravity, thus a faster torque update was required. The learning rate κ_a is the same for every joint but the jittering effect is mostly visible in joint 6. This is because in the last part of the kinematic chain, the resulting inertia acting on a joint is lower, and so it is its reluctance to changes in velocities.     
To completely remove the jittering, one can simply reduce the learning rate κ_a to lower the torque update rate. The AIC and MRAC have been tested against large external disturbances such as a human pushing the robot during motion. AIC resulted more compliant than MRAC, showing at the same time a faster and less oscillatory disturbance rejection.


  §.§.§ Pick and place with different payloads


In order to use the MRAC on the real robot, a severe re-tuning of 63 parameters had to be performed, to stabilise the response due to the large unmodeled dynamics. For the AIC, κ_a has been reduced to eliminate the jittering, as well as σ_q, σ_q̇ to give more importance to the measurements and further reduce oscillations. The two controllers are used to perform a pick and place of an almost empty water bottle (≈ 0.1 [kg]) and a full water bottle (≈ 0.7 [kg]), as in Fig. <ref>. In Fig. <ref>A we show the responses of AIC and MRAC in case of the almost empty bottle, during lifting and placing. As can be seen, the AIC presents a faster convergence to the set-point, as well as smoother trajectories with less oscillations. To achieve a satisfactory response, we had to increase the stiffness of the MRAC, while the AIC could be kept compliant. Furthermore, in Fig. <ref>B we show the difference of the trajectories in joint space between the case with empty and full bottle, considering lifting, placing and releasing. Both controllers adapt to the heavier payload, making the trajectory converge to the one with lightweight bottle. AIC behaves similarly to the MRAC, yet it presents considerably less oscillations which reflected in smoother placing of the heavy object. The bigger error appearing at around 16 [s] is due to the releasing of the heavy object. The effect is more visible in the AIC since the robot is more compliant. In a sense, the AIC behaves similarly to a human arm, when an unexpected weight is dropped. This is an additional evidence of the bio-inspired character of the controller. The AIC can also be tuned to be stiffer if this effect is not desired.


 §.§ Discussion and implementation notes

Our novel AIC showed high adaptability, allowing to transfer from simulation to real robot without re-tuning. Furthermore, the AIC showed superior performance with respect to the MRAC in pick and place scenarios. The AIC is compliant while allowing to compensate for large perturbations. However, even though there is a strong evidence of stability and robustness of the AIC for a complex non-linear system, finding a formal stability proof is still an open question. Similarly to a linear case, one should determine a set of learning rates which guarantees convergence. Intuitively, active inference is a gradient descent on a quadratic and convex function thus, for some set of learning rates, the algorithm should converge to the global minima. A possible approach to a formal proof is to use Lyapunov theory as for the back-propagation algorithm in neural networks. Active inference is, in a sense, back-propagating the sensitivity of the control input with respect to the free-energy, to minimise ℱ. Properly addressing this proof mathematically would require a deep analysis which is out of the scope of the current paper. Another remark relates to the computational load of AIC. According to Algorithm <ref>, our novel AIC has a computational complexity of 𝒪(n) where n is the number of DOFs. Given the structure of the generative models and covariance matrices chosen, the AIC reduces to 16 sums of vectors and 15 scalar-vector multiplications with n-dimensional vectors. On the other hand, the complexity of the MRAC is 𝒪(n^3). Another optimised computed torque algorithm such as LGP <cit.>, which relies on learning dynamical models, has a cost of 𝒪(N^2) for online learning, where N is the number of data points (i.e. N≈ 300). Finally, the Franka Emika Panda requires the control signals to be ready within 300 [μ s] to guarantee a functioning frequency of 1 [kHz]: Our AIC can perform at such a high loop rate without any package loss; is straightforward to implement; and extremely simple to tune. The source code for simulations[] and experiments[] is freely available on GitHub.



§ CONCLUSION


In  this paper  we  derived  the  first active inference torque controller for online joint space control of robot manipulators. Our approach makes use of the alleged adaptability of active inference, to introduce simplifications for the generative models, obtaining a model-free scheme which is less sensitive to unmodeled dynamics, is easily scalable to high DOF and is computationally inexpensive. With the proposed controller structure we overcame the complexity barrier of previous approaches, making possible control loops at high frequency with active inference. Simulations and experiments in a real setup with a 7-DOF robot arm showed that our AIC is suitable for tasks in which the dynamic model of the plant is unknown or subject to large changes. The performance of our novel AIC has been compared with that of a state-of-the-art MRAC, in different pick and place scenarios. The AIC shows better adaptability properties, allowing to transfer from simulation to real setup without re-tuning. In addition, the AIC resulted easier to tune and implement. With this work we confirmed the value of active inference to develop more adaptive control of robot manipulators. This is only the first step in this direction, future work should proof the closed-loop stability of active inference, define generative models to account for dynamic requirements and motion constraints, and be extended to other control modalities, such as control in Cartesian space or impedance control.




§ ACKNOWLEDGMENT

The authors would like to thank Prof. Dr. Martijn Wisse for the helpful discussions, together with the whole group working on active inference at the Cognitive Robotics department.

IEEEtran


