RectMag3D: A Magnetic Actuation System for Steering Milli/Microrobots Based on Rectangular Electromagnetic Coils

: Milli/microrobots beneﬁt from their small size and can perform minimally invasive surgery in a limited tissue space and eliminate the need for ﬁne operations such as thrombus, which not only reduces trauma to patients but also shortens the recovery period after surgery. In order to realize motion control of the milli/microrobot at a small scale, the external magnetic ﬁeld-based control method has a signiﬁcant advantage of wireless connection, safety, and high efﬁciency compared to other external actuation ways. Aiming at the actuation of milli/microrobots in human tissue ﬂuid during a medical operation, we designed a milli/microrobot magnetic actuation system called RectMag3D, which is based on rectangular electromagnetic coils. It can realize ﬁve-degree-of-freedom motion control of milli/microrobot in three-dimensional space. It has the advantage of the accurate modeling of a magnetic ﬁeld from each rectangular coil. Therefore, accurate control can be achieved. In this paper, the design and modeling of the proposed system have been introduced. A linear programming algorithm has been applied to achieve ﬁxed-point actuation and displacement actuation. Experiments show that the milli/microrobot can realize the steering and linear motion to the target point in any direction in the limited working space under the control of the magnetic actuation system. gradient magnetic field sets. Although the mechanical movement of the magnet is one of the ways to achieve varying magnetic field, there are some drawbacks: first, the magnetic field cannot be changed quickly because the magnet need to be physically moved. Second, since this motion requires a lot of space, it is difficult to increase the number of magnets. Third, the field cannot be “shut down” even in an emergency, so it may cause safety problems. The second design of dynamic magnetic field can be realized by control the electromagnetic current. Various electromagnetic systems have been reported in the literature [**]-[**], with different characters of electromagnet configuration, workspace, and magnetic field distributions. All these developed systems are based on cylindrical electromagnetic coils and also include Helmholtz and Maxwell coils which can producing a magnetic field with homogeneous magnetic field density and gradient. Our previous work shows that the analytical expression of the magnetic field model of a rectangular coil is simpler and less computationally intensive than a cylindrical electromagnetic coil, which would mean that the rectangular coil magnetic field generating device has the potential to solve the magnetic field quickly and accurately. Therefore, in this paper, we use this advantage of rectangular coil to construct a novel magnetic field actuation device and experiments are out to reflect the characteristics of this in the


