Introduction

The research on swarm navigation, referring to guiding a collective of agents to traverse an environment together, has captured increasing attention in recent years1,2,3,4,5,6. By harnessing the collective intelligence of autonomous entities, swarm navigation not only facilitates efficient traversal of unexplored terrains7,8,9 but also extends its utility to various sectors such as logistics10,11, disaster response12, and agriculture13. In logistics, swarm navigation allows us to optimize route planning among multiple vehicles, enhancing transportation efficiency and reducing costs10,11. In disaster response, it enables coordinated efforts among robotic teams to support disaster monitoring and survivor searching12. In agriculture, it supports precision farming techniques, monitoring crop health, and automating tasks to increase productivity and minimize environmental impact13.

However, using conventional robotic platforms such as UAVs and UGVs in swarm navigation has notable drawbacks, including their relatively large size and limited mobility. These drawbacks pose practical challenges, especially in constrained or crowded environments where spatial limitations impede effective task execution. In addition, their ability to operate in large terrains is directly constrained by the battery capacity, which limits endurance and overall efficiency.

This study introduces cyborg insects as a solution to the limitations of traditional robots in swarm navigation. Cyborg insects (Fig. 1a), which combine living insects with miniature electronic controllers, offer several advantages over conventional robots14,15,16,17,18. One of the advantages is their energy efficiency. Unlike robots, which typically rely on power-consuming drive mechanisms such as motors for locomotion, cyborgs exploit the natural mobility of insects and require less energy consumption16,18. Cyborgs can also adapt to complex terrains14,15. They can effortlessly maneuver around obstacles of various shapes and sizes and easily traverse through narrow spaces. Additionally, cyborgs are equipped with sophisticated sensing systems, which enable them to rapidly perceive and respond to the environment17.

Fig. 1: Overview of the cyborg swarm navigation.
figure 1

a A cyborg insect. In this work, the Madagascar hissing cockroach (Gromphadorhina portentosa) was chosen for the cyborg system. A backpack circuit board attached to the insect was designed to house the necessary systems, including the locomotion control system and wireless communication module. It was powered by a rechargeable LiPo battery. How to prepare a cyborg insect is detailed in the supplementary materials. b An illustration of cyborg swarm navigation (top view). A decentralized algorithm was proposed to navigate the cyborg swarm to a designated goal through a sandy area in the presence of hills and obstacles. All the cyborgs have no information about obstacles and hills in the field. c The side view and (d) the back view of a cyborg swarm. A comprehensive presentation of this work can be found in Supplementary Video 1.

Because of these features, research on cyborgs has recently gained increasing attention. Studies on cyborgs in19,20 have mainly demonstrated their functionality in obstacle-free environments. Works in21,22,23 allow a single cyborg to navigate in rather complicated terrain by manually manipulating it along a preplanned path. In addition, the cyborg developed in18 can navigate to predetermined destinations and autonomously traverse unknown terrain. However, despite the aforementioned achievements in single-cyborg control, to the best of our knowledge, the multi-cyborg navigation problem has not been addressed in the literature (an illustration of a cyborg swarm can be seen in Fig. 1b–d).

A multi-agent system presents numerous advantages compared to a single-agent system, such as fault tolerance24,25, distributed problem-solving26,27, and applicability to large-scale problems28. Furthermore, the multi-cyborg system offers unique benefits, particularly in terms of enhanced robustness and intelligence. Regarding robustness, the interactions among the cyborgs in a multi-cyborg system can improve their ability to recover from an overturn because a well-designed swarm control algorithm can allow overturned cyborgs to be surrounded by neighbors that provide support points and aid in their rapid recovery. Additionally, the swarm behavior of a multi-cyborg system contributes to its intelligence. When a cyborg encounters a potentially difficult area, it slows down and attempts to navigate through or around the obstacle. Neighboring cyborgs will maneuver around the slowed cyborg in the same way they would avoid obstacles. Consequently, this maneuvering leads the neighboring cyborgs to bypass the challenging area that caused the slowdown. This cooperative behavior is similar to common human strategies, such as selecting shorter checkout lines in supermarkets for faster service. Furthermore, with appropriately designed swarm control algorithms, cyborgs that bypass the challenging zone can collectively assist the individuals trapped therein, resulting in the passage of the entire swarm.

