1 Introduction

Global control of a population of robots is a challenging task that requires either on-board computation (Milutinovi and Lima, 2006) or a broadcast signal (Shahrokhi et al., 2017). Group control of untethered small-scaled robots has recently become a popular research topic in the controls and robotics fields. The size limitation of these robots makes on-board computation nearly impossible (Sitti and Wiersma, 2020). Researchers have found ways to control groups of robots externally, such as applying a magnetic field (Kuthan et al., 2019). Applying varied control inputs to individual tiny robots is also difficult. One solution is using a global control input that covers all robots. This means that a single actuation controls all robots. Moving and positioning a group of robots show promising applications in fields such as biomedical engineering and biomechanics, particularly in drug delivery and tissue rehabilitation (Manshadi et al., 2018, 2019). In this study, we focus on positioning a group of small-scale robots using a shared global control input. In addition, this positioning task in a branch of pattern formation strategy that should satisfy three main characteristics: scalability, flexibility, and robustness (Bonabeau et al., 1999). Our proposed system is very scalable; by adding members to the group, the functional efficiency of the system would not be affected by changing the size of the robots. Also, this system is highly flexible; it can exhibit different and diverse sets of collective behavior. The system is robust and reliable; each member has a simple and minimalist design and is less subject to failures.

Applying the same control input to different robots results in the system being under-actuated. It means that we have a single input, but n degrees of freedom for n grouping robots. Other researchers have attempted to control this type of under-actuated system by adding extra constraints. These include placing obstacles in the workspace (Mahadev et al., 2017; Joshi et al., 2019), providing non-slip boundary contacts (Shahrokhi et al., 2017, 2019), changing the physical shape of the robot (Donald et al., 2008; Diller et al., 2011, 2013), using internal forces (Salehizadeh and Diller, 2020), and applying an external artificial force field (Vose et al., 2012). When there is a large number of the robots, it can be difficult to detect their individual positions, however Shahrokhi et al. showed that “it is possible to sense global properties such as mean position and variance” (Shahrokhi et al., 2017). In this type of group control, a covariance ellipse was defined based on the most populated region of the workspace and the mean position is at the center (Shahrokhi et al., 2019). Although they can place the mean position of the robots within the ellipse at the desired point, a number of robots outside the covariance ellipse can be missed or uncontrolled. In controlling many robots actuated by the magnetic field, independent control of each member receiving identical control input remains elusive, and the robots can not be steered independently. In the proposed algorithm, we try to demonstrate an independent group motion and pattern formation of robots under a uniform magnetic field.

Also, there are some similar positioning and pattern formation studies based on applying an external patterned magnetic field (Johnson et al., 2020; Rahmer et al., 2017; Chowdhury et al., 2017). Dong and Sitti (2020) worked on a programmable and reconfigurable system using an external static magnetic field to control the formation of micro-robots. They experimentally showed that the group motion of these robots can manipulate the objects and navigate through complex environments. Salehizadeh and Diller (2020) studied a method that independently controls the 3D motion of a pair of magnetic microgrippers. This method was only applied to two agents and used the interactions between agents to create a desired multi-agent formation. The obvious drawback of these methods is that they are limited to a small number of agents. In our proposed method, the number of agents in a group can be increased without significantly affecting ongoing task performance.

In the other side of view, some exciting articles that deal with group control and pattern formation algorithms are typically based on complex algorithms (Moan et al., 2020) or introducing hard constraints in the workspace (Shahrokhi et al., 2017). Alternatively, our approach is based on simple algorithms and avoiding manipulation of the workspace. In this work, we control a group of robots under a unified control input. The robots respond differently to the same control signal due to their different physical structures. A different geometry (length) in the present work is utilized to add another degree of control modality to the system. The objective is to move a group of robots from their initial to desired final positions, in which each robot is traceable. To achieve this objective, varying the length of the robots could be useful. Each set of desired final position and number of robots requires different sets of robot lengths.