Introduction
Milli/microrobots refer to small-scale robots with dimensions from micrometers to millimeters. They have potential to be used in performing related operations in a limited workspace in vivo. Compared with traditional surgeries, medical milli/microrobots can easily enter the internal human body and complex organ lesions and reduce unnecessary trauma to the patient's body tissue and shorten the postoperative recovery period [1][2][3][4]. Due to these advantages, the development of milli/microrobot technology is of great significance in the minimally invasive diagnosis and diagnostic medical procedures where milli/microrobot can be designed to perform minimally invasive surgery on cell tissue, vascular tissue, human intestine, and so on.
The special application environment of medical milli/microrobot and its small scale mean that the choice of movement control is a big challenge. Passive actuation that relies on direct interaction with the environmental media in the human body, such as early capsule robots move to rely on gastrointestinal peristalsis, is clearly not applicable to the field of minimally invasive diagnosis due to its inefficiency and difficulty in control. Wireless external field energized active actuation is currently the most suitable remote control method including magnetic actuation, electric actuation, microwave actuation, laser actuation, and ultrasonic wave actuation [5]. Compared with other external field energy sources, magnetic actuation has been proven safer and easier to control in the experimental environment because the magnetic field is capable of response in a short period and only has an influence on the magnetic medium placed therein [6]. Besides, cell polarization and thermal effects can be ignored in low-frequency magnetic fields [7,8].
Inspired by the way microbes move in nature, the general magnetic field actuation method can be divided into three types [9]. The first method uses a combination of magnetic field direction and magnetic field gradient for the actuation of the magnetic medium milli/microrobot, as shown in Figure 1a [10]; The second method uses a uniform magnetic field with a rotating change to the actuation of a magnetic milli/microrobot with a spiral structure, as shown in Figure 1b [11][12][13]; The third method uses a uniform magnetic field with an oscillating change to the actuation of a magnetic milli/microrobot with a flexible tail, as shown in Figure 1c [14]. Studies have shown that under ideal conditions, the rotating magnetic field method and the oscillating magnetic field way have similar peak performance [9]. In addition, it is easier to generate the desired external magnetic field with the latter two methods. To achieve the same function such as targeted drug delivery, the design, and manufacture of the milli/microrobot in Figure 1a does not need to consider the motion and attitude conversion services for the milli/microrobot in the body. This is because the irregular structure and complex milli/microrobot can achieve the expected motion through the design and modification of the control algorithm. However, this is an attribute that is not available in the latter two actuation modes. The control mode in Figure 1a requires that the external magnetic field generating device can generate desired gradient and torque in the workspace; this satisfies the movement and rotation of the milli/microrobot, which is a basic requirement that must be met by the system described herein.
Inspired by the way microbes move in nature, the general magnetic field actuation method can be divided into three types. The first method uses a combination of magnetic field direction and magnetic field gradient to actuation the magnetic medium microrobot, as shown in Fig.1(a) ; The second method uses a uniform magnetic field with a rotating change to actuation a magnetic microrobot with a spiral structure, as shown in Fig.1(b);The third method uses a uniform magnetic field with an oscillating change to actuation a magnetic microrobot with a flexible tail, as shown in Fig.1(c). Studies have shown that under ideal conditions, the rotating magnetic field spiral propulsion microrobot and the oscillating magnetic field flexible tail propulsion microrobot have similar peak performance. In addition, their external magnetic field has no demanding requirements, which is the biggest advantage of their ability to actuate microrobots compared to gradient magnetic field. However, in actual situations, the fabrication and assembly of the latter two microrobots is very complicated and difficult to implement. The actuation based on the direction and the gradient of the magnetic field does not have strict requirements on the target object, and the complexity of the microrobot structure can be corrected by the control algorithm.
Based on the above analysis, in this paper we will focus on designing a magnetic field generating device that implements arbitrary magnetic field directions and gradients in the workspace. There have been a lot of researches on varying magnetic field generating devices, which can be mainly summarized into two major categories. The first type of varying magnetic field system can be achieved by changing the relative position between the permanent magnet system and the workspace. Baun et al.
proposed to use annular Halbach to achieve 2D manipulation of magnetic nanoparticles. A homogeneous magnetic field produced by one of the sets is used to magnetize the particles and orient the particles. The direction and the intensity of the force can be adjusted by adjusting the angle between the another two gradient magnetic field sets. Although the mechanical movement of the magnet is one of the ways to achieve varying magnetic field, there are some drawbacks: first, the magnetic field cannot be changed quickly because the magnet need to be physically moved. Second, since this motion requires a lot of space, it is difficult to increase the number of magnets. Third, the field cannot be "shut down" even in an emergency, so it may cause safety problems. The second design of dynamic magnetic field can be realized by control the electromagnetic current. Various electromagnetic systems have been reported in the literature [**]-[**], with different characters of electromagnet configuration, workspace, and magnetic field distributions. All these developed systems are based on cylindrical electromagnetic coils and also include Helmholtz and Maxwell coils which can producing a magnetic field with homogeneous magnetic field density and gradient. Our previous work shows that the analytical expression of the magnetic field model of a rectangular coil is simpler and less computationally intensive than a cylindrical electromagnetic coil, which would mean that the rectangular coil magnetic field generating device has the potential to solve the magnetic field quickly and accurately. Therefore, in this paper, we use this advantage of rectangular coil to construct a novel magnetic field actuation device and experiments are There has been a lot of researches on varying magnetic field generating devices, which can be mainly summarized into two major categories. The first type of varying magnetic field system can be achieved by changing the relative position between the permanent magnet system and the workspace. Arthur W. Mahoney et al. proposed using a six-degree-of-freedom manipulator to control a permanent magnet to actuate the capsule endoscope to achieve a three-degree-of-freedom closed-loop position and two-degree-of-freedom open-loop control [15]. The magnetic force and torque are controlled by adjusting the position and orientation of the permanent magnet. However, this control mode has three obvious drawbacks: first, the frequency of the change of the magnetic field is low since it takes time for the permanent magnet to move to the next suitable position; second, external mechanical equipment for moving the permanent magnet requires a large working space; third, the magnetic field generated by permanent magnets cannot be quickly eliminated, which has potential safety hazards in medical treatment [16]. The second type is to generate a varying magnetic field by changing the driven current of coils. Various electromagnetic systems have been reported in works of literature [17][18][19][20][21] with different characters of electromagnet configuration, workspace, and magnetic field distributions. Kummer et al. proposed OctoMag which used a total of eight cylindrical coils to control the milli/microrobot with five degrees of freedom. They used a point dipole model that was fit to field data obtained from a FEM model to describe magnetic contribution which mainly focused on the central area of the workspace. However, the complex magnetic field of OctoMag is hard to be accurately modeled over a large workspace [17]. Fuzhou Niu et al. established a magnetic distribution database by using a numerical (linear interpolation) method based on the FEM results to make a microparticle that can be manipulated in a larger workspace [21]. At present, almost all electromagnets of electromagnetic drive systems are based on cylindrical coils, but we use a rectangular coil winding method. Compared to systems with circular coils, the rectangular coil has accurate closed-form analytical expression for the calculation of the magnetic field and gradient. Therefore, it is more suitable for the control of magnetic force and torque. Additionally, the analytical mathematic model is much more accurate at the test position than the general magnetic dipole model [22,23]. Therefore, in this paper, we take advantage of the rectangular coil to construct a novel magnetic field device, as shown in Figure 2. The detailed works and contributions of this paper are listed in the following three perspectives.
1. An electromagnetic actuation system has been built based on rectangular coils, which can achieve 5-DoF control of a milli/microrobot in 3D working space. Moreover, the accurate mathematical model of the magnetic field has been used for force and torque estimation. Compared to other models, such as the magnetic dipole model, it can describe the distribution of the magnetic field more accurately. As a result, better performance of movement control of the robot can be achieved. 2. The dynamics model of the milli/microrobot moving in the liquid environment has been established.
Moreover, two kinds of control strategies, namely fixed-point actuation and displacement actuation have been proposed. Linear optimization (programming) has been applied to optimize the current values for magnetic field generation. 3. Experiments with open-loop control and closed-loop control have been carried out to verify the effectiveness of the proposed system and algorithm.
The rest of this paper is organized as follows: modeling of the magnetic field will be shown in Section 2, and the control method of the milli/microrobot will be introduced in Section 3. Moreover, experimental results will be shown in Section 4. Finally, conclusions will be drawn in Section 5.

