Method for carrying out spatial positioning on permanent magnet by utilizing self radiation magnetic field of permanent magnet

By establishing a magnetic dipole model of permanent magnets and using VIT neural network and linear optimization algorithms, the problem of sensitivity to sensor errors and low update frequency of optimization algorithms in the existing technology is solved, and a more efficient and accurate permanent magnet is achieved position.

CN119476021APending Publication Date: 2025-02-18UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411598634.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing permanent magnet positioning technology is sensitive to sensor errors during the calculation process, which may generate local optimal solutions, affecting the real-time positioning. The optimization algorithm is low when the data volume is large, and cannot meet the real-time requirements.

Method used

By establishing a magnetic dipole model of a permanent magnet, the VIT neural network is used to quickly determine the position and posture of the permanent magnet, and then the precise position and posture are obtained through reverse optimization through linear optimization algorithm.

Benefits of technology

The accuracy and speed of positioning results are improved, the impact on sensor error is reduced, the number of optimization iterations is reduced, and the real-time positioning is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119476021A_ABST
    Figure CN119476021A_ABST
Patent Text Reader

Abstract

The invention discloses a method for carrying out spatial positioning on a permanent magnet by utilizing a radiation magnetic field of the permanent magnet, which comprises the following steps of: firstly, establishing a magnetic dipole model of the permanent magnet, then determining the posture of the permanent magnet in a spatial range by utilizing a trained VIT (Vision Transform) network, and carrying out reverse optimization by utilizing a nonlinear optimization algorithm on the basis, so as to realize rapid and accurate positioning. Compared with an existing mature permanent magnet positioning technology using an LM algorithm and a reverse optimization algorithm, the method provided by the invention is more insensitive to errors of a sensor, and is effectively prevented from falling into a local optimal solution. Meanwhile, due to the fact that the difference between an optimization initial value and a true value is not large, the number of iteration times of optimization calculation is small, the optimization calculation can be completed in a short time, rapid and accurate positioning is achieved, and balance between accuracy and rapidness is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of permanent magnet positioning in a small spatial range, and in particular relates to a method for spatial positioning of a permanent magnet by utilizing its own radiated magnetic field. Background Art

[0002] Permanent magnet positioning technology is a technology that uses the permanent magnet's own radiated magnetic field to locate it. It has many advantages such as passive positioning, not susceptible to electromagnetic signal interference, low cost, and good equipment compatibility. It has broad application prospects in small-scale spatial positioning problems such as robot control and medical capsule endoscopes.

[0003] In order to ensure the real-time positioning of permanent magnets, it is necessary to establish a simplified permanent magnet magnetic field distribution model. At present, most mature permanent magnet positioning technologies use magnetic dipole models or simplified magnetic dipole models. On this basis, the LM algorithm is used to reversely optimize and calculate the position and posture of the permanent magnet. This positioning method is very sensitive to sensor errors and may produce local optimal solutions during the calculation process. Moreover, the optimization algorithm requires multiple iterations when the difference between the actual posture and the initial value of the optimization is large. This process will have a great impact on the real-time positioning. And when the amount of data increases significantly, the update frequency of the optimization algorithm becomes very low and cannot meet the real-time requirements. Another fast permanent magnet tracking method of the Inception neural network that integrates the convolutional block attention mechanism achieves fast positioning with an error of about 1mm, and the speed is 200 times higher than that of the LM optimization algorithm. However, this method pursues calculation speed too much, resulting in redundant calculation speed and limited accuracy improvement. It ignores the excellent performance of the optimization algorithm in improving the positioning and attitude accuracy, and simply abandons the optimization algorithm due to calculation speed issues. Therefore, it is very important to achieve a balance between permanent magnet positioning accuracy and calculation speed. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a method for spatial positioning of a permanent magnet by utilizing its own radiated magnetic field. The position and posture of the permanent magnet are quickly determined within a spatial range by a VIT neural network trained with a magnetic dipole model, and then the precise position and posture of the permanent magnet are obtained by reverse optimization using a linear optimization algorithm.