In our previous work (Al Khatib et al., 2020), we proposed a small-scaled robot (millirobot) that was actuated by an external magnetic field. A semi elliptical-shaped millirobot was built using 3D printing and cylindrical permanent magnets were embedded at each end of the body. By changing the magnitude and the direction of the magnetic field vector, the millirobot can be actuated and moved in a specific direction. The motions are inspired by inertial actuation, which was developed in our lab (Zoghzoghy et al., 2015; Kashki et al., 2016; Razzaghi et al., 2019). Each millirobot can move in a variety of locomotion modes, such as pivot walking, tapping, and tumbling each with respective advantages and disadvantages (one can find more details in Al Khatib et al. (2020)). Among these modes, pivot walking is the fastest and most repeatable mode. Thus, we select the pivot walking as the primary mode in the present paper and the tumbling mode as the secondary one. When the global control input is applied to the millirobots, they will move parallel to each other, but their velocities will be different in the pivot walking mode due to the proportionality of their lengths. We exploit this feature to place an arbitrary number of millirobots, with pre-assigned lengths, at desired final locations. Also, the millirobots will move parallel and with the same velocities in the tumbling mode. This will give us an extra tool to move a group of millirobots.

In this paper, we propose two different designs of millirobots. A stadium shape with a cylindrical permanent magnet embedded at the center of the body is the primary design (see Fig. 1a). We should note that placing the magnets at the center of the body reduces the attraction forces between the magnets that appeared in our previous millirobots (Al Khatib et al., 2020). The new millirobots are 3D printed in four different lengths (L) as 3, 5, 7, and 9 mm. In this design, the velocities of steering the millirobots are proportional to their lengths in both pivot walking and tumbling modes of motions. In order to differentiate pivot walking and tumbling motions, we change the design by adding two legs (see Fig. 1b). In the secondary design, the lengths of the millirobots (L) are fixed at 10 mm, but they have different pivot separations between two legs (\(P_s\)) as 3, 5, 7, and 9 mm. Thus, they can move in different velocities in the pivot walking mode, but the same velocity in the tumbling mode. Figure 1d shows two 3D printed millirobots with different pivot separation. This difference gives us two fundamental flexibilities in the proposed group pattern motion. First, we can generate a specific and desired formation employing the group algorithm in the pivot walking mode; then, the formation can be moved to any desired location using the tumbling mode without any changes in the final shape. The illustration of the tumbling and pivot walking mode of motions are shown Fig. 1e and f. Also, the directions of the magnetic field required to conduct each motion are drawn.

Fig. 1
figure 1

Millirobots and motion schemes of pivot walking and tumbling modes. a CAD design illustration of a millirobot without legs (primary design). The permanent magnet is embedded at the center of the body. b CAD design illustration of a millirobot with two legs (secondary design). The red and blue colors represent the north and south poles of a magnet. c Illustrations of two legged millirobots with different pivot separations. L and \(P_s\) denote the lengths of the millirobots and pivot separation, respectively. d Actual 3D printed two millirobots with different pivot separations. e The sequences of tumbling motion; one tumbling step is achieved by rotating the magnetic vector about the y-axis by \(180^{\circ }\). f The sequences of pivot walking motion; the scheme shows a complete locomotion step. It is achieved by lifting one end and forming a pivot point at the other end by rotating the magnetic vector around the y-axis; rotate the magnetic vector about the z-axis to rotate the millirobot about the formed pivot as sweep angle; the process is then repeated in the opposite direction

A nested electromagnetic Helmholtz coil is designed and constructed to actuate the presented millirobots. This system is configured based on the optimal design presented in Abbott (2015). The large-scale coil system produces an uniform static magnetic field, which can rotate in 3D dimension. The outer diameters of coils are 39, 30.5, and 22.5 cm in x, y, and z directions, respectively. The separation distances between coil pairs are 24, 19, and 11 cm. The system has a \(12\, \text {cm}\times 12\, \text {cm}\) work space at the center of the configuration (see Fig. 2c). The coils are fabricated using insulated 12 gauge circular copper wire. Figure 2a and b show the isometric views of the CAD drawing and the actual coil system. The maximum current applied to the system is eight amps and the system can generate a continuous magnetic fields above 10 millitesla (mT). We simulate our built coils system and the magnetic field profile at the center of the configuration is measured using Comsol software as shown in Fig. 2d.

2 Mathematical model

In the locomotion of the system, we assume that two ends of the robot’s body (first design) and two legs (second design) are acting as the pivot points. A stationary electromagnet system produces a uniform rotating magnetic field in three dimensions. This rotating magnetic field generates torques on the magnets embedded into the millirobot. This aligns the long axis of the body with the applied magnetic field vector (Al Khatib et al., 2020). Thus, we are able to translate the center of mass of the body and perform rotations about the in-plane and out-of-plane angles.

2.1 Pivot walking