Magnetic Force and Torque
The magnetic actuation system designed in this paper is to realize the movement of the milli/microrobots in 5-DOF in the workspace. Milli/microrobot can be controlled with force F and torque T from a controlled external magnetic field, where F and T are related to the magnetic field flux density B, the magnetic field gradient, and the magnetic moment M of the magnetic medium [1,24,25]. The mathematical expressions can be written as follows: where x, y and z refer to the basis directions of the global coordinate system in the Cartesian space in which all vectors are expressed, M = (m x , m y , m z ) T , and ∇ is a gradient operator. As shown in (1) and (2), the torque on the magnetic medium depends on the magnetic field since the direction of the magnetic moment M has a tendency to align with the direction of the magnetic field B. The force on the magnetic medium depends on the spatial gradient of the magnetic field because the magnetic medium has a tendency to move from a dense magnetic field to a sparse magnetic field. In the case of permanent-magnetic bodies, the magnitude of the magnetic moment M is a constant, which depends on the residual magnetization of the material [26,27]. As a result, to achieve good control performance of milli/microrobots, accurate magnetic field models of the coils are needed. However, the magnetic dipole model cannot meet the requirement. In the following part, the accurate mathematical model of the rectangular coil will be shown.

Mathematical Model of a Single Rectangular Coil
The mathematical model of the rectangular coil is established to provide a theoretical basis for the magnetic field control, to establish the actuation matrix and realize the actuation algorithm. According to the Biot-Savart law, the magnetic induction generated at a point P(x, y, z) by a current element Idl can be calculated as follows: where r is the coordinate vector of the current element; r is the coordinate vector of the space field position P; dl is the length of the microcurrent element, and its current magnitude is I; µ 0 is the vacuum permeability and equals to 4π In the case of an online current, the integral path is L , whereby the magnetic induction generated by the field source at any point in space can be calculated by the following equation As shown in Figure 3, the length, width, and height of this rectangular coil are 2l, 2w, and 2h, respectively. The direction of the current is shown in the figure using arrows. By using the center of this electromagnetic coil as the origin point, the coordinate is built. Based on the Biot-Savart Law, it is determined that the magnetic field generated by the surface current of the rectangular coil at point P = (a, b, c) T is the linear superposition of the magnetic fields generated by the currents of the respective segments of 1, 2, 3, and 4. In the X axial direction, the rectangular current loop is uniformly distributed in a single layer, whereby the magnetic component of the entire rectangular electromagnetic coil at one point can be expressed as: In our prior work, the analytical expression of the magnetic field component produced by a single rectangular electromagnetic coil at a point in space can be written as [22]: where For each given position (a, b, c) T that outside the coils, B r can be estimated based on the above equations. Therefore, torque can be calculated with (1).
Define Ψ 1 and Ψ 2 as follows: Then, Using the above equations, a derivative of (B x , B y , B z ) with respect to (x, y, z) can be obtained. Therefore, the magnetic force can be estimated with Equation (2).