While multi-cyborg systems offer various advantages over single-cyborg systems, controlling multiple cyborg insects presents many challenges. As partly biological entities, cyborg insects retain natural instincts that limit control precision compared to robots, with each insect responding differently to the same stimulus. Managing a single cyborg may be feasible despite this variability, but controlling a swarm presents a challenge. Advanced techniques such as adaptive control may be able to drive cyborgs to desired positions, but they often require intensive stimulation. This level of stimulation increases the risk of habituation, where the responsiveness of cyborgs to control signals diminishes over time. The process is believed to involve synaptic changes in the nervous system, where the neurons become less responsive to the stimulus due to decreased neurotransmitter release or receptor sensitivity29. Furthermore, certain innate behaviors of cyborg insects can even hinder the application of conventional swarm control logic. For instance, efforts to use stimulation for separating cyborg insects in close proximity often prove unsuccessful, frequently causing one insect to climb onto another, which results in entanglement. The entanglement presents a potential risk, as it may damage the cyborg’s backpack or its connection to the insect, making the cyborg non-functional. Collectively, these issues demonstrate that conventional control methods are not well-suited for managing cyborg swarms.

To address these challenges, we propose a swarm control algorithm specifically tailored for cyborg insects. This algorithm not only adapts to the unique characteristics of cyborg insects but also leverages these traits for effective swarm navigation. It offers improvements over conventional methods in terms of safety, endurance, and adaptability. Specifically, our algorithm harnesses the insects’ natural instincts, enabling efficient navigation through complex terrains without the need for precise locomotion control. The intermittent control inputs generated by our algorithm help mitigate habituation, thereby extending operational time. Additionally, our control strategy reduces the risk of entanglements among cyborgs, enhancing overall swarm safety. Experimental validation has confirmed the effectiveness of the proposed algorithm. Unlike previous studies that tested control algorithms in idealized settings, such as flat plains, our research demonstrates that both the control algorithm and the design of cyborg insects are adaptive and robust in navigating complex obstructed environments.

Results

Swarm navigation algorithm design

The proposed algorithm in this paper can navigate a swarm of cyborgs from the start to a predetermined goal in an unknown sandy terrain in the presence of obstacles and hills (Fig. 2a). The multi-cyborg system to be controlled is composed of a leader and several followers, with agents capable of basic directional steering and forward motion. Each agent can detect neighbors within a limited sensing range and distinguish the leader from the followers. Only the leader is given the position of the goal. The proposed algorithm consists of two main components: motion planning and trajectory tracking (Fig. 2b). The motion planning algorithm provides the desired positions of cyborgs for the next time step based on their local information. The trajectory tracking algorithm then receives this information and computes the corresponding amplitude and types of stimulation (left, right, or acceleration) to be applied to the insects.

Fig. 2: Navigation algorithm design for a cyborg swarm.
figure 2

a The cyborg swarm consists of a leader and several followers. Each cyborg can detect neighbors within a limited sensing range, and distinguish the leader and followers. Only the leader is given the position of the goal. b An illustration of the proposed navigation algorithm. It consists of two parts: motion planning and trajectory tracking. The motion planning algorithm provides the desired positions of cyborgs for the next step based on their local information and passes it to the trajectory-tracking algorithm. The trajectory tracking algorithm computes the corresponding amplitude and types of stimulation (left, right, or acceleration) to be applied to the insects.

