Learning-based intelligent trajectory planning for auto navigation of magnetic robots

Introduction: Electromagnetically controlled small-scale robots show great potential in precise diagnosis, targeted delivery, and minimally invasive surgery. The automatic navigation of such robots could reduce human intervention, as well as the risk and difficulty of surgery. However, it is challenging to build a precise kinematics model for automatic robotic control because the controlling process is affected by various delays and complex environments. Method: Here, we propose a learning-based intelligent trajectory planning strategy for automatic navigation of magnetic robots without kinematics modeling. The Long Short-Term Memory (LSTM) neural network is employed to establish a global mapping relationship between the current sequence in the electromagnetic actuation system and the trajectory coordinates. Result: We manually control the robot to move on a curved path 50 times to form the training database to train the LSTM network. The trained LSTM network is validated to output the current sequence for automatically controlling the magnetic robot to move on the same curved path and the tortuous and branched new paths in simulated vascular tracks. Discussion: The proposed trajectory planning strategy is expected to impact the clinical applications of robots.

1 Supplementary Data

Parameters of the neural network
Before training, we perform the standard and non-dimensional process of the input data set.As shown in Eq. 1. xi refers to every sample, μ (x) refers to the mean value of this matrix, and σ(x) refers to the standard deviation of the matrix.
After each 125 epoch, the learning rate is multiplied by a 0.2 factor.

Network type
Inter The forget gate and the input gate filter the hidden state and the input information through the sigmoid function respectively, screening the valid information to be memorized and forget the useless information.The updated cell state is equal to the sum of the information from the cell state at the previous time filtered through the forget gate and then superimposed on the input gate.Therefore, the structure of LSTM effectively solves the short-term restriction of RNN and has long-term memory.
The structure of the LSTM network is more complex than RNN, it introduces the cell state and use the forget gate, input gate and output gate to control the data.As shown in the figure S, the forget gate filters the input of time "t" and the output of time "t-1" by the following function (W refers to the weights, b refers to the bias).
If the data becomes 0 after the sigmoid function, it is also 0 in subsequent multiplicative relational operations and is therefore forgotten.If its value is 1, it is considered as important information and remains memorized.The input gate primarily controls the selective addition of xt to the cell state as shown in the following function.
The sigmoid function selectively discards feature dimensions with an output of 0. tanh is equivalent to the activation function in RNN and performs a linear transformation for the original input.The resulting   ̃ and   together update the current cell state.Similarly, the output gate also requires selective memorization and forgetting of the output information.
Although LSTM is more complex compared to RNN and needs to learn a lot of parameters, it has a long-term memory function thus can effectively train long-term time-correlated sequences.According to the theoretical calculations, according to the supplementary eq.6, we get the ideal value of inductance of the coil without the core.N refers to the number of turns (960), A refers to the cross-sectional area (r=42.75mm) and l refers to the length of solenoid (140 mm).The caculating value is 47.49 mH.
Compared to the simulated value, the error rate is 3.74%, therefore, we can estimate the inductance of the coil with core to be 178.95±6.68mH.
To make sure that the state of the coils and their influence on the magnetic particles is the same for every experiment, we need to calibrate it beforehand.First, it is obvious that the current value needs to be reset to zero before the experiment.Secondly, since the change of current is not instantaneous, the inductive effect produced during the change of current will affect the magnetic field, thus affecting the motion.So, we need to make sure that the inductive effect is the same for each experiment, and we calibrate this by setting the current changing rate to the same value for each experiment.To verify the validity of this calibration, we repeat the control of the same magnetic particles in the same orbit, applying the same current, setting exactly the same current changing rate, and obtaining displacement-time curves.As can be seen from Sup. shows that the maximum position deviation is only 0.74 mm in 5 times of control, which indicates that this calibration can make the state of the instrument remain basically the same in each experiment.

Modeling of the control system
Supplementary Figure 3 (A)-(E) The comparison among the measured, simulated magnitude and the fitting result at different points.

(F)
The ratio coefficient between B and current at different points.
We use theoretical modeling to obtain the relationship between the in-plane magnetic field and the input current of the actuation system.
To establish the mapping relationship between the in-plane magnetic field and the input current, we define the coefficient matrix IK.When there is only one electromagnetic coil working, set its current as I1, the magnetic field generated in the plane is defined as the magnetic field matrix B1, and the magnetic field intensity at any point in the plane is Bi1 (which is an element in the matrix).The corresponding relationship was Bi1=IKiI1 (where IKi represents an element in the coefficient matrix IK).Therefore, every points in the plane have specific B-I coefficients defined as "Bi1=IKiI1", the relationship between the current and the magnetic amplitude in the plane can be written by a matrix as "B1=IKI1".Divide the 100 cm 2 plane every 1mm, and the obtained magnetic field matrix is a 101×101 matrix.Because the data we use for theoretical modeling are all from the software simulation results, we need to compare the simulation magnetic field with the experimental measurement results to prove the data rationality of theoretical modeling.After input a certain current to the current source, we used Gauss meter and simulation software (ANSYS) to obtain the amplitude and direction of the magnetic field at each point in the plane respectively.
After the coefficient matrix IK1 corresponding to I1 is obtained, we can obtain the other three "magnetic field-input current" relationships and the coefficient matrix when the other three current sources work independently and respectively.Finally, through simple superposition calculation, the magnitude of the magnetic field at any point when the four electromagnetic coils in the plane work at the same time can be obtained.Finally, we superimpose the magnetic fields generated by the four current sources to obtain the Bx and By components of the magnetic fields generated at each point in the plane when the four current sources work simultaneously.Then, the magnitude and direction of the magnetic field can be obtained through vector synthesis.
We also need to reserve the above modeling process.When the magnetic field of one point is known, we need to calculate the corresponding current value of each current source.
The following two sets of equations describe the relationship between the magnetic field strength generated by each coil at different positions and the current I.To solve it inversely, we have already known the position and the sum of the components of B x and B y respectively.Therefore, we need to solve a set of suitable current combinations.We use MATLAB to solve the indefinite Equation as follows.
Modeling of the coils in the ANSYS.(B) The inductance of the coil with and without the core.(C) Repetition of the control five times at the same current, current changing rate, and orbit, with a 5 min interval between each control.(D) The maximum error of position at different time among the 5 times' control.

Table 1
The comparison among CNN, RNN and LSTM.
The common neural network includes the Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), and LSTM.CNN is a kind of Feedforward Neural Network, whose input of time "t" is not relevant to the input of time "t+1".It is often used to solve image recognition because there is no time relevance within.CNN and LSTM both have a memory function, which means neurons can receive not only signals from other neurons, but also their own feedback signals.They belong to the Feedback Neural Network, however, due to the gradient dispersion, it is not possible for RNN to update the learning parameters of the earlier time step according to the gradient in the later time step.Therefore, RNN does not