Calibration
The calibration of the system is mainly in two aspects. First, it is necessary to verify whether the magnetic induction calculated by the mathematical model proposed in Section 2.2 is consistent with the actually measured magnetic induction.Next, due to the processing accuracy of the core and the error in the assembly process, the magnification of each coil is different, therefore, the driven current of coils needs to be compensated. The field is measured at six positions in the workspace with 9A current flowing through one coil. The resultant values are given in Table 1. There is a linear positive correlation between the mathematical model data and measured data. The variables α and β can be introduced to correct the model proposed in Section 2.
The mathematical model we have built describes the magnetic field distribution of the coil module without the soft magnetic core. The effect of the soft magnetic core on the spatial distribution of the magnetic field is characterized by the calibration of the magnetic field. The effect of the magnetic core on the spatial magnetic field distribution is divided into two parts. First, the magnetic core has an enhanced effect on the magnetic field excited by the coil itself; the literature [17] has verified the use of high-performance soft-magnetic material in the cores. Second, the coupling relationship between electromagnets. The magnetic field excited by an electromagnet after the current is applied can magnetize the magnetic core in the adjacent electromagnet so that the magnetic field distribution is nonlinear. For the first case, we study the change of the magnetic field strength at a fixed point when the input current increases linearly for a single-coil module (coil and core are assembled together). Figure 4 shows that the magnetic core in the eight-coil modules has a linear enhancement effect on the magnetic field distribution.The abscissa is the measured magnetic field generated by a single coil module without a soft magnetic core under different currents, and the ordinate is the magnetic field generated by a single coil module under different currents when a soft magnetic core is installed. The slope of the line connecting each scattered point and the origin of the coordinate system represents the enhancement coefficient of the magnetic field of the soft magnetic core under different input current conditions. The results in the figure show that a straight line passing through the origin of the coordinate system can be used to connect the scattered points and this characterizes the effect of the linear enhancement of the magnetic core in the workspace.  For the second case, the coupling effect of the magnetic field is temporarily unable to be described in accurate mathematical terms. Our research idea is to collect the magnetic field data to separate the linear change data in the magnetic field from the non-linear change data due to the coupling effect and estimate the non-linear quantities using approximate mathematical language. Therefore, we conducted the following experiment. Collecting the magnetic field intensity distribution of a single module and module assembly at a series of points. When the test input current sets the maximum current of the system (10 A), the offset of the magnetic field value generated by the coupling effect reaches the maximum. The test data shows that the magnetic field value offset caused by the coupling effect of 61% test points in the global range is less than 0.1 mT, 94% is less than 0.2 mT, and the maximum offset value does not exceed 0.3 mT. Therefore, we can know that the bias caused by the magnetic field bias due to the coupling effect at most points in the workspace is negligible compared to other errors introduced in the microrobot control model, such as approximate mathematical descriptions in dynamic modeling.
We tested the magnetic field strength of eight rectangular electromagnetic coils at a point in the workspace with or without a magnetic core. The magnetic field magnification of the eight coils constitutes an 8 × 8 diagonal matrix K r , which acts as a coefficient matrix of the current vector to compensate for the difference in the individual electromagnetic coils.