Our motion planning algorithm was developed based on the observed behavior of tourists who follow a tour leader. Specifically, the algorithm consists of the following two clear and simple rules. The first rule is the free motion (FM) rule, which grants followers the freedom to move either when the leader is visible or when they remain close to the crowd. Otherwise, they adhere to the move-toward-crowd (MTC) rule, which guides followers toward the leader when visible and toward the direction of the crowd when not visible. Combining these rules, we propose the Tour Group Inspired (TGI) control algorithm. It can be applied to the multi-cyborg system: if the number of neighbors mi within follower i’s free range (i.e., a circular area around it whose radius is smaller than its sensing range) is less than a threshold M, follower i follows the MTC rule; otherwise, it makes free motions. When the followers calculate mi, the leader is given a higher weight than an individual follower. As a result, when the leader moves out of follower i’s free range, the follower perceives the loss as equivalent to several neighbors, often falling below the threshold M. This triggers follower i to follow the leader, maintaining group cohesion and preventing the condition that the leader walks away while the group stays behind.

Note that an individual in free motion mode may not actively follow the swarm at all times. However, the control algorithm ensures that if the number of neighbors of a “free” follower falls under the threshold, it will be re-stimulated to rejoin the group. This mechanism allows the individual to temporarily engage in free motion while still maintaining overall cohesion with the swarm. Moreover, this mechanism also mitigates the risk of entanglements that occur when cyborgs are stimulated in close proximity. If a cyborg insect is in an area with a sufficient number of neighboring insects, it is allowed to move freely without stimulation. In this unstimulated state, cyborgs rely on their natural instincts to maneuver around nearby insects, thereby avoiding entanglements.

We then present the details of our trajectory tracking algorithm design. We note that two types of stimulation, steering (left or right) and acceleration, can be applied to the insects. To determine the type of stimulation, the algorithm operates as follows. For each follower i, the algorithm first divides its free range into several sectors. Then, the algorithm selects an arbitrary cyborg from the target sector (the one with the most neighbors) as the target cyborg, and steers the follower toward it. If angle θi between the current moving direction of follower i and a line connecting itself with the target cyborg is less than a threshold θthreshold, steering is not applied, and the algorithm proceeds to the acceleration decision. The rule that governs the acceleration is designed as follows. No acceleration will be applied if follower i’s speed vi exceeds a certain threshold vthreshold. Otherwise, acceleration will be applied, and its magnitude is proportional to the distance between the follower and the target cyborg. This magnitude is bounded by the maximum voltage (2.5V) a cyborg can bear. Details of the control algorithm design are given in the Supplementary Materials.

Our TGI control algorithm capitalizes on the free motions of insects, potentially enhancing efficiency in obstacle and terrain negotiation. Additionally, the utilization of free motions decreases the frequency of electric stimulations on insects. Consequently, it reduces the likelihood of habituation of insects, saves the battery power of the backpack, and, in turn, prolongs the utilization of the cyborgs. Moreover, the FM rule in the TGI algorithm mitigates the impact of insects’ individual variability on control performance. Specifically, the FM rule enables free motions of cyborgs in densely packed parts of the swarm, effectively averting entanglements and thereby bolstering the robustness of the multi-cyborg system.

Experimental verification of the proposed algorithm

The feasibility of the proposed swarm navigation algorithm is tested under real-world experiments in a proof-of-concept but challenging scenario. Ten trials of experiments were conducted to demonstrate the reproducibility of experiments.

The experiments used 20 cyborgs as the robot platform in a 3.5m by 3.5m sandy field with rocks and hills (Supplementary Fig. 1c). Among the 20 cyborgs, there is one leader, and the other 19 are the followers. The leader agent was assigned a designated goal position, whereas the 19 follower agents were only provided the relative positions of their intermediate neighboring agents. As aforementioned, the followers can distinguish between the leader and the followers. All the cyborgs have no information about obstacles and hills in advance. The leader was guided to the target using the algorithm proposed in our previous study18, while the followers were controlled using the TGI algorithm developed in this work. Details of the experimental setup are given in the Supplementary Materials.

