Bayesian Optimisation of SLIP Model Parameters
EN4062/ENT794 Coursework 2023
Short Description
The Spring Loaded Inverted Pendulum (SLIP) gait model can be characterised by various parameters, including spring stiffness, the mass of the robot, touchdown angle and leg length. Tuning the parameters can be time-consuming and Bayesian Optimisation provides an efficient way of finding the optimal gait parameters. In this package, we will explore different properties of the SLIP gait model and how to find the optimal solution for the gait motions.
List of scripts and functions
PIease take a Iook on each function (.m’ fiIes with their description. Try to open the fiIes in MatIab program to see the comments and description of each lines.
BayesianOptimisationDemo1D.m - Script. for demonstration of Bayesian Optimisation in 1 dimension on a simple known function. The optimisation process is displayed in a figure.
BO.m - Main script to run Bayesian Optimisation of the SLIP model parameters. The parameters to optimise and the corresponding search ranges are defined in the script. The optimisation process and results are stored in *.mat files.
SLIP_model.m - Function that describes the dynamics of SLIP model. The arguments of the function are the parameters of the model. The function returns the motion data and the performance of the model.
getNextSample.m - Function that returns the next sampling point to maximise improvement of specified amount. The function argument is the Gaussian Processes Regression through existing sampling points.
results.m - The main function for displaying the optimisation results of any existing optimisation process. This includes a figure with colour map for parameters and a corresponding fitness function. A set of parameters and disturbance in initial conditions can be chosen to show animation and phase plot of the corresponding model.
animation.m - Function to animate the motion of SLIP model with specified parameters
phaseplot.m - Function to display phase plot of the SLIP model (ground height vs. velocity vector direction of the robot)
Bayesian Optimisation
Bayesian Optimisation is an optimisation method which minimises the number of sampling points required to find the maximum of the objective function. Gaussian process regression with the best-fitting Kernel parameters is found and fit through sampled points as described in [1]. For each point in the argument space, the expected mean and standard error from the expected mean are found. The expected mean and error data is then used to obtain the acquisition function which is then used to find the point where to sample next. [2]
Figure 1 shows how the sampled data of a function can be modelled as Gaussian process and the calculated threshold. The plot below shows the probability that the value of the function is above the specified threshold. The next sampling point is chosen at the point where the probability is the highest.
Figure 1. Bayesian Optimisation with the objective function to be maximised above and the corresponding acquisition function below
Figure 2. SLIP model gait patterns with transitions between phases. (a) walking, (b) skipping, (c) running
SLIP model
The spring Loaded Inverted Pendulum (SLIP) gait model is one of the simplest bipedal gait models. It consists of a point mass with mass m connected to two weightless springs with stiffness k and uncompressed length l0 . The point mass is constrained to move in the sagittal plane. The motion of model can be described with three phases, each characterised with a different system of differential equations: (a) double stance phase – both legs are in contact with ground, (b) single stance phase – one leg is in contact with ground, the other leg is in swing, and (c) flight phase – neither of the legs is in contact with ground and the point mass in free motion. In this model, the impacts are considered to be completely elastic and springs have no damping. Therefore, the model conserves energy throughout the motion.
Hooke’s law and Newton’s 3rd law yield to set of differential equations for each phase with first support point at (0 ,0) (if applicable), second support point at (x0,0) (if applicable) and the point mass at (x ,y).
Flight phase:
Single stance phase:
Double stance phase:
The transitions between phases are either landings or take-offs. Landing occurs when the height of the mass gets smaller than the height determined by touchdown angle and leg length. Take-off occurs when the distance between support and the mass gets larger than the uncompressed spring length.
Two simplest gait patterns that can be identified are the running and the walking gait, first described in [3]. In walking gait single stance phase alternates with double stance phase. In running gait single stance phase alters with flight phase. The values of touchdown angle, spring stiffness and the total internal energy that provide stable gait patterns were first described in [4]. In addition, there are different skipping gait patterns where walking and running alternate with each other. For humans, running and walking are most prevalent gait patterns but in certain environments skipping could be preferred as described in [5]. The provided MATLAB code permits changing between all three phases: double stance, single stance and flight. Therefore, the gait with optimised parameters could be either walking, running or skipping depending on the initial conditions provided by user. Different stable limit cycles for running, walking and skipping were recorded and these can be found in limitcycles folder along with the respective phase plots and animations.
The parameters that are varied during optimisation are the spring stiffness, touchdown angle while walking and touchdown angle when running. Leg length and the mass of the robot are considered to be constant due to dimensional analysis.
During optimisation processes the performance of the model with specified parameters is assessed. The best characterisation of the performance was concluded to be the distance covered before losing stability, however different fitness functions could be used (e.g. number of steps or time before losing stability). The chosen fitness function is evaluated for the parameter set under evaluation and with pre-defined initial conditions subject to disturbances.
Analysing the results
Three pre-run optimisation processes with different initial conditions are provided with the code in data/BO_Data_xxx.mat files. These results can be reviewed using results(DatasetNumber) function. Use DatasetNumber=1 for walking gait model, DatasetNumber=2 for skipping gait model and DatasetNumber=3 for running gait model.
The figure created when using the results function displays three plots. The first plot shows the progress of parameter values with optimisation iteration. As exploitation starts the values of parameters are not exposed to large changes in the values. The second plot shows the fitness function evolution with optimisation iteration. The third plot allows user to choose a parameter set and disturbance in initial conditions for animation and displaying phase plot to visualise the performance.
References
[1] Kaur Aare Saar, Bayesian Optimisation of SLIP model parameters
(https://www.mathworks.com/matlabcentral/fileexchange/59060-bayesian-optimisation-of-slip-model- parameters), MATLAB Central File Exchange. Retrieved March 13, 2023.
[2] C. E. Rasmussen, “Gaussian processes for machine learning,” Int. J. Neural Syst., vol. 14, no. 2, pp. 69–106, 2006.
[3] E. Brochu, V. M. Cora, and N. De Freitas, “A tutorial on Bayesian optimization of expensive cost
functions, with application to active user modeling and hierarchical reinforcement learning,” Rl, pp. 149, 2010.
[4] R. Blickhan, “The spring-mass model for running and hopping,” Journal of Biomechanics, vol. 22, no. 11–12. pp. 1217–1227, 1989.
[5] H. Geyer, A. Seyfarth, and R. Blickhan, “Compliant leg behaviour explains basic dynamics of walking and running.,” Proc. Biol. Sci., vol. 273, no. 1603, pp. 2861–2867, 2006.
[6] A. E. Minetti, “The biomechanics of skipping gaits: a third locomotion paradigm?,” Proc. Biol. Sci., vol. 265, no. February, pp. 1227–1235, 1998.