Mathematical Model of the Set of Coils
We have considered the following two points when designing the system configuration. First, we are more concerned with the force control of milli/microrobots, which is related to the gradient of the field, compared to the torque control. Second, the focus of the paper is on the potential of rectangular coils for remote control applications of milli/microrobots. The choice to be consistent with one typical configuration will allow for a comparison of system performance and experimental results with the previous system (Octomag). The magnetic milli/microrobot needs at least eight stationary electromagnets to obtain the desired torque and force at any point in the workspace. To date, a variety of manipulation systems have been developed, in terms of the generation of a spatial derivative in the field, which corresponds to force-generation capability, the Octomag configuration is the strongest [28].
Eight rectangular electromagnetic coils have been used to build a rectangular electromagnetic coil set actuation platform. The numbering sequence divided into two groups is shown in Figure 5. Since the actuation system does not have a priority level for each control direction of the milli/microrobot, there is no difference between the upper and lower sets of electromagnetic coil designs. For an isotropic system, eight electromagnetic coils are distributed around the Z-axis angle of 45 degrees considering the symmetry of the upper and lower groups, while the upper and lower coils and the Z-axis form an angle of 45 degrees and 90 degrees, respectively. Each electromagnetic coil acts as an independent magnetic field generating device. The central axis of the long axis of each coil intersects at a point, that is, the global coordinate system origin. The origin of the local coordinate system of the single-coil is separated from the global coordinate origin by 165 mm. The size of a single coil is 48 mm × 48 mm × 200 mm, which is l = 100 mm, w = 24 mm, h = 24 mm in the magnetic field mathematical model. Using the measured calibration values for the respective electromagnet, the magnetic field and gradient of the rectangular coil set in the workspace can be calculated through homogeneous transformation matrix, which will provide a basis for generating the milli/microrobot actuation matrix. According to the coil set design layout, the origin of the global coordinate system is in the local coordinate system of a single rectangular electromagnetic coil. Equations (15) and (16) is the transformation matrix of the global coordinate system to the local coordinate system of the magnetic actuation system.
The position of the point in the global coordinate system under the local coordinate system of each coil is obtained by solving the above equation. The magnetic induction intensity and gradient at a unit current are obtained by using the magnetic field model of the rectangular electromagnetic coil, and then the magnetic induction intensity and the gradient component for the superposition operation in the global coordinate system are obtained by the inverse rotation matrix.
Where R x (α) ∈ SO(3) is the rotation matrix around X axis of the global coordinate system by an angle (α); R y (β) ∈ SO(3) is the rotation matrix around Y axis of the global coordinate system by an angle (β); R z (γ) ∈ SO(3) is the rotation matrix around Z axis of the global coordinate system by an angle (γ).
As the capacity of the maximum current output is 10 A, the magnetic field flux density can reach approximately 15 mT when a single coil is sourced. When the other coils are considered, the magnetic field flux density can reach a magnitude of 35 mT. Obviously, the minimum value of magnetic field flux density in the work area is 0 mT.