The proposed control strategy has been successfully implemented on the multi-cyborg system, effectively guiding the swarm to the designated goal area. To demonstrate the reproducibility of experiments, ten trials of experiments were conducted. We summarize the corresponding results in Fig. 3. An illustration of the cyborg swarm navigation experiments in unknown obstructed terrain is provided in Fig. 3a. The trajectories of the cyborgs are presented in Fig. 3b, where the leader’s path, the followers’ trajectories, the positions where cyborgs were stimulated, and the final positions of all 20 cyborgs are presented with a yellow curve, blue curves, red circles, and black dots, respectively. Figure 3c shows the corresponding top view of Exp 1. The results of Exp 2 to 10 are illustrated in Fig. 3d. In Fig. 3d, a noticeable deviation of the leader in Exp 2 is observed, where it appears to jump to a different position and then return to its designated trajectory. This is due to the leader’s marker, which is utilized for localization within the VICON motion capture system, becoming contaminated and temporarily untrackable for >5 s. During this period, the control algorithm was unable to monitor the leader’s precise position. The following mechanism was designed to mitigate such disruptions. When the leader’s marker becomes untrackable, the followers navigate toward the leader’s last known position, ensuring group cohesion and preventing the group from dispersing. Once the VICON system reacquires the leader’s marker, the control algorithm re-engages, guiding the leader back to its intended trajectory, at which point the follower agents resume real-time tracking.

Fig. 3: Summary of swarm navigation experiments.
figure 3

a An illustration of experiments in an obstructed soft terrain (front view). b Path plot of Exp 1. c The top view of Exp 1. The video of Exp 1 is Supplementary Video 2. d Path plots of Exp 2 to 10. In Exp 2, the leader’s marker was untrackable for >5 s, but the followers maintained group cohesion by moving to the leader’s last known position. They resumed tracking the leader after it gained its trackability. e The degree of autonomy for the leader under conventional control (yellow) and the followers under our proposed control algorithm (blue) in 10 trials of experiments. The error bars denote the standard deviation. Our approach nearly doubles the cyborgs' free-motion time, effectively mitigating the likelihood of habituation of insects. Source data are provided as a Source Data file.

The degree of autonomy depicted in Fig. 3e illustrates the efficacy of the proposed algorithm in leveraging insects’ instincts. In this study, we define the degree of autonomy for the multi-cyborg system as follows: For each experimental trial, we calculate the ratio \({A}_{k}^{l}\) for the leader and average ratio \({A}_{k}^{f}\) for the followers in trial k, between the time without stimulation and the whole experimental period. Then, the degree of autonomy of the total 10 trials of experiments is defined as \({{{\Sigma }}}_{k=1}^{10}{A}_{k}^{l}/10\) for the leader, and \({{{\Sigma }}}_{k=1}^{10}{A}_{k}^{f}/10\) for the followers. As illustrated in Fig. 3e, the blue bar indicates the degree of autonomy of the followers, while the yellow bar represents the degree of autonomy of the leaders. The error bars denote the standard deviation. Under conventional control, the leader’s degree of autonomy averaged 0.26 across 10 experimental trials, while the followers, under the proposed control algorithm, attained an average degree of autonomy of 0.5. Our approach nearly doubles the cyborgs’ free-motion time, effectively mitigating the likelihood of habituation of insects, saving the battery power of the backpack, and in turn, prolonging the utilization of the swarm system.

Discussion

During the experiments, several other intriguing phenomena demonstrated the features of the proposed TGI control algorithm:

  • The employment of free motions reduces entanglements among cyborgs, thus leading to a higher safety of the multi-cyborg system.

  • The interactions among neighbors may facilitate a trapped cyborg to escape a difficult situation.

  • Neighbors can help a cyborg recover from an overturn, which, in turn, enhances the robustness of a cyborg swarm.

These features are detailed as follows.

First, the TGI control algorithm improves the safety of the multi-cyborg system by reducing entanglement between cyborgs. Our experiments showed that cyborgs instinctively avoid collisions with neighbors during free movement. However, when two cyborgs approached each other too closely and the separation rule from the conventional BOIDS algorithm30 was applied to stimulate the cyborgs to move away from each other, they failed to separate and instead became entangled. Entanglement can lead to undesirable results, such as damage to the cyborgs. This problem was often encountered with the conventional control based on the BOIDS algorithm when neighbors became too close. As depicted in Fig. 4a, the central line within the box indicates the median entanglement number, while the boundaries represent the 25th and 75th percentiles (lower and upper quartiles). The whiskers extend to the smallest and largest entanglement numbers within 1.5 times the interquartile range from the quartiles. This figure demonstrates that the proposed TGI algorithm reduces entanglements compared to the BOIDS algorithm. Figure 4b depicts entanglements where multiple cyborgs overlap, whereas Fig. 4c shows closely positioned but non-entangling cyborgs. The feasibility of using free motion to prevent entanglement is demonstrated in Fig. 4d and e. When the cyborgs approached each other, the BOIDS method tried to separate them by applying intensive stimulation, which proved to be unsuccessful (Fig. 4d). Conversely, the proposed TGI control exploited the free motion of the cyborgs, taking advantage of their innate behaviors to avoid entanglement (Fig. 4e).