[0005] The object of the present invention is achieved through the following technical solution: a method for spatial positioning of a permanent magnet by using its own radiated magnetic field, the specific steps are as follows:

[0006] S1. Establish a magnetic dipole model of a permanent magnet in space: The permanent magnet in space is simplified using a magnetic dipole model, and its position is defined by six parameters: three-dimensional position coordinates x, y, z and magnetic axis direction angles m, n, p; the magnetic dipole model is a physical model established by analogy with the electric dipole, and a circular loop carrying current is used as a model of the magnetic dipole to study its magnetic field distribution characteristics and use it to replace the real permanent magnet; the magnetic induction intensity expression of the magnetic dipole is:

[0007]

[0008] Among them, μ 0 is the vacuum permeability, μ is the medium permeability, r is the distance from the magnetic dipole to the measurement point; δ 3 (r) is the Dirac delta function. Since the Dirac delta function is 0 when r≠0, the term on the right side will be ignored when calculating the far-field strength.

[0009] The coordinate system is established with the plane where the sensor array is located as the xoy plane. Assume that the position vector of the permanent magnet is (x, y, z) and the direction vector R is (m, n, p) T , the position of the lth sensor is (x l ,y l ,0), from (x l ,y l ,0) The direction vector pointing to (x, y, z) is R l ; Simplify the expression of magnetic induction intensity to:

[0010]

[0011] Where N T The value is only related to the inherent properties of the target magnet and is obtained by reverse optimization under the premise of determining the magnet posture;

[0012] Then, the magnetic induction intensity vector at the lth sensor position is expressed as:

[0013] B l =B lx i+B ly ·j+B lz k,1≤l≤N

[0014] i is the unit vector in the x-axis direction, j is the unit vector in the y-axis direction, k is the unit vector in the z-axis direction, B lx , B ly , B lz are the magnetic induction intensities in the x, y, and z directions measured by the sensor respectively;

[0015] Three orthogonal terms B lx , B ly , Blz They are:

[0016]

[0017] S2. Generate a training set of a neural network using a magnetic dipole model: Use the equation group in step S1 to fit the magnetic induction intensity at the sensor position to form a training set of the neural network;

[0018] S3. Use the VIT network to determine the position and posture of the permanent magnet within a spatial range: train two VIT networks to predict the position x, y, z and posture m, n, p of the permanent magnet respectively;

[0019] S4. According to the model of S1 and the spatial range of S3, the position and posture of the permanent magnet are obtained by reverse optimization using the most nonlinear optimization algorithm.

[0020] The sensor array used in step S1 includes a 6×6 magnetic sensor array formed by 36 QMC5883P magnetic sensor units, a positioning array board with a length and width of 25 cm, an ESP32 chip as the main control, and a set of magnetic induction intensity collection and transmission programs designed based on C++.

[0021] The step S4 is specifically as follows: constructing the objective function of nonlinear optimization as:

[0022]

[0023] Among them, y i is the actual observed value, that is, the actual observed three-dimensional position coordinates x, y, z or magnetic axis direction angles m, n, p; f(x i ,θ) is the input data x i , the predicted value of the model output when the model parameter is θ; θ is the parameter to be optimized for the model, and the input data x i is the magnetic induction intensity at the sensor position; by minimizing the above objective function, θ is obtained, and then the model is determined, and the position or posture prediction is completed using the model.

[0024] The beneficial effects of the present invention are as follows: the method of the present invention first establishes a magnetic dipole model of a space permanent magnet, then uses the model to construct a neural network training set for positioning, then uses the trained VIT network to determine the position and attitude of the permanent magnet in a small range of space, and finally uses a nonlinear optimization algorithm to reversely optimize to obtain the precise position and attitude of the permanent magnet. The method of the present invention is different from the existing typical space permanent magnet positioning method in that it is more stable and less affected by sensor errors. At the same time, since the initial value of the optimization is not much different from the actual value, the number of optimization iterations required is less, which effectively improves the accuracy and speed of the positioning result. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flow chart of a method for spatial positioning of a permanent magnet using its own radiated magnetic field according to the present invention;