Milli/Microrobot Dynamic Analysis
In the actuation process, in addition to actuation by an external force F m applied by the magnetic field, the milli/microrobot is also subjected to liquid viscous forces F d that opposes its direction of motion, as well as F g and buoyancy forces F b in the liquid environment. The electrostatic force and Van der Waals force have a weak influence on the milli/microrobot motion compared with the above-mentioned main forces [28][29][30][31][32] by considering the milli/microrobot's millimeter-scale shape. As a result, they both have been ignored in order to simplify the dynamic model, which is shown as follows: The liquid viscous force F d of the milli/microrobot in the liquid environment can be approximated as: where v of is the moving speed the milli/microrobot, v f is the liquid flow velocity, ρ f is the fluid density, A is the front-end area when the milli/microrobot moving, and C d is the drag coefficient, which can be estimated as follows: where R e is the Reynolds number, µ f is the dynamic viscosity coefficient of the fluid, L represents the characteristic length of the milli/microrobot. The milli/microrobot in a liquid environment receives its own buoyancy force in the vertical direction. The calculation formula is expressed by Equation (19), where V represents the volume of the milli/microrobot and ρ represents the material density of the milli/microrobot.
From the above analysis, (19) can be rewritten as (20), where k x , k y , k z are constant coefficients determined by the milli/microrobot in the actual working environment.
Control the milli/microrobot to move along a particular trajectory which can be divided into calculating the required magnetic field and gradient at discrete points on the trajectory in real-time. An example is shown in Figure 6. The milli/microrobot moves along the planned spatial curve trajectory called "mountain climbing" motion from the starting point in three-dimensional space, and the main force analysis at each point is indicated by different color arrows.

Milli/Microrobot Magnetic Actuation Algorithm
The torque and force that the milli/microrobot should be subjected to at point P can be realized based on the mapping relationship between the magnetic field contribution and the driven current vector. Assuming that the magnetic field generated at point P by the e th coil in the unit current in the global coordinate frame is expressed as B e (P). The magnetic field flux density B(P) generated at point P with eight electromagnetic coils can be represented as follows.
The gradient component of the magnetic field generated by the electromagnetic coil set along the coordinates is: where i = x, y, z. The torque and force of the milli/microrobot at position P in the workspace can be expressed by the actuation Equation (23), where A (T,F) (M) is a 6 × 8 actuation matrix.
For a milli/microrobot, the desired torque and force that the magnetic field needs to apply are determined and the current vector of the electromagnetic coil set can be obtained by (21). Since the system is over-actuated, the current vector that satisfies the above conditions is not unique. This is a convex optimization problem, and the objective function and constraints are set according to the actual requirements [33]. All movements of the milli/microrobot can be equivalent to the superposition of fixed-point actuation and linear motion actuation assuming that the milli/microrobot moves very slowly. Considering that the energy consumption and heat generation of the system are linear with the quadratic of the coil current, the objective functions in both motion states are set to the minimum of the Euclidean norm of the current vector. The constraints are derived from the deformation of the actuation equation according to the actual actuation requirements and system characteristics and it is mainly divided into two parts as shown below. These two linear optimizations are performed in the Gurobi Optimizer.