Fig. 4: Comparison between the experimental results under the conventional BOIDS and the proposed TGI algorithms.
figure 4

a The frequency of entanglements in 10 trials of experiments, respectively, under two control algorithms. The central line within the box indicates the median entanglement number, while the boundaries represent the 25th and 75th percentiles (lower and upper quartiles). The whiskers extend to the smallest and largest entanglement numbers within 1.5 times the interquartile range from the quartiles. The number of entanglements under the proposed TGI algorithm is notably lower than that under the BOIDS algorithm. b An illustration of entanglements: when parts of two or more cyborgs overlap with each other. Entanglement can lead to undesirable results, such as damage to the cyborgs. c A group of close but non-entangling cyborgs. d The minimum distance among all pairs of cyborgs circled out in experimental snapshots in one trial of experiments conducted with the BOIDS algorithm. Red points indicate instances where at least one of those cyborgs received electrical stimulation. The frequent stimulations on cyborgs that were too close to each other led to entanglements (distance < 6 cm). e The minimum distance in one trial of experiments under TGI control. The TGI algorithm leverages insects' instincts to prevent entanglements. The corresponding snapshots reveal that cyborgs can move closely without entanglements under TGI control. The experiment results are shown by Supplementary Video 3. Source data are provided as a Source Data file.

Second, the interactions among neighbors can help a trapped cyborg escape a difficult situation. As shown in Fig. 5a, in an experiment, a cyborg’s “Y” shape marker became wedged on the edge of an obstacle. Meanwhile, following the proposed control algorithm, other cyborgs were navigated around the cyborg, which indirectly let the swarm bypass the obstacle. Furthermore, it is noteworthy that, in line with the MTC rule of the proposed control algorithm, cyborgs bypassing challenging zones can assist trapped cyborgs, facilitating the passage of the entire swarm. As illustrated in the snapshots, when the cyborg marked by a yellow circle initially became wedged on an obstacle, it remained unstimulated due to its proximity to the neighbors. However, when the neighbors were bypassing the stuck one (t  = t2), they started to “attract” it (stimulations were reapplied to the cyborg), pulling it away from the obstacle.

Fig. 5: The process of an immobilized cyborg being saved by neighbors.
figure 5

a Entangle and detach from obstacles. A cyborg’s “Y” shape marker became wedged on an obstacle (t = t2), and the corresponding displacement almost remained the same during this period. Then the surrounding cyborgs navigated around the trapped one and the obstacle (t = t3). Through our algorithm, the trapped cyborg gradually overcame the obstacle with the “attractive force” from other cyborgs, and the displacement started changing again. The red dots in the displacement plot represent electrical stimulations applied to the cyborgs. Finally, the cyborg detached from the obstacle (t = t4). See Supplementary video 4. b Recover from an overturn. The gray bar in the bar chart denotes the time interval of a self-attempted period for recovery of an overturned cyborg. The bar’s bottom and top indicate the start and ending moments. Similarly, the purple bar denotes the time taken for recovery with help from a neighbor. In Cases 1 and 3, the overturned cyborg first attempted and failed to recover by itself for a while, then successfully recovered by grabbing a passing neighbor. The corresponding recovery processes are illustrated by the snapshots. The experiment results are shown by Supplementary Video 5. Source data are provided as a Source Data file.