[0026] Figure 2 Schematic diagram of a magnetic dipole model in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0028] like Figure 1 As shown, the present invention provides a method for spatial positioning of a permanent magnet by utilizing its own radiated magnetic field, and the specific steps are as follows:

[0029] S1. Establish a magnetic dipole model of a permanent magnet in space: Figure 2 As shown, the permanent magnet in space is simplified by using a magnetic dipole model, and its position is defined by six parameters: three-dimensional position coordinates x, y, z and magnetic axis direction angles m, n, p. The magnetic dipole model is a physical model established by analogy with the electric dipole. A circular loop carrying current is used as a model of the magnetic dipole to study its magnetic field distribution characteristics and use it to replace the real permanent magnet to achieve the purpose of simplifying the calculation. The magnetic induction intensity expression of the magnetic dipole is:

[0030]

[0031] Among them, μ 0 is the vacuum magnetic permeability, μ is the medium magnetic permeability (for example, if the positioning process of this embodiment is carried out in the air, μ is the air magnetic permeability), and r is the distance from the magnetic dipole to the measuring point; δ 3 (r) is the Dirac delta function. Since the Dirac delta function is 0 when r≠0, the right term will be ignored when calculating the far-field strength. On this basis, a coordinate system is established with the plane where the sensor array is located as the xoy plane. It is assumed that the position vector of the permanent magnet is (x, y, z) and the direction vector R is (m, n, p). T , the position of the lth sensor is (x l ,y l ,0), from (x l ,y l ,0) The direction vector pointing to (x, y, z) is R l ; Simplify the expression of magnetic induction intensity to:

[0032]

[0033] Where N T The value is only related to the inherent properties of the target magnet and is obtained by reverse optimization under the premise of determining the magnet posture.

[0034] Then, the magnetic induction intensity vector at the lth sensor position is expressed as:

[0035] B l =B lx i+B ly ·j+B lz k,1≤l≤N

[0036] i is the unit vector in the x-axis direction, j is the unit vector in the y-axis direction, k is the unit vector in the z-axis direction, B lx , B ly , B lz are the magnetic induction intensities in the x, y, and z directions measured by the sensor respectively;

[0037] Three orthogonal terms B lx , B ly , B lz They are:

[0038]

[0039] In step S1, the sensor array used is a self-designed magnetic sensor system, which includes a 6×6 magnetic sensor array formed by 36 QMC5883P magnetic sensor units, a positioning array board with a length and width of 25 cm, an ESP32 chip as the main control, and a set of magnetic induction intensity acquisition and return programs designed based on C++. The system can achieve a 25Hz data return refresh rate, and the mode, range, sampling rate, transmission rate, etc. of the magnetic sensor array can be adjusted by buttons, which improves the operability and flexibility of the sensor array. At the same time, it can automatically collect and deduct the background magnetic field, effectively preventing background noise from interfering with positioning.

[0040] S2. Generate a training set of neural network using magnetic dipole model. After experimental test and comparison with theoretical data, the equation group in step S1 is:

[0041]

[0042] The magnetic induction intensity at the sensor position can be well fitted, so that the magnetic induction intensity at the sensor position can be produced using the equation group to form a training set for the neural network, eliminating the process of manually generating the training set and avoiding the errors caused by readings or sensors during the manual generation process. The data in the training set is the magnetic induction intensity data in three dimensions fitted by the 6×6 sensor array, and the data dimensions are 3×6×6.