Fixed-Point Actuation
As shown in Algorithm 1, it is essential that the magnetic moment direction of the milli/microrobot is consistent with the magnetic field in the workspace under the action of the magnetic torque. At the same time, the magnetic field gradient in the local area is insufficient to generate the magnetic force for moving the position of the milli/microrobot. The inequality constraint of the current vector is set according to the current rating range of the actual actuation current source, which is determined by the actual actuation performance of the power system.

Algorithm 1 Optimization for Fixed-point Actuation
Subject to:

Displacement Actuation
As shown in Algorithm 2, the displacement of the milli/microrobot is controlled by changing the magnetic field gradient in the case where the magnetic moment of the milli/microrobot is in the same direction as the magnetic field. The key to the displacement actuation of the milli/microrobot is to consider the force of the milli/microrobot in the liquid environment and accurately control the force it receives. To decouple rotation DOF and translation DOF, the direction of the magnetic field is set to the desired orientation of the milli/microrobot (the direction of the magnetic moment of the milli/microrobot assuming the milli/microrobot is a magnetic carrier) so that the milli/microrobot exerts the desired torque simultaneously.

Algorithm 2 Optimization for Displacement Actuation
Subject to:

System Implementation
Based on the coil set layout model proposed in Section 2 , the Rect3D (see Figure 7) has been established. The electromagnet cores are made of H125, which is an FeNi alloy produced by Hengdian Group DMEGC Magnetics CO.,LTD (Dongyang city, Zhejiang province, China).Its saturation magnetization is on the order of 1500 mT, and the initial permeability is 125 H/m. Each core has a length of 30 mm, width of 30 mm and height of 30 mm. Each coil is assembled with ten cores. The power control unit is composed of a host PC and eight DC programmable power supplies, respectively, connected to the corresponding coils on the electromagnetic actuation platform. The host computer and the DC programable power supply are connected through the USB serial port, and the I/O interface control of the program control instrument is realized by using the VISA function library developed by the NI company. SCPI (Standard Commands for Programmable Instruments) command format is used to realize remote communication between the host computer and the DC power supply. The camera has a resolution of 640 × 480. Its visual standard protocol supports the Directshow protocol and Twain protocol. The camera lens uses a large multiple continuous zoom lens with an optical magnification of 0.13 ∼ 2 times and a working distance of 65 ∼ 700 mm.
The software part of the milli/microrobot magnetic actuation system includes the magnetic actuation algorithm, the power driver, the milli/microrobot real-time recognition program, and the implementation of a UI control interface. In part of the mathematical model of the spatial magnetic field distribution, the spatial magnetic field model of the rectangular electromagnetic coil combination is built by C ++ on the Qt Creator platform and is packaged into a class, which mainly includes the magnetic field solving method of the rectangular electromagnetic coil under the local coordinate system and the absolute coordinate system. The magnetic field model is used to obtain the magnetic field at the point of the absolute coordinate system of the rectangular electromagnetic coil. Combined with the milli/microrobot magnetic actuation algorithm, the mapping relationship between the magnetic field torque and the force to the input current is established. Gurobi is used to solve linear programming problems of actuating milli/microrobot based on rectangular electromagnetic coils, which can get calculation results faster and more accurately. In addition, we implemented the magnetic actuation algorithm on the Qt Creator platform to apply the Gurobi function library interface to meet the solution requirements.
Experiments were performed to demonstrate the developed system and actuation strategy. The first thing to declare is that the microrobot manufactured here is a model of the system's function demonstration. In the experimental part of the article, we choose a magnetic carrier with a regular shape to simplify dynamic modeling or reduce the impact of dynamic modeling errors on system evaluation. In order to simulate the movement of the milli/microrobot in human body fluid, the working space is filled with methyl silicone oil, of which the kinematic viscosity is 500 cst and the density is 0.97 g/cm 3 . The magnetic carrier was put in the acrylic cube placed in the XOY plane of the workspace, as shown in Figure 6c. A visual feedback system, as shown in Figure 6b, consists of two industrial cameras mounted vertically to obtain image information of the working plane XOY and XOZ. The image of the magnetic carrier was captured through image processing, and the geometrical center of the magnetic carrier was used to define the position.