Third, neighbors can aid a overturned cyborg for more efficient uprighting. Although neighboring cyborgs may navigate around an overturned cyborg in a manner similar to how they avoid obstacles, they also play a passive yet crucial role in facilitating its recovery. The overturned cyborg can utilize interactions with nearby teammates, such as physical contact or grasping, to aid in uprighting itself. This cooperative interaction enhances the overall resilience of the swarm without requiring direct, algorithmic intervention. The bar chart in Fig. 5b illustrates three cases of self-attempted and neighbor-aided recovery from overturns. The discrepancy in recovery performance is particularly evident in Case 3, where a cyborg struggled for 26.5 s before grasping a passing neighbor and then successfully recovered in only 4.5s. Snapshots of Cases 1 and 3, where cyborgs recovered with the help of neighbors, are also provided in Fig. 5b, respectively. The proposed TGI control algorithm ensures the presence of neighbors around each cyborg and, in turn, enhances the robustness of the multi-cyborg system.

In summary, our approach offers advantages over conventional control methods in terms of safety, endurance, and adaptability when applied to cyborg swarms. Without relying on precise locomotion control, our algorithm achieves a compact swarm through adjustable parameter design and effectively harnesses insects’ instincts for efficient obstacle negotiation in complex, obstructed terrains. Additionally, our algorithm mitigates the risk of habituation and extends operational time by reducing the need for control inputs by an average of 50% compared to the individual control. This reduction is accomplished through the free-motion and move-toward-crowd rules, which leverage the insects’ natural motion while maintaining swarm cohesion. Furthermore, our algorithm mitigates the risk of entanglements that can destabilize the swarm and damage the cyborgs, using a switching mechanism between stimulated and free motions based on local swarm compactness. Experiments demonstrate that this design reduces the number of entanglements by over 85% on average compared to the BOIDS method, enhancing the overall safety of the swarm system.

Note that although the control algorithm proposed in this work is theoretically decentralized, the cyborgs in our experiments were provided data from a centralized motion capture system. To achieve decentralized sensing, enabling cyborgs to directly measure distances between each other, we propose a hybrid approach for future work that combines Inertial Measurement Unit (IMU) and Ultra-Wideband (UWB) technologies. Specifically, each cyborg insect will be equipped with a low-power IMU to measure yaw, pitch, and roll angles. This data will be used to estimate position by analyzing body vibrations during locomotion, with speed derived from step frequency and position calculated through time integration. To mitigate IMU drift, UWB modules will be deployed to periodically update each insect’s position using precise distance measurements. This decentralized hybrid IMU-UWB system can provide robust, accurate localization for the cyborgs without a motion capture system. It can be a promising direction for the practical utilization of the proposed control strategy.

Methods

Control algorithm design

Let us define the position of a cyborg by \({{{\bf{q}}}}_{i}(t)\in {{\mathbb{R}}}^{2}\), velocity by \({{{\bf{V}}}}_{i}(t)\in {{\mathbb{R}}}^{2}\), and orientation by a unit vector \({{{\bf{o}}}}_{i}(t)\in {{\mathbb{R}}}^{2}\), at time t. Without loss of generality, we assign i =  0 for the leader and i ≠  0 for followers. For cyborg i at time t, we define the sets of its neighbors by

$${{{\mathcal{N}}}}_{i}(t)=\{j\in \{0,\ldots,N\}\backslash \{i\}\,| \,0 < \parallel {{{\bf{q}}}}_{j}(t)-{{{\bf{q}}}}_{i}(t)\parallel \le {r}_{s}\},$$
(1)

where N is a positive integer and rs is a positive constant, denoting the radius of the sensing range. Similarly, we define

$${{{\mathcal{M}}}}_{i}(t)=\{j\in \{0,\ldots,N\}\backslash \{i\}\,| \,0 < \parallel {{{\bf{q}}}}_{j}(t)-{{{\bf{q}}}}_{i}(t)\parallel \le {r}_{{{\rm{free}}}}\},$$
(2)

where positive constant rfree denotes the radius of the free range. Thus

$${m}_{i}=| {{{\mathcal{M}}}}_{i}|,$$
(3)