Pivot walking is achieved by successively alternating the direction of the magnetic field vector in the positive and negative z-directions and rotating around z-axis as shown in Fig. 1f. When the magnetic field vector is oriented in the positive z-direction, the induced magnetic torque presses one end down while the other end is lifted up. Subsequently, while having a pivot formed at the pressed end, a positive rotation about z-axis is applied. This causes the millirobot to rotate forward by a sweep angle of \(\theta _{k}\) in the \(x-y\) plane in its kth step. In the next step, the orientation of the magnetic field in z-direction is reversed, and the pivot moves to the other end. A negative rotation about z-axis is applied to rotate the millirobot by \(\theta _{k+1}\) about the new pivot point. We consider this process as a complete step. Repeating this process, locomotion along a desired path is generated. Also, a single tumbling motion step is achieved by a rotation of the magnetic field vector about x-axis by a 180 \(\deg \) as shown in Fig. 1e.

Here, we calculate the coordinates of the center of mass \((x_k,y_k)\), with k being the number of steps. The kinematic modeling of pivot walking depicted in Fig. 3a can be expressed as follows:

$$\begin{aligned} x^n_k&=x^n_0+\frac{L_n}{2}\sum _{i=1}^{k}\left( (-1)^i \cos \left[ (-1)^i \left\lfloor \frac{i}{2} \right\rfloor \theta ^1 + (-1)^{i-1} \left\lfloor \frac{i-1}{2} \right\rfloor \theta ^2 \right] \right. \nonumber \\&\quad + \left. (-1)^{i-1} \cos \left[ (-1)^{i-1} \left\lfloor \frac{i+1}{2} \right\rfloor \theta ^1 + (-1)^{i} \left\lfloor \frac{i}{2} \right\rfloor \theta ^2 \right] \right) \end{aligned}$$
(1)
$$\begin{aligned} y^n_k&=y^n_0+\frac{L_n}{2}\sum _{i=1}^{k}\left( (-1)^i \sin \left[ (-1)^i \left\lfloor \frac{i}{2} \right\rfloor \theta ^1 + (-1)^{i-1} \left\lfloor \frac{i-1}{2} \right\rfloor \theta ^2 \right] \right. \nonumber \\&\quad +\left. (-1)^{i-1} \sin \left[ (-1)^{i-1} \left\lfloor \frac{i+1}{2} \right\rfloor \theta ^1 + (-1)^{i} \left\lfloor \frac{i}{2} \right\rfloor \theta ^2 \right] \right) \end{aligned}$$
(2)

where (\(x_0,y_0\)) are the coordinates of the initial position of the millirobot, n denotes the number of millirobot, L is the length, and \((\theta ^1, \theta ^2)\) are the sweep angles around two pivot points, respectively. Also, the \(\left\lfloor . \right\rfloor \) denotes the floor function, which is the function that takes as input a real number and gives as output the greatest integer less than or equal to the input.

2.2 Basic motion paths

One can obtain different motion paths by choosing different combinations of sweep angles. Three basic motion paths explored here as tools for group control; straight, triangular, and circular paths. Figure 3 shows the schematic representations of these paths. The straight-line motion shown in Fig. 3b is generated by choosing same sweep angles for each pivot step \((\theta ^1=\theta ^2= \theta _c)\), however, the first sweep angle has to be the half of others \((\theta ^1_1 \, \text {or}\, \theta ^2_1= \theta _c/2)\). The distance covered by millirobot, in this case, is proportional to the length of the millirobot.

A triangular trajectory is achieved by selecting equal sweep angles for the first k\(^{th}\) steps (\(\theta ^1_{1:k}=\theta ^2_{1:k}= \theta _c\)) and the sweep angles are switched to negative \(\theta _c\). The two sets of steps are considered to be a complete step. If the millirobot starts from a line, after 2k steps (end by a complete step), it goes back to the same line (see Fig. 3c). The trajectory is an isosceles triangle, and equal base angles can be expressed in terms of the sweep angle \((\alpha = \frac{\pi -\theta _c}{2})\). The base (d) and height (h) of this triangle are related to the length of the millirobot, the sweep angle, and number of steps as follows:

$$\begin{aligned}&h=\frac{d}{2} \cot \left( \frac{\theta _c}{2}\right) \end{aligned}$$
(3)
$$\begin{aligned}&y_k= h \end{aligned}$$
(4)

In order to follow a circular path, two sweep angles must be different \((\theta ^1\ne \theta ^2)\). The radii of the generated circle is related to the sweep angles and length of millirobot. The equation of this trajectory can be found as:

$$\begin{aligned}&x_i^2+y_i^2=r^2_c \end{aligned}$$
(5)
$$\begin{aligned}&y_k=y_0 \end{aligned}$$
(6)

where \(r_c\) denotes the radius of circular path (see Fig. 3d). If the millirobot starts from a line, after \(2k-1\) steps, it is not guaranteed to return to the same line. Thus, the sweep angle of the last step should be performed with a different sweep angle.

Fig. 2
figure 2

A nested Helmholtz electromagnetic coil system. a Isometric view of CAD design. b Isometric view of actual system. c Top view of workspace. d Simulation result of magnetic field at the center of the workspace

Fig. 3
figure 3

Millirobot walking tools a The schematic of the pivot walking with coordinates of the center of body and the positive directions of sweep angles. b Straight line motion. c Triangular trajectory path. d Circular path configuration (Color figure online)

Fig. 4
figure 4

Changing the final distance between two millirobots. The initial distance between two millirobots is \(\Delta \, r=2 \,\text {cm}\) and the lengths of the robots are 1.5 cm for red trajectory and 0.5 cm for blue one. In both paths, the millirobots change the direction after 8 complete steps. a The sweep angle is \(\theta _c=20^{\circ } \) and the distance after at the end is approximately 1.25 cm. b The sweep angle is \(\theta _c=45^{\circ } \) and the distance at the end is approximately 1.4 cm, but the order of the millirobots is changed. c Experimental results of the position altering of two millirobots. The pivot separations are 5 and 9 mm

Consider a circular path with 2k steps. The millirobot moves k steps with sweep angle \(\theta ^1\) on the first pivot point and \( k-1 \) steps with sweep angle \(\theta ^2\) on the second pivot point. The angle between the long axis of the body and the positive direction of x-axis in each step (\(\beta _i\)) and the extra sweep angle (\(\theta _e\)) to complete the round (last step or \(2k^{th}\) step), can be calculated as:

