TY - DATA T1 - Implementation of approximate SDD-TMPC (state-dependent dynamic tube model predictive control) for a nonlinear problem PY - 2024/04/02 AU - Filip Surma UR - DO - 10.4121/6568e235-289d-4be0-b931-ec219c559f6f.v1 KW - Robust optimization KW - Approximate MPC KW - Spiking neural networks N2 -
The code in this repository is used to implement and test an approximation of a new algorithm called SDD-TMPC. It is a control algorithm that sacrifices some optimality (much less than tube MPC) but provides robust solutions (more about this can be found in [1]). The original controller presented in [1] proved to work and showed good performance, but solving the optimality problem took too long to implement it for a real robot. To solve this problem, we used a spiking neural network to approximate SDD-TMPC.
First, we generated data using Matlab's main script. It is a function that takes a seed as input and randomly samples the state of the robot in an environment as it works. The environment is a circular environment with 1 meter radius and a wall around it. Then it tries to solve the optimization problem, i.e. find an optimal input such that a cost function is minimized, a robot does not collide with the wall, and the terminal constraints are satisfied. Once the optimization problem is solved, a new file is created, and the sampled data is saved with the additional data.
It is possible that no solution was found. In such a case, a vector full of zeros will be saved. It is worth noting that it takes a lot of time to generate each data sample. According to our research, it is important to generate the data as close to the global optimum as possible, because outliers make training the network much more difficult. Therefore, we decided to spend a lot of time generating each data sample.
All generated data were saved in two files "final_data.csv" and "final_data.xlsx". The former contains the state (only 2 columns, there is no saved direction because it is assumed that the coordinate frame is rotated so that the direction is always 0), optimal input (2 columns - linear and angular velocity), nominal input (2 columns - linear and angular velocity) and nominal error (3 columns - 2-dimensional position and direction). The nominal velocity and nominal error can be used to calculate the optimal input (see [2] for details), i.e. to check if there is no problem with the data. The file "final_data.xlsx" also contains an additional column with seeds to make the data reproducible.
The next step is to use "network_traning.ipynb" to train the networks. After running this file, the files "linear_final.pt" and "angular_final.pt" are created. These files contain the trained spiking neural networks that can be used instead of SDD-TMPC. The "network_tester.ipynb" file is used to compare the behavior between SDD-TMPC and its approximation. After execution, figures are generated.
Finally, to test the behavior of the system, we created a ROS2 package to control a wheeled robot.
ER -