[0043] S3. The position and posture of the permanent magnet are determined within a spatial range using the VIT network; the VIT (Vision Transformer) network is specifically a deep learning model based on the Transformer architecture for image recognition and computer vision tasks. Unlike the traditional convolutional neural network (CNN), VIT directly regards the image as a serialized input and uses the self-attention mechanism to process the pixel relationship in the image. The present invention regards the input 3×6×6 data as 6×6 three-channel image data. VIT divides the image into a series of patches and converts each patch into a vector representation as an input sequence. These vectors are then processed by a multi-layer Transformer encoder, which includes a self-attention mechanism and a feedforward neural network layer. This can capture the contextual dependencies of different positions in the image. Finally, by classifying or regressing the Transformer encoder output, a specific visual task can be completed. The present invention constructs a 16-layer VIT network, divides the 6×6 three-channel image into 2×2 three-channel small patches, and then maps the small patches into a 64-dimensional space. Each tile is converted to a 64-dimensional embedding vector through a linear projection layer, and then these embedding vectors are input into an encoder consisting of 16 Transformer encoder layers. The encoder layer uses 8 attention heads to capture global information in the image. Finally, the output of the encoder is mapped to 3 categories through a linear classification head. Two VIT networks are trained using the above architecture to predict the position x, y, z and posture m, n, p of the permanent magnet respectively.

[0044] Since the position and attitude of the permanent magnet have different mathematical characteristics, we consider training the network for position and attitude separately. When using, we load two networks at the same time for calculation, and splice them to obtain the six-dimensional fuzzy posture. The optimization initial value of the optimization algorithm is limited to a smaller range to avoid the generation of local optimal solutions as much as possible. The 108-dimensional column vector magnetic induction intensity data transmitted by the sensor to the computer is transformed into a tensor in the format of 3×6×6, and then input into the network for prediction.

[0045] S4, according to the model of S1 and the spatial range of S3, the position and posture of the permanent magnet are obtained by reverse optimization using the most nonlinear optimization algorithm; specifically, the model parameters are fitted by minimizing the residual sum of squares; specifically, by iteratively adjusting the parameter values, gradually approaching the optimal solution, the objective function of nonlinear optimization is constructed as follows:

[0046]

[0047] Among them, y i is the actual observed value, that is, the actual observed three-dimensional position coordinates x, y, z or magnetic axis direction angles m, n, p; f(xi ,θ) is the input data x i , when the model parameter is θ, the predicted value (of the three-dimensional position coordinates or the magnetic axis direction angle) of the model output; θ is the parameter to be optimized of the model, and the input data x i is the magnetic induction intensity at the sensor position; by minimizing the above objective function, θ is obtained, and then the model is determined, and the model can be used to complete the position or posture prediction.

[0048] The above optimization process can be completed using python. During the calculation process, the initial value of the optimization is calculated by the VIT network. The upper and lower limits of the position are determined by the size of the sensor array. In this embodiment, the three dimensions of the position should be set as much as possible within the limit of x[-0.125, 0.125], y[-0.125, 0.125], and z[0.05, 0.3], so that the pose data generated when training the VIT network is within this limit as much as possible. But in fact, this is a weak constraint, because the optimization algorithm can still slightly exceed this constraint. Therefore, a strong constraint must be further set for the optimization algorithm, which is set to x[-0.25, 0.25], y[-0.25, 0.25], and z[0, 0.4] in this embodiment. If there is no constraint on the upper and lower limits of the optimization, the optimization algorithm has a certain probability of finding a local solution that is better than the correct pose in the entire space (the correct pose is only one of multiple local optimal solutions). This constraint ensures that the optimization is absolutely carried out in this space, which can greatly reduce the influence of other local optimal solutions. The upper and lower limits can be set in Python. Python's nonlinear optimization function has a built-in function called optimization upper and lower bounds, which can absolutely limit the optimization results to the preset range. The posture should satisfy the unit vector constraint as much as possible. In Python nonlinear optimization, the upper and lower bounds of the three posture dimensions are set to [-1,1].

[0049] In summary, the positioning accuracy through the VIT network and nonlinear optimization algorithm is much more accurate and the speed is much faster, thereby effectively improving the efficiency of spatial permanent magnet positioning. The method of the present invention is not limited to constructing a 16-layer VIT network. After the 6×6 image is divided into 2×2 small tiles, the small tiles are mapped to a 64-dimensional space. Each tile is then converted into a 64-dimensional embedding vector through a linear projection layer, and then these embedding vectors are input into an encoder composed of 16 Transformer encoder layers, after which the encoder layer uses 8 attention heads to capture global information in the image, and finally a linear classification head is used to map the output of the encoder to 3 categories. It can be extended to multi-layer VIT networks, multiple image segmentation methods, multiple mapping spaces, multiple embedding vectors, multiple encoder layers, multiple attention heads, and multiple output mapping categories; but it is only effective for the case where the VIT network is first processed and then optimized with a nonlinear optimization algorithm and a single permanent magnet is positioned.