is the number of neighbors in the free range of cyborg i. Note that rfree < rs.

Based on these definitions, the swarm control algorithm is detailed as follows. It consists of two rules:

  • FM rule: for cyborg i {1, …, N} (followers), if the number of neighbors within the free range mi >  M where M is a positive integer, it engages in free motions; otherwise, it follows the rule below.

  • MTC rule: for cyborg i {1, …, N}, its sensing range is divided into s sectors, and steered to the target sector (the one with the largest number of neighbors where the leader is counted as N cyborgs). On the other hand, the leader i =  0 is driven to the goal position. The aforestated functions are realized by

    $${{{\bf{f}}}}_{m,i}(t)=\left\{\begin{array}{ll}{{{\bf{p}}}}^{{{\rm{goal}}}}(t)-{{{\bf{q}}}}_{i}(t),\quad &i=0,\hfill \\ {{{\bf{p}}}}^{{{\rm{target}}}}(t)-{{{\bf{q}}}}_{i}(t),\quad &i\in \{1,\ldots,N\},\end{array}\right.$$
    (4)

    where pgoal(t) and ptarget(t) denotes the position of a target cyborg (an arbitrary cyborg in the target sector) and the goal for the leader, respectively. Then, the desired orientation of cyborg i can be computed by

    $${{{\bf{o}}}}_{i}^{{{\rm{des}}}}(t)={{\upphi }}({{{\bf{f}}}}_{m,i}(t)),$$
    (5)

    where \(\phi :{{\mathbb{R}}}^{2}\backslash \{{{\bf{0}}}\}\to {{\mathbb{R}}}^{2}\backslash \{{{\bf{0}}}\}:{{\bf{x}}}\mapsto \frac{{{\bf{x}}}}{\parallel {{\bf{x}}}\parallel }.\)

    Note that the following repulsion function can also be integrated into the MTC rule to achieve a rather sparse swarm: cyborg i is steered away from a neighbor j at time t, according to

    $${{{\bf{f}}}}_{r,i}(t)=\left\{\begin{array}{ll}{{\bf{0}}},\hfill &i=0,\hfill \\ -{\sum }_{j\in {{{\mathcal{N}}}}_{i}(t)}\frac{1}{\parallel {{{\bf{q}}}}_{j}(t)-{{{\bf{q}}}}_{i}(t){\parallel }^{2}}({{{\bf{q}}}}_{j}(t)-{{{\bf{q}}}}_{i}(t)),\quad &i\in \{1,\ldots,N\}.\end{array}\right.$$
    (6)

    Combining these functions, the desired velocity of follower i is computed according to

    $${{{\bf{V}}}}_{i}^{{{\rm{des}}}}(t)={k}_{m}{{{\bf{f}}}}_{m,i}(t)+{k}_{r}{{{\bf{f}}}}_{r,i}(t),$$
    (7)

    where kmkr are constant weights. Then, the desired position \({{{\bf{q}}}}_{i}^{{{\rm{des}}}}(t)\) of cyborg i can be computed by

    $${{{\bf{q}}}}_{i}^{{{\rm{des}}}}(t)={{{\bf{q}}}}_{i}(t)+{{{\bf{V}}}}_{i}^{{{\rm{des}}}}(t){{\Delta }}t,$$
    (8)

    where Δt denotes the time step.

Thus, one defines the position error of cyborg i by \({{{\bf{e}}}}_{q,i}(t)={{{\bf{q}}}}_{i}^{{{\rm{des}}}}(t)-{{{\bf{q}}}}_{i}(t)\) and the orientation error by \({{{\bf{e}}}}_{o,i}(t)={{{\bf{o}}}}_{i}^{{{\rm{des}}}}(t)-{{{\bf{o}}}}_{i}(t)\). The angle between \({{{\bf{o}}}}_{i}^{{{\rm{des}}}}(t)\) and oi(t) is denoted by θi, and the speed of agent i is represented by vi. The computed eq,i(t), eo,i(t) and the measured θivi are passed to the trajectory tracking algorithm summarized in Algorithm 1 in the Supplementary Information.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.