Open Loop Control Results
Open-loop experiment operation process. First, preset the motion trajectory, then reversely solve the current sequence according to the mapping relationship between the current and the magnetic field distribution, and finally input the current sequence to record the motion trajectory of the milli/microrobot. We initially demonstrated that the magnetic carrier can be manipulated by fixed-point rotating under the open-loop control which can visually characterize the control accuracy of the system in the direction of the magnetic field B. The origin of the global coordinate system (X = 0 mm, Y = 0 mm, Z = 0 mm) was selected for performing experiments and fixed-point rotation experiments around the Z-axis are performed as shown in Figure 8. The purpose of this experimental demonstration is mainly to show that the system allows us to decouple degrees of freedom for rotation and translation. The orientation of the milli/microrobot converges at one point in the trajectory, and at the same time, the trajectory of its centroid point is a circle in the plane. Therefore, the two-DOF orientation motion and three-DOF translational motion of the milli/microrobot are decoupled. The magnetic carrier enable more complex spatial rotational motion. The direction of the magnetic moment of the magnetic carrier is 45 degrees from the Z-axis, and the circular rotation around the Z-axis is performed at coordinates (0, 0, 0). Table 2 illustrates the experimental results of the fixed-point rotation (a) and the errors in each situation. In the second experiment, as shown in Figure 9 we verify that the system has the ability to provide a stable direction-determining force and the magnetic carrier moving along two different diagonal lines are performed which can intuitively characterize the accuracy of the magnetic field gradient direction control.

Closed Loop Control Results
We further performed experiments of moving the magnetic carrier along the predesigned trajectory path under closed loop control. Figure 10 shows the moving sequence at different time instants, viewed from both top and the side of the workspace. Figure 11 shows 3D motion trajectory. As shown in Figure 12, the average errors of trajectory tracking were 0.44 mm.

Discussion
Here, we describe an analysis of position control error in open-loop control. Because there is no capture of the spatial position of the milli/microrobot, the results of the open-loop experiments depend on the initial position of the milli/microrobot. If the initial position of the milli/microrobot deviates from the initial position of the preset trajectory, it will cause a large deviation in the trajectory. Due to the randomness of the deviation between the initial position and the preset initial position of the micro-robot in the "up stair" and "down stair" movements, the error performance in these two cases is random (no correlation).
Theoretically, the larger the characteristic size (e.g., length, radius) of the magnetic carrier, the easier it is to be manipulated by the system. However, for medical scene applications, the millimeter-level and sub-millimeter-level dimensions are requirements for the design and manufacture of microrobots. Therefore, we use a cylindrical magnetic carrier with a diameter of 1 mm and a height of 1 mm in our experiments. The experimental results show that the system can achieve the manipulation of magnetic carriers of millimetre-level. If the size of the magnetic carrier is further reduced, the error of its posture control will increase.

Conclusions
In this study, we designed a milli/microrobot magnetic actuation system based on the rectangular electromagnetic coil to solve the actuation control problem of a milli/microrobot in the field of minimally invasive diagnosis and treatment. The mathematical model of the electromagnetic coil is used to construct the milli/microrobot actuation equation, so as to establish the mapping relationship between the torque and magnetic force of the milli/microrobot and the driven current of the coil set, and the linear programming algorithm is used to solve the driven current matrix. The three-dimensional coordinates of the milli/microrobot can be obtained in real-time through the visual feedback system, and the precise actuation of the milli/microrobot is realized. Experimental results show that the magnetic actuation system can realize the 5-DOF actuation of a milli/microrobot. Future work will improve the actuation performance of the magnetic actuation system to meet the needs of smaller magnetic milli/microrobots.