[0050] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.

Claims

1. A method for spatial positioning of a permanent magnet by using its own radiated magnetic field, characterized in that: The specific steps are as follows: S1. Establish a magnetic dipole model of a permanent magnet in space: The permanent magnet in space is simplified using a magnetic dipole model, and its position is defined by six parameters: three-dimensional position coordinates x, y, z and magnetic axis direction angles m, n, p; the magnetic dipole model is a physical model established by analogy with the electric dipole, and a circular loop carrying current is used as a model of the magnetic dipole to study its magnetic field distribution characteristics and use it to replace the real permanent magnet; the magnetic induction intensity expression of the magnetic dipole is: Where μ0 is the vacuum permeability, μ is the medium permeability, r is the distance from the magnetic dipole to the measurement point; δ 3 (r) is the Dirac delta function. Since the Dirac delta function is 0 when r≠0, the term on the right side will be ignored when calculating the far-field strength. The coordinate system is established with the plane where the sensor array is located as the xoy plane. Assume that the position vector of the permanent magnet is (x, y, z) and the direction vector R is (m, n, p) T , the position of the lth sensor is (x l ,y l ,0), from (x l ,y l ,0) The direction vector pointing to (x, y, z) is R l ; Simplify the expression of magnetic induction intensity to: Where N T The value is only related to the inherent properties of the target magnet and is obtained by reverse optimization under the premise of determining the magnet posture; Then, the magnetic induction intensity vector at the lth sensor position is expressed as: B l =B lx ·i+B ly ·j+B lz ·k,1≤l≤N i is the unit vector in the x-axis direction, j is the unit vector in the y-axis direction, k is the unit vector in the z-axis direction, B lx , B ly , B lz are the magnetic induction intensities in the x, y, and z directions measured by the sensor respectively; Three orthogonal terms B lx , B ly , B lz They are: S2. Generate a training set of a neural network using a magnetic dipole model: Use the equation group in step S1 to fit the magnetic induction intensity at the sensor position to form a training set of the neural network; S3. Use the VIT network to determine the position and posture of the permanent magnet within a spatial range: train two VIT networks to predict the position x, y, z and posture m, n, p of the permanent magnet respectively; S4. According to the model of S1 and the spatial range of S3, the position and posture of the permanent magnet are obtained by reverse optimization using the most nonlinear optimization algorithm.

2. A method for spatial positioning of a permanent magnet using its own radiated magnetic field according to claim 1, characterized in that: The sensor array used in step S1 includes a 6×6 magnetic sensor array formed by 36 QMC5883P magnetic sensor units, a positioning array board with a length and width of 25 cm, an ESP32 chip as the main control, and a set of magnetic induction intensity collection and transmission programs designed based on C++.

3. The method for spatial positioning of a permanent magnet by using its own radiated magnetic field according to claim 1, characterized in that: The step S4 is specifically as follows: constructing the objective function of nonlinear optimization as: Among them, y i is the actual observed value, that is, the actually observed three-dimensional position coordinates x, y, z or magnetic axis direction angles m, n, p; f(x i ,θ) is the input data x i , when the model parameter is θ, the predicted value of the model output; θ is the parameter to be optimized for the model, and the input data x i is the magnetic induction intensity at the sensor position; by minimizing the above objective function, θ is obtained, and then the model is determined, and the position or posture prediction is completed using the model.

Citation Information

Cited By

  • Sandy soil movement monitoring method and sandy soil movement monitoring system based on magnetic field positioning

    CN120489213A

  • Magnet pose estimation method and system based on magnetic dipole constraint

    CN122237419A