$$\begin{aligned}&\theta _d=\left\lfloor \frac{i+1}{2} \right\rfloor \theta ^1-\left\lfloor \frac{i}{2} \right\rfloor \theta ^2 \end{aligned}$$
(7)
$$\begin{aligned}&\beta _i= \left\{ \begin{matrix} \theta _d &{} \theta _d\le 90^{\circ }\\ 180^{\circ }- \theta _d&{} \theta _d > 90^{\circ } \end{matrix}\right. \end{aligned}$$
(8)
$$\begin{aligned}&\theta _e = 180^{\circ }-\left( k\, \theta ^1-(k-1)\theta ^2\right) \end{aligned}$$
(9)

We utilize these trajectories as tools to conduct group positioning control.

2.3 Group motion using basic motion paths

Here, we consider two millirobots with different pivot separations. Initially they are placed on a straight line with a separation of \(\Delta \, r\) between them. By using triangular path planning, one can change the distance between the millirobots and reverse their initial order on the original line (see Fig. 4).

To express the position alteration of two millirobots more accurately, we conduct a parametric analysis of the effects of sweep angle and number of steps on the final positions (see Fig. 5). Figure 5a depicts the effect of the total number of steps on the final distance between two millirobots when a constant sweep angle \(\theta _c=24^{\circ } \) is used. A negative value for distance means the order of two millirobots is reversed. Also, Fig. 5b shows the alteration in the relative position of millirobots in terms of changing sweep angles in a constant number of steps \(2 k+1 = 33\). The direction of the path is altered at \(k=12\). In Fig. 5c, one can see the difference in distance between two millirobots at the end of the triangular path motion as a function of the sweep angle and number of steps (see SP 1).

Fig. 5
figure 5

Variation of the final distance between two millirobots with lengths of 2 and 1 cm for different sweep angles and number of steps, when the initial distance is 2 cm. a The sweep angle is fixed at \(\theta _c=24^{\circ } \) and the number of steps is varied. b The sweep angle is varied when the number of steps is set at 33. c Varying both sweep angle and number of steps

Based on the results shown in Fig. 5, we can claim that with a specific combination of sweep angle and number of steps, any two millirobots with different pivot separation can walk to final positions with their relative distance set to an arbitrary desired value. This claim will be proved in Sect. 3. Here, we present a formal mathematical formulation for this type of action; consider two millirobots with different lengths \(L_1\) and \(L_2\) starting on a line with a relative distance of \(\Delta \, r\). Whereas, \(\Delta \, p\) denotes the final desired value of the relative distance between two millirobots. From Eq. (1), the base of the triangle can be found as:

$$\begin{aligned} d= \Vert x_k^n-x_0^n\Vert =f_x(L_n, \theta _c,k) \end{aligned}$$
(10)

where \(f_x(.)\) is a function of three parameters (\(L_n,\theta _c,k\)), which can be extracted from the right hand side of Eq. (1) and the combination set can be expressed as follows:

$$\begin{aligned} S=\left\{ \left( \underset{i=1,2}{L_i},\theta _c,k\right) \, \,\Vert \,\, \underset{i=1,2}{d_i= f_x\left( L_i, \theta _c,k\right) },\right. \nonumber \\ \left. d_2=\Delta \,r+d_1\pm \Delta \,p\right\} \end{aligned}$$
(11)

where \(d_1\) and \(d_2\) are the bases of triangular paths for each millirobot. One can use this motion path to change the order of any number of millirobots initially placed on a straight line. Subsequently, we conduct an experiment to show this ability only for three millirobots with different pivot separations due to the restriction imposed by the size of the workspace (see Fig. 6 and SP 1). The sequence order of the millirobots is completely related to the selection of the sweep angles and number of steps. For this example, any sequence order of three millirobots is achievable. We should also note that in the following figures of the experimental results, we just show a select number of steps in the overlay pictures to highlight the overall path of the group motions without overcrowding the figures. One can see the experiments in the videos provided in the supplementary materials.

Fig. 6
figure 6

Sequences of changing order of three millirobots with 3, 5, and 9 mm in pivot separations. This maneuver is performed in 30 steps. The millirobots are approximately moving two steps per second

We also present a group motion of two millirobots using the basic paths. This group motion shows the capability of the walking tools. We assume that the initial and final positions of two millirobots are \((r_1,r_2)\) and \((p_1,p_2)\), respectively. Without loss of generality, we consider that the length of millirobot 2 \((m_2)\) is greater than millirobot 1 \((m_1)\) (\(L_1<L_2\)). Thus, \(m_2\) moves faster and undergoes longer triangular path. This motion consists of three walking runs including a line with a slope, triangular path, and straight line motions to generate a group pattern motion. Figure 7 shows an illustration of simulation and experimental results of the group motion of two millirobots with different lengths (see SP 2).

Fig. 7
figure 7

Group pattern motion of two millirobots with 3 and 9 mm lengths. a Illustration of group motion. Initial positions are marked by squares and final ones by circles. Dashed lines show the paths of the centers of millirobots in three runs. b Simulation result of walking two millirobots. c The experimental result of the group motion of two millirobots

3 Controllability analysis

The kinematic equations of motion of the \(\text {i}{th}\) robot can be represented using a unicycle model as follows:

$$\begin{aligned} \dot{x}_i&= u_r \cos {\left( \theta + \frac{\pi }{2}\right) } + u_{p_i} \cos {\theta } \end{aligned}$$
(12)
$$\begin{aligned} \dot{y}_i&= u_r \sin {\left( \theta + \frac{\pi }{2}\right) } + u_{p_i} \sin {\theta } \end{aligned}$$
(13)

where \(u_r= K_t L_r \) is the tumbling speed and \(u_{p_i}=K_p L_{p_i}\) is the pivot walking speed. The terms \(K_t\) and \(K_p\) are speed constants in tumbling and pivot walking modes. The \(L_r\) and \(L_{p_i}\) denote the length of robot and pivot separation respectively. One can write Eqs. (12) and (13) in matrix form as:

$$\begin{aligned}&\dot{\varvec{x}}_i = \varvec{A} \varvec{x}_i + \varvec{B}_i \varvec{u} \overset{\text {where}}{\rightarrow } \varvec{x}_i = \begin{bmatrix} x_i \\ y_i \end{bmatrix} \\&\varvec{A} = \begin{bmatrix} 0 &{}0 \\ 0 &{} 0 \end{bmatrix} ;\, \,\, \varvec{B}_i = \begin{bmatrix} 0 &{} \nu _i &{} -1 &{} 0\\ \nu _i &{} 0 &{} 0 &{} 1 \end{bmatrix} \\&\text {and} \, \varvec{u}= \begin{bmatrix} K_p L_r \sin \theta \\ K_p L_r \cos \theta \\ K_t L_r \sin \theta \\ K_t L_r \cos \theta \end{bmatrix} ;\text {where} \,\, \nu _i=L_{p_i}/L_r \end{aligned}$$

This model can be generalized to describe the group system as follows:

$$\begin{aligned}&\dot{\bar{\varvec{x}}} = \textbf{A} \bar{\varvec{x}} + \textbf{B} \varvec{u} \nonumber \\&\bar{\varvec{x}} = \begin{bmatrix} x_1&y_1&\cdots&x_n&y_n \end{bmatrix}^T_{2n \times 1} \end{aligned}$$

where \(\textbf{A}\) is \(2n \times 2n\) zero matrix, and \(\textbf{B}\) is a \(2n \times 4\) matrix represented as:

$$\begin{aligned} \textbf{B} = \begin{bmatrix} 0 &{} \nu _1 &{} -1 &{} 0\\ \nu _1 &{} 0 &{} 0 &{}1 \\ \vdots &{} \vdots &{} \vdots &{}\vdots \\ 0 &{} \nu _n &{} -1 &{} 0\\ \nu _n &{} 0 &{} 0 &{}1 \\ \end{bmatrix}_{2n \times 4} \end{aligned}$$
(14)

The controllability matrix \(\mathbb {C}\) of the group system can formulated as:

$$\begin{aligned} \mathbb {C} = \begin{bmatrix} \varvec{B}, \varvec{A}\varvec{B}, \varvec{A}^2\varvec{B}, \cdots , \varvec{A}^{2n-1}\varvec{B} \end{bmatrix} \end{aligned}$$
(15)

For a system with only one robot, the rank of \(\mathbb {C}\) is two, which means all degrees of freedom (DOF) are controllable. For a group system with two robots with different lengths (\(\nu _1 \ne \nu _2\)), the rank of matrix \(\mathbb {C}\) is four, which means the system is controllable. This capability of group system for two robots is numerically and experimentally shown in Sect. 2.3 and Fig. 7. We showed that the robots are steered into their corresponding desired final positions from arbitrary initial positions.

For group systems with more than two robots, the rank of \(\mathbb {C}\) will be still four, which means only four DOFs are controllable. Hence, the motions of other robots are related to the motion of the fully controllable ones. This is exactly the basis of our group algorithm.

In a n-millirobot group system with different lengths, there are 2n DOFs, which the controllability analysis shows that only four of them are controllable. One can select any four DOFs and control them separately. In this study, we choose only one controllable millirobot and propose a group algorithm based on its controlled DOFs.

It is worth to mention that the controllability analysis results are directly tied to the fact the external input translate into applying the same rigid body transformations to move the millirobots in tumbling and pivot walking modes. The pivot walking is scaled by the constant \(\nu _i\) for each robot. This parameter linearly depends on the pivot separation or the length of each millirobot.

4 Group position control

The proposed group control methodology often requires a priori determination of the lengths of the millirobots required to perform a specific placement task. In this section, we present an algorithm that yields the required robot lengths, sweep angles, and number of steps to move millirobots from their initial positions to desired final destinations.

Algorithm 1 is used to position n millirobots from initial positions to corresponding final destinations. This positional control of n millirobots can be carried out by calculating the lengths of millirobots based on their initial positions and desired final destinations. The algorithm presents the process of finding different sets of \((L_n, \theta _n,k_n)\) to perform this task. It is worth to mention that the number of millirobots in a group completely depends on the size of the robots, magnets, and workspace. By reducing the robot’s length, we can place a smaller magnet, which causes having less attraction force between magnets. Consequently, we can use more miniature robots in the control system.

Remark 1

Based on Moser’s shadow problem theory in discrete and combinatorial geometry (Lagarias et al., 2019), each bounded convex polygon with n vertices in a 2D plane, there is some direction such that, when illuminated by parallel light rays from infinity, the polygon’s vertices cast a shadow on a line perpendicular to the light direction.

The final desired position of each millirobot can be considered as a vortex of a simple polygon. Based on the theory aforementioned, we can map each desired final position of millirobot on a specific line as the start line (it is not unique), where can be their initial positions (see Fig. 8).

Fig. 8
figure 8

Mapping of desired final destinations to a start line. The red line indicates the leader millirobot’s path, which has the longest length (Color figure online)

Let’s consider the first millirobot as the leader. Without loss of generality, let’s assume that it has the longest possible length (biggest pivot separation) and it needs to move between two furthest corresponding initial position and final destination (red dashed line in Fig. 8). The leader \((m_1)\) moves to its final position with straight motion based on Eqs. (1) and (2), by calculating the set \(S_1=\{(\theta _{c1},k_1) \, \Vert \, \text {straight motion} \, , \, (x_0^{1},y_0^{1}) \rightarrow (x_f^{1},y_f^{1})\}\). Using this set and applying it to Eqs. (1) and (2) for other millirobots, the coordinates of midpoint position of each millirobot \((x_1^i,y_1^i\,; i=2:n)\) can be expressed as a function of their lengths \((L_i \,; i=2:n)\), sweep angle, and number of steps. The relative distance between the initial and final positions of a midpoint of each millirobot is also a function of its length, sweep angle, and number of steps. By solving the resulting equations, one can get the sets of millirobot lengths, sweep angles, and the number of steps off-line. Then, the millirobots can be placed at their initial positions and the group control can be conducted by applying the solution sets (\(S_{\text {group}}\)).

figure d

5 Results

5.1 Group pattern motions

In this section, we experimentally demonstrate the group position control of the millirobots to generate different geometrical shapes including triangle, square, pentagon, and hexagon patterns (see SP 3). The edges of each shape are considered as the final desired positions of each millirobot. In these experiments, we use the secondary design of the millirobots, in which the pivot separations are fixed at 3, 5, 7, and 9 mm. By using the reverse solutions of Algorithm 1, one can find the desired initial positions to perform a group motion. In addition, we use the tumbling motion to move the final shape of patterns. This capability is the strength of the presented group motion. Any desired pattern can be generated through Algorithm 1 and then the final pattern can be placed anywhere by using the tumbling mode motions. Figure 9 depicts the experimental result of the group position motions to generate a Hexagon pattern. This group motion is conducted by six millirobots with three different lengths. We use two millirobots of each length, which are 3, 7, and 9 mm. The millirobots start at points \(r_i; \,\, i=1:6\). They move to points \(p_i; \,\, i=1:6\) in pivot walking mode to generate the desired hexagon pattern. Then, they are steered in tumbling mode to reach their corresponding final points \((q_i; \,\, i=1:6)\). Also, it should be noted that in the figure we only show the experimental results of the hexagon pattern to reduce the complexity (the videos are included in the supplementary materials for the information of the readers).

Fig. 9
figure 9

Group motions of six millirobots to generate a hexagon pattern. Each dashed color-line represents the path of the midpoint of each millirobot. The initial and final positions are shown by squares and circles symbols, respectively. a Six millirobots start from their initial positions (\(r_i; \,\, i=1:6\)) and move to points \(p_i; \,\, i=1:6\) in pivot walking mode to generate a hexagon pattern. b The millirobots are steered to their final positions (\(q_i; \,\, i=1:6\)) in tumbling mode while the hexagon pattern is preserved

5.2 Group application

The objective of controlling a group of robots is to perform a task, which is not possible to perform with a single robot. Here, we numerically and experimentally show extra practical applications of the group motions of these millirobots. We should note that we assume that there are no collisions among the millirobots during their motions or any interaction between them.

5.2.1 Expansion maneuver

A group of four primary-design millirobots conducts a maneuver that expands from a contracted initial formation to an expanded one. We call this maneuver “Expansion”. The simulation of the expansion maneuver is conducted as follows; the group starts from a relatively compact initial positions. Then, a circular motion is performed to place the robots in front of a narrow opening while fixing their relative distances at specific values. This formation makes it possible for the group to go through the channel by using straight-line motion. After passing the channel, depending on whether we require horizontal or vertical expansion, the subsequent scenarios are different. For instance, after formation undergoes the walking sequences to pass through the channel, they are steered on an inclined straight line to adjust their positions on subsequent circular paths. In the end, a circular motion is carried out to bring all millirobots to their final positions. (see Fig. 10 a). We experimentally demonstrate the expansion maneuver conducted by four millirobots. They are placed in specific compact initial positions to minimize the attraction forces between the magnets. Figure 10b shows a selected sequence of frames of experimental results of the expansion maneuver. The millirobots start from their initial positions (\(r_i; \,\, i=1:4\)). They move in a circular path to a location in front of the opening; then, walk in a straight line formation to go through the channel. In the end, circular and line motions are performed to expand the formation and reach final destinations (\(p_i; \,\, i=1:4\)) (see SP 4).

Fig. 10
figure 10

Sequences of the horizontal expansion maneuver of four millirobots with different lengths as 3, 5, 7, and 9 mm. a The simulation and b the experimental result of of the expansion maneuver. The compacted initial and the final expanded formations are indicated by gray and black dashed polygons, respectively. Each dashed line represents the path of the midpoint of each millirobot

5.2.2 Contraction maneuver

A group of millirobots is placed on the respective expanded formation of initial positions. Then, they undergo a reverse sequence of motions explained in the expansion maneuver. They are steered to the intermediate compact positions in front of a narrow channel and walked through it. In the end, a maneuver is performed in order to place the millirobots in respective desired final positions. Alternatively, the contraction maneuver can be named as the reverse maneuver of expansion motions.

5.2.3 Reverse maneuver

Under the same control input, all millirobots move in the same direction. A challenging task is to steer the millirobots in opposite direction by applying the same magnetic field. We propose a walking plan to move two millirobots from a set of initial positions to the desired set of final destinations, which requires an opposite direction motion. We name this maneuver “Reverse”. Figure 11a shows an illustration of this maneuver. This walking plan consists of five sequences; including two pivot walking and three tumbling mode motions. The millirobots are placed on the top side of the two obstacles. They should pass a narrow channel with a width of \(W_c\) and be positioned at the other side of the obstacles.

We conduct an experiment to show the reverse maneuver as follows (see Fig. 11b); two millirobots with different pivot separations (3 and 9 mm) are placed at their corresponding initial positions (\(r_1,r_2\)). Here, the millirobot placed at \(r_1\) has bigger pivot separation than the other one. First, they move to the point 1 in pivot walking mode to reduce the relative distance between them until it reaches less than \(W_c\). Then, they tumble back to the point 2, as the relative distance between the millirobots remains constant. They tumble through the channel and pass it to the point 3. Then, they are steered to the point 4 in the pivot walking mode to increase the relative distance between them. At the end, they tumble to their final destinations (\(p_1,p_2\)) (see SP 5).

Fig. 11
figure 11

Sequences of the reverse maneuver of two millirobots with different pivot separations as 3 and 9 mm. a The scheme of the reverse maneuver. b The experimental result

We should note that the experiments are conducted on a dry surface. Thus, we observe slippages at the pivot points in different situations. As we have pre-defined control inputs acting on the system, we can not overcome the effects of the slippages on the final outputs. This causes the experimental misplaced positions of millirobots from their simulated and desired final destinations. There are not any trends or similarities for the misplacement and are due to un-modeled friction on the surface. The solution for this problem would be to add a closed-loop controller to correct the motion of each millirobot (Khatib et al., 2021), which will be proposed in our next study.

6 Conclusion

This study proposed a pre-computational technique for group position control of small-scale robots using uniform input. The paper presented an algorithm for the positioning of n-robot system actuated by a uniform magnetic force field. The unique millirobots introduced in our previous study (Al Khatib et al., 2020) modified in design. We placed magnets at the center of the body to reduce the magnetic attraction forces. Also, we added two legs acting as pivot points. In new design, by varying the pivot separation and keeping identical lengths, the millirobots can move in different velocities in pivot walking mode and constant velocity in tumbling mode. To obtain different positional outcomes out of steering millirobots under the same control input, we used millirobots with different lengths as well as variable pivot separation in pivot walking mode.

First, we presented two modified designs of millirobots and listed their advantages. Then, we demonstrated different walking tools, which were utilized for the group motions. We analyzed the controllability of the group system and showed that up to two millirobots are fully controllable. We used only one controlled millirobot as the leader and developed an algorithm to place n millirobots that follow the leader while moving from arbitrary initial positions to other arbitrary final positions. Accordingly, the required lengths of the follower millirobots were calculated based on the coordinates of the initial and final positions and a pre-computational path planning to perform the group motions. We verified the proposed algorithm for group positioning the millirobots through simulation and experiments. Also, we conducted different experiments to show the capability of our millirobots to perform a group task.

There were position errors in the experimental results due to slippage effects. For the next step, we are working on a closed-loop control strategy to conduct more precise experiments. Also, there are more possibilities in changing the design of millirobots to reach extra control modality and increase the scalability of the system for future studies.

7 Supplementary materials

One can find the following videos as supplementary materials.

SP 1 ::

Changing order of two and three millirobots.

SP 2 ::

Group motion of two millirobots

SP 3 ::

Group motion to generate different geometrical shapes.

SP 4 ::

Expansion maneuver.

SP 5 ::

Reverse maneuver.