Square matrix movement control method and device and electronic equipment
By receiving movement commands, generating a set of target coordinates, and sorting them, the problem of low computational efficiency in military formation movement in existing technologies is solved, achieving efficient and accurate formation movement control and reducing conflicts and confusion between units.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU BOGUAN TELECOMM TECH LTD
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies have low computational efficiency in controlling the movement of military formations, resulting in unstable game frame rates or serious issues such as soldiers cutting in and blocking each other, making it difficult to balance computational efficiency and formation maintenance.
By receiving movement commands, a set of target coordinates is generated, the current state is obtained, and the matching relationship between the unit and the target coordinates is determined based on sorting, thereby controlling the movement of the unit.
It achieves precise control of the formation movement, improves efficiency and accuracy, reduces conflicts and chaos during unit movement, and ensures overall coordination.
Smart Images

Figure CN121911104A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and in particular to a method and device for controlling the movement of a square formation, a storage medium, and an electronic device. Background Technology
[0002] In strategy games, controlling the movement of army formations is a core technology; however, existing solutions suffer from significant technical flaws. Traditional formation pathfinding algorithms typically calculate paths for each soldier unit individually, requiring complex real-time collision detection to ensure unit avoidance. While this approach achieves basic cluster movement, the computational load increases exponentially with the number of units, resulting in enormous performance overhead when handling large-scale army movements, leading to unstable frame rates and even stuttering. A simplified approach simply calculates the shortest path for each soldier, using a "hole-to-person" or "person-to-hole" allocation method. While this significantly reduces performance pressure, it easily leads to soldiers weaving in, blocking, or even getting stuck during movement, severely disrupting the visual presentation and tactical intent of the army formation. Therefore, existing technologies struggle to balance computational efficiency and formation maintenance in formation movement, necessitating a solution that guarantees both high efficiency and prevents unit weaving.
[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] The purpose of this invention is to provide a method and apparatus for controlling the movement of a square array, a storage medium, and an electronic device, thereby overcoming, to at least to some extent, one or more problems caused by the limitations and defects of related technologies.
[0005] According to one aspect of this disclosure, a method for controlling the movement of a square array is provided, the method further comprising: Receive a movement command for a target array, the movement command including the target position, target formation size and target orientation vector corresponding to the target array; Based on the target location, target formation specifications, and target orientation vector, a target coordinate set is generated, which contains the target coordinates of each unit in the target matrix. Obtain the current state of the target square formation, which includes the current position, current formation size, and current orientation vector; Based on the current state and the preset movement type, the target coordinate set is sorted to determine the allocation order of each target coordinate; Match each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates; Based on the aforementioned correspondence, each unit is controlled to move towards its corresponding target coordinate.
[0006] According to another aspect of this disclosure, A square array movement control device, the device comprising: The receiving module is used to receive movement instructions for the target array, the movement instructions including the target position, target formation size and target orientation vector corresponding to the target array; The first generation module is used to generate a target coordinate set based on the target position, target formation specifications and target orientation vector, wherein the target coordinate set contains the target coordinates of each unit in the target matrix; The acquisition module is used to acquire the current state of the target array, which includes the current position, current formation size, and current orientation vector. The determination module is used to sort the target coordinate set based on the current state and the preset movement type, and determine the allocation order of each target coordinate; The second generation module is used to match each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates. The control module is used to control each unit to move towards the corresponding target coordinates according to the correspondence.
[0007] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the array movement control method described in any of the preceding claims.
[0008] According to another aspect of this disclosure, an electronic device is provided, comprising: Processor, display device; and Memory for storing the executable instructions of the processor; The processor is configured to execute any of the above-described square array movement control methods by executing the executable instructions.
[0009] The method for controlling the movement of a square formation provided in this application involves receiving a movement command for a target square formation, the movement command including the target position, target formation specification, and target orientation vector corresponding to the target square formation; generating a target coordinate set based on the target position, target formation specification, and target orientation vector, the target coordinate set including the target coordinates of each unit in the target square formation; obtaining the current state of the target square formation, the current state including the current position, current formation specification, and current orientation vector; sorting the target coordinate set based on the current state and a preset movement type to determine the allocation order of each target coordinate; matching each unit in the target square formation with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates; and controlling each unit to move towards the corresponding target coordinate based on the correspondence. This method enables precise control of the movement of the square formation. Through reasonable coordinate allocation and matching algorithms, it improves the efficiency and accuracy of square formation transformation, while reducing conflicts and confusion during unit movement, ensuring the overall coordination of the square formation movement. Attached Figure Description
[0010] The above and other features and advantages of this disclosure will become more apparent from the detailed description of exemplary embodiments thereof with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: Figure 1 This is a cloud interaction system architecture diagram according to an exemplary embodiment of the present disclosure; Figure 2 This is a flowchart of a square array movement control method according to an exemplary embodiment of this disclosure; Figures 3(a)-3(b) are schematic diagrams illustrating the sorting of the target coordinate set in an exemplary embodiment of this disclosure; Figures 4(a)-4(e) are schematic diagrams of an array variation in an exemplary embodiment of this disclosure; Figure 5 This is a diagram illustrating the composition of a square array movement control device according to an exemplary embodiment of this disclosure; Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium according to an exemplary embodiment of the present disclosure; Figure 7 This is a composition diagram of an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0011] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0012] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0013] It should be noted that the information (including but not limited to user input information, such as information entered by the user into input boxes), data (including but not limited to data used for analysis, stored data, and displayed data, such as context code, all code of the current project, the service pressure corresponding to operations performed on all code of the current project, and the code development status of the current project), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards. For example, the context code, operations performed on all code of the current project, the corresponding service pressure, and the code development status involved in this application were all obtained with full authorization.
[0014] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of the invention described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0015] It should also be noted that the various trigger events disclosed in this manual can be preset, and different trigger events can trigger the execution of different functions.
[0016] In one embodiment of this disclosure, a matrix movement control method can run on a terminal device or a server. The terminal device can be a local terminal device. When the display control method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and client devices. Figure 1The figure shows a cloud interaction system architecture diagram provided in this disclosure. As shown, the cloud interaction system may include: a client device 10 and a server 20, wherein the client device 10 can be connected to the server 20 via a network 30.
[0017] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separate. The storage and execution of the movement control are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the terminal device for information processing is the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.
[0018] In an alternative implementation, the terminal device can be a local terminal device. Taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading, installing, and running the game program via an electronic device. The local terminal device can provide the graphical user interface to the player in various ways, such as rendering it on the terminal's display screen, or providing it to the player through holographic projection. For example, the local terminal device can include a display screen for displaying the graphical user interface, which includes game screens, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.
[0019] This embodiment provides a method for controlling the movement of a square array. Figure 2 This is a flowchart of a square array movement control method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps: Step S1: Receive a movement command for the target array, the movement command including the target position, target formation size and target orientation vector corresponding to the target array; Step S2: Based on the target position, target formation specifications, and target orientation vector, generate a target coordinate set, which contains the target coordinates of each unit in the target square matrix; Step S3: Obtain the current state of the target array, which includes the current position, current formation size, and current orientation vector; Step S4: Based on the current state and the preset movement type, sort the target coordinate set to determine the allocation order of each target coordinate; Step S5: Match each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates; Step S6: Based on the correspondence, control each unit to move to the corresponding target coordinate.
[0020] The method provided in this embodiment enables precise control of the square matrix movement. Through reasonable coordinate allocation and matching algorithms, the efficiency and accuracy of the square matrix transformation are improved, while reducing conflicts and confusion during unit movement and ensuring the overall coordination of the square matrix movement.
[0021] The steps described above are explained in detail below.
[0022] In step S1, a movement command for the target array is received. The movement command includes the target position, target formation specification, and target orientation vector corresponding to the target array.
[0023] The movement command is a control signal containing all the parameter information required for the matrix transformation, used to guide the matrix in transitioning from its current state to the target state. The movement command uses a unified data structure to carry key parameters, ensuring the accuracy and consistency of the matrix movement process.
[0024] In an optional implementation, the movement command can be generated and transmitted via user interface input, program call, or network communication, containing complete information required for the formation transformation. For example, in a military exercise scenario, the commander inputs a movement command via the console with target position coordinates (100, 200), formation size of "5×4", and orientation vector of "northeast 45 degrees". This command is parsed and transmitted to the formation control module for processing.
[0025] In an optional implementation, the movement instructions are stored in a structured data format to facilitate parsing and invocation by subsequent processing modules, while also supporting batch processing and real-time updates. For example, the movement instructions can be stored in JSON format, containing fields such as targetPosition, formationSize, and directionVector. Each field has a clearly defined data type and value range to ensure data validity and integrity.
[0026] The target position is the spatial coordinate of the square array after its movement, serving as a reference point for the overall position of the square array. The target position is typically represented by the coordinates of the square array's center point, providing a spatial positioning basis for subsequent coordinate calculations.
[0027] In an optional implementation, the target location can be a specific point in a two-dimensional or three-dimensional coordinate system, with the appropriate coordinate representation method used depending on the application scenario. For example, in the movement of a military formation on a planar map, the target location can be represented as a two-dimensional coordinate system (x=150, y=300), where the x-axis and y-axis represent the distances in the east-west and north-south directions, respectively.
[0028] In one optional implementation, the target location supports both relative and absolute coordinates. Relative coordinates are calculated with the current location as a reference, while absolute coordinates directly specify the specific location in the global coordinate system. For example, relative coordinates can be expressed as "move forward 50 meters, move right 30 meters", while absolute coordinates are directly specified as the GPS coordinates "39.9 degrees North latitude, 116.4 degrees East longitude".
[0029] The target formation specification refers to the formation configuration parameters to be formed after the square formation has moved, defining the arrangement and spatial distribution of units within the square formation. The target formation specification describes the overall structural characteristics of the square formation through parameters such as the number of rows, columns, and unit spacing.
[0030] In one optional implementation, the target formation specification can include detailed parameters such as the number of rows, the number of columns, the row spacing, and the column spacing, supporting various formation types such as rectangles, rhombuses, and wedges. For example, a "6×8" rectangular formation specification means that the square formation contains 6 rows and 8 columns, totaling 48 units, with a row spacing of 2 meters and a column spacing of 1.5 meters, forming a regular rectangular formation.
[0031] In an optional implementation, the target formation specification supports dynamic adjustment and adaptive configuration, automatically optimizing formation parameters based on the number of available units and terrain conditions. For example, when the number of available units is 50, the terminal device can automatically calculate the optimal formation configuration as "5×10" or "7×7+1", and select the most suitable formation specification based on the width limitations of the terrain.
[0032] The target orientation vector represents the direction the square array will face after its movement, used to determine the orientation of each unit within the array and the overall orientation. The target orientation vector represents the spatial orientation of the square array through angles, azimuths, or vector coordinates.
[0033] In an optional implementation, the target orientation vector can be represented using various methods such as angles, radians, or direction vectors, supporting 360-degree omnidirectional orientation settings. For example, the target orientation vector can be represented as "45 degrees east of north" or "angle value is 45°", or the same direction information can be represented using a unit vector (0.707, 0.707).
[0034] In one optional implementation, the target orientation vector supports two setting modes: relative orientation and absolute orientation. Relative orientation adjusts the angle based on the current orientation, while absolute orientation directly specifies the target direction. For example, relative orientation can be set to "rotate 90 degrees clockwise", while absolute orientation is directly set to "facing due north". The terminal device performs corresponding angle calculations and conversions according to different setting modes.
[0035] In one specific application, the terminal device receives a complete movement command instructing a 36-soldier square formation to move from its current 6×6 square formation to the target position (200, 150), transforming it into a 4×9 rectangular formation, and adjusting its orientation from due north to 45 degrees northeast. The terminal device parses this movement command, extracting three key parameters: target position, target formation specifications, and target orientation vector. This provides fundamental data support for subsequent coordinate calculations and path planning.
[0036] In step S2, a target coordinate set is generated based on the target position, target formation specifications, and target orientation vector. The target coordinate set contains the target coordinates of each unit in the target matrix.
[0037] The target coordinate set is a data structure containing the target position information of all units in the square formation. It precisely describes the specific position of each unit in the target formation in the form of spatial coordinates. The target coordinate set provides a clear spatial target for the movement control of the square formation, ensuring that each unit has a clear destination for movement.
[0038] In an optional implementation, the target coordinate set is stored using a data structure such as an array or list. Each element contains a unit identifier and the corresponding target coordinate information, supporting fast query and traversal operations. For example, the target coordinate set can be represented in the format [(unit1, (x1,y1)), (unit2, (x2,y2)), ..., (unitN, (xN,yN))], where each tuple contains a unit identifier and the corresponding two-dimensional coordinate value.
[0039] In an optional implementation, the target coordinate set supports multi-dimensional coordinate information, including extended attributes such as orientation angle and altitude, in addition to basic position coordinates. For example, in a three-dimensional air formation, target coordinates can be represented as four-dimensional information (x, y, z, θ), where (x, y, z) represents the spatial position and θ represents the aircraft's heading angle, providing comprehensive target parameters for precise formation control.
[0040] The coordinate calculation process involves mathematical operations to generate specific coordinate values based on input parameters. It determines the precise position of each unit within the target formation through geometric transformations and numerical calculations. The coordinate calculation process requires comprehensive consideration of multiple factors, including formation geometry, spatial transformations, and orientation adjustments.
[0041] In one alternative implementation, the coordinate calculation process first determines the geometric center and basic grid structure of the formation, then performs a rotation transformation based on the orientation vector, and finally performs a translation operation based on the target position. For example, for a "3×4" rectangular formation, 12 grid positions are first generated in the standard coordinate system, then a rotation transformation is performed based on the target orientation vector, and finally the entire formation is translated to the target position to obtain the final target coordinates of each unit.
[0042] In an optional implementation, the coordinate calculation process employs a matrix transformation mathematical method. Spatial transformation is achieved through a combination of rotation matrices and translation vectors, ensuring the accuracy and consistency of the calculation results. For example, the terminal device uses a two-dimensional rotation matrix [[cosθ, -sinθ], [sinθ, cosθ]] to rotate the initial grid coordinates, where θ is the target orientation angle. Then, the target position vector is added to complete the translation operation, resulting in the final target coordinate set.
[0043] In a specific application, after receiving parameter information that the target position is (100, 200), the target formation size is "5×4", and the target orientation vector is 90 degrees, the terminal device first generates a standard 5x4 grid coordinate system, then applies a 90-degree rotation transformation to all coordinate points, and finally translates the transformed coordinates as a whole to the target position (100, 200), generating a target coordinate set containing 20 target coordinates, each coordinate precisely corresponding to a target position of one unit in the square matrix.
[0044] In step S3, the current state of the target array is obtained, which includes the current position, current formation size, and current orientation vector.
[0045] The current state represents the real-time status information of the formation before its movement, including key parameters such as its spatial position, formation configuration, and orientation. The current state provides the starting conditions for movement planning and path calculation, and is crucial input data for formation movement control.
[0046] In an optional implementation, the current state is obtained through a real-time monitoring and data acquisition system, including the position information of each unit in the formation, the overall parameters of the formation, and measurement data of the orientation. For example, the precise coordinates of each unit are obtained through a GPS positioning system, the current row and column configuration is analyzed through a formation recognition algorithm, and the current orientation angle is measured through an electronic compass or gyroscope to form a complete state dataset.
[0047] In an optional implementation, the current status information supports real-time updates and historical records, enabling the tracking of changes in the formation's status and providing time-series data support for motion control. For example, the terminal device updates the formation's current status information every second and stores historical status data in a time-series database, facilitating the analysis of the formation's movement trajectory and performance indicators, while also providing a data foundation for handling abnormal situations.
[0048] The current position provides spatial location information for the entire array, typically represented by the coordinates of the array's center point or reference point. It serves as a starting reference point for calculating movement distance and path planning, and is fundamental data for determining the direction and distance of movement.
[0049] In one alternative implementation, the current position is calculated using the geometric center of all unit positions in the matrix, or a preset reference unit position is used to represent the position of the entire matrix. For example, for a matrix containing 25 units, the terminal device calculates the arithmetic mean of the coordinates of all units as the current position, or directly uses the coordinates of the central unit of the matrix as the representative value of the current position.
[0050] In one optional implementation, the current location supports multiple coordinate systems and accuracy levels, allowing for the selection of appropriate positioning methods and coordinate representations based on the application scenario. For example, a GPS coordinate system can be used for large-scale outdoor movement, achieving meter-level accuracy; while a local coordinate system can be used for precise indoor control, achieving centimeter-level accuracy, ensuring that the location information meets control accuracy requirements in different application scenarios.
[0051] The current formation specification refers to the existing formation configuration parameters of the square array, describing the current arrangement and spatial distribution of units within the array. The current formation specification provides initial configuration information for formation transformation calculations and is a crucial basis for determining movement complexity and transformation strategies.
[0052] In an optional implementation, the current formation specifications are obtained through a real-time formation recognition algorithm, which analyzes the relative positional relationships of units in the square and automatically identifies parameters such as the number of rows, columns, and spacing. For example, the terminal device can identify detailed information such as a "6×6" square formation, a unit spacing of 2 meters, and a formation integrity of 95% by analyzing the spatial distribution pattern of each unit.
[0053] In an optional implementation, the current formation specification includes formation integrity assessment and anomaly detection functions, capable of identifying issues such as missing units, positional deviations, and arrangement anomalies within the formation. For example, when a missing unit is detected at a certain position, the system marks the anomaly in the current formation specification and considers this factor in subsequent movement control, adjusting the corresponding matching strategy and movement path.
[0054] The current orientation vector represents the overall orientation information of the matrix, indicating the direction in which each unit in the matrix faces. The current orientation vector provides a starting direction reference for orientation transformation calculations and is the fundamental data for determining rotation angles and turning strategies.
[0055] In one alternative implementation, the current orientation vector is calculated using the average orientation of units in the matrix, or the orientation of a reference unit is used to represent the orientation of the entire matrix. For example, the terminal device collects orientation data from all units in the matrix and calculates the average of its vectors as the current orientation vector, or directly uses the orientation of the matrix's command unit as a representative of the overall orientation.
[0056] In one optional implementation, the current orientation vector supports multiple measurement methods and representation formats, including different angular references such as magnetic north, true north, and relative angles. For example, magnetic north is used as the orientation reference in military applications, while true north is used in civilian navigation. The terminal device selects the appropriate angular reference according to application requirements and provides conversion functions between different formats.
[0057] In a specific application, the terminal device acquires the current status information of the formation in real time through a sensor network, including obtaining the current position coordinates (50, 100) through GPS, determining the current formation size as a "4×5" rectangular formation through image recognition, and measuring the current orientation vector as 0 degrees due north through an electronic compass. This status information provides accurate starting conditions for subsequent movement planning and control.
[0058] In a method for controlling the movement of a square formation according to an embodiment of this application, generating a set of target coordinates based on the target position, target formation specifications, and target orientation vector includes: Step S21: Determine the number of rows and columns of the target square array according to the target formation specifications; Step S22: Using the target position as a reference point, and combining the target orientation vector and the number of rows and columns of the target matrix, calculate the target coordinate position of each unit; Step S23: Store the target coordinate positions in the target coordinate set in sequence.
[0059] The method provided in this embodiment enables the precise generation of the spatial coordinate distribution of each unit in the square formation through the technical means of parameterized configuration of formation specifications and calculation of reference points. This achieves precise control and efficient generation of the square formation, improving the accuracy and operational efficiency of the square formation movement control.
[0060] The above plan will be explained in detail below.
[0061] In step S21, the number of rows and columns of the target square array are determined according to the target formation specifications.
[0062] The target formation specification defines the parameter configuration information for the spatial layout of the square formation, including key attributes such as the geometric shape, size, and unit spacing of the square formation. Specifically, the target formation specification is used to determine the overall framework structure of the square formation, providing basic spatial layout parameters for subsequent coordinate calculations. Its function is to transform the abstract concept of formation into calculable numerical parameters.
[0063] In one optional implementation, the target formation specification defines the specific layout of the square array by combining the number of rows and columns and the unit spacing. For example, when the terminal device receives configuration information that the target formation specification is "5×4 square array, unit spacing 2 meters", it can parse that the target square array should contain 5 rows and 4 columns, a total of 20 unit positions, and the distance between adjacent units is 2 meters.
[0064] In an optional implementation, the target formation specification may also include the shape type and density parameters of the square matrix to support different types of formation configuration requirements. For example, when the target formation specification is defined as "rectangular square matrix with standard density parameters", the terminal device determines a rectangular arrangement with 6 rows and 8 columns according to a preset density calculation rule.
[0065] The number of rows and columns are the basic numerical parameters describing the spatial distribution of the matrix, representing the number of units arranged in the vertical and horizontal directions, respectively. The determination of the number of rows and columns directly affects the overall size and spatial occupancy of the matrix. Their role is to provide the basic framework of the spatial grid for coordinate calculation, and their function is to divide a continuous spatial region into discrete unit location points.
[0066] In one alternative implementation, the number of rows and columns can be obtained directly by parsing the numerical parameters in the formation specification, or indirectly calculated by the total number of units and the arrangement rules. For example, when the formation specification explicitly specifies "8×6 square matrix", the terminal device directly extracts the parameter values of 8 rows and 6 columns.
[0067] In an optional implementation, the number of rows and columns can also be dynamically calculated and determined based on the total number of available units and preset arrangement optimization rules to achieve the best formation layout effect. For example, when the total number of available units is 24 and an approximately square array is required, the terminal device determines the optimal configuration of 5 rows and 5 columns through mathematical calculation (considering that the actual number of units is adjusted to 5×5 to remove one position).
[0068] In a specific application, the terminal device receives formation specification information containing "10×8 standard infantry square". It first parses the specification parameters and identifies that the target square needs to be arranged into a rectangular structure of 10 rows and 8 columns, with each row containing 8 unit positions, for a total of 80 unit positions, providing a clear spatial framework for subsequent coordinate generation calculations.
[0069] In step S22, using the target position as a reference point, and combining the target orientation vector and the number of rows and columns of the target matrix, the target coordinate position of each unit is calculated.
[0070] The reference point serves as the origin for spatial positioning of the square formation. It is typically chosen as the geometric center of the square formation or a specific landmark location as the starting point for coordinate calculations. The role of the reference point is to provide a unified spatial positioning reference for the entire square formation, ensuring that the calculation of all unit coordinates has a consistent reference system. Its function is to map the abstract formation layout onto a specific geographic spatial coordinate system.
[0071] In an optional implementation, the reference point is typically chosen as the geometric center of the matrix as the origin for coordinate calculation, and the relative positions of each unit are calculated outward from this center point. For example, when the matrix is a 6×4 layout, the terminal device sets the geometric center of the matrix as the reference point coordinates (x0, y0), and then calculates the specific coordinates of the 24 unit positions distributed outward from this point.
[0072] In an alternative implementation, the reference point can also be selected as the left corner of the front row of the formation or the command position as the starting point for calculation, to adapt to different tactical needs and spatial constraints. For example, in a confined space, the terminal device may select the left end of the front row of the formation as the reference point (x0, y0), and then calculate the coordinate positions of each unit sequentially to the right and backward according to the row and column order.
[0073] The orientation vector is a three-dimensional or two-dimensional vector parameter describing the overall orientation of the matrix, used to determine the matrix's rotation angle and direction of movement in space. The orientation vector defines the spatial attitude of the matrix, enabling coordinate calculations to adapt to different orientation requirements; its function is to convert standard row and column coordinates into actual spatial coordinates conforming to a specified orientation.
[0074] In one alternative implementation, the orientation vector represents the facing direction of the matrix in the form of an angle value or a direction vector, affecting the rotation transformation calculation of all unit coordinates. For example, when the orientation vector is (0, 1) representing due north, the terminal device calculates the coordinates according to the standard row and column layout; when the orientation vector is (1, 0) representing due east, a 90-degree rotation transformation is required for all coordinates.
[0075] In an alternative implementation, the orientation vector can also support the matrix layout of complex terrain in the form of a three-dimensional vector, including parameters such as pitch and yaw angles. For example, in mountainous terrain, the orientation vector may contain tilt angle information (0.8, 0.6, 0.2), and the terminal device needs to calculate the unit coordinate distribution adapted to the terrain tilt based on this vector.
[0076] Coordinate calculation is a mathematical operation that converts row and column position information into actual spatial coordinates, involving spatial transformation operations such as translation, rotation, and scaling. The purpose of coordinate calculation is to transform abstract formation structures into executable position commands, generating precise spatial positioning data for unit movement control.
[0077] In an optional implementation, coordinate calculation converts the standard row and column positions into actual spatial coordinates through matrix transformation, taking into account factors such as unit spacing, reference point offset, and orientation rotation. For example, for a unit in the i-th row and j-th column, the terminal device first calculates the offset (dx, dy) = (j-spacing, i-spacing) relative to the reference point, and then applies a rotation transformation of the orientation vector to obtain the final coordinates.
[0078] In an alternative implementation, coordinate calculations can also take into account advanced factors such as terrain adaptation and obstacle avoidance, fine-tuning and optimizing the standard calculation results. For example, when a terrain obstacle is detected at a calculation location, the terminal device can adjust the coordinates of that location appropriately to ensure that all units can occupy suitable ground positions.
[0079] In a specific application, after receiving parameters with a reference point of (100, 200), an orientation vector of due north, and a matrix size of 4×3, the terminal device first determines the center position of the matrix, and then calculates the specific coordinates of 12 units at unit intervals of 2 meters: the first row from (98, 198) to (102, 198), the second row from (98, 200) to (102, 200), the third row from (98, 202) to (102, 202), and the fourth row from (98, 204) to (102, 204).
[0080] In step S23, the target coordinate positions are stored sequentially into the target coordinate set.
[0081] Sequential storage is the process of organizing and saving coordinate data in an orderly manner according to specific rules, typically using a row-first or column-first traversal order. The purpose of sequential storage is to ensure the orderliness and traceability of coordinate data, providing a structured data foundation for subsequent matching and allocation operations. Its function is to integrate scattered coordinate calculation results into a unified data structure.
[0082] In an optional implementation, sequential storage employs a row-first traversal, adding coordinate positions to the set row by row and column by column, starting from the first column of the first row. For example, for a 3×4 matrix, the terminal device stores the 12 coordinate positions sequentially into the target coordinate set in the order (1,1), (1,2), (1,3), (1,4), (2,1), (2,2)...
[0083] In an alternative implementation, sequential storage can also employ special orders such as column-first or spiral traversal to adapt to different tactical needs and optimization objectives. For example, in some application scenarios, terminal devices may use a spiral sequence of coordinates that expands outward from the center to facilitate the formation deployment effect from the inside out.
[0084] The target coordinate set is a data container that stores the position information of all unit targets, typically implemented using an array, list, or other ordered data structure. The purpose of the target coordinate set is to provide complete position target data for the phalanx movement control, supporting fast query and traversal operations. Its function is to serve as the data source for unit matching and movement control.
[0085] In an optional implementation, the target coordinate set stores the coordinate data in the form of a dynamic array, where each element contains X and Y coordinate values and optional identification information. For example, the terminal device creates a coordinate array containing 24 elements, each element being formatted as {x: coordinate value, y: coordinate value, index: index}, supporting quick access to coordinate information at any location via index.
[0086] In an alternative implementation, the target coordinate set may also include additional metadata information, such as extended attributes like coordinate priority, accessibility, and terrain type. For example, some coordinate locations may be marked as "high priority" or "restricted access," and the terminal device needs to consider these attributes during subsequent matching.
[0087] In a specific application, after the terminal device completes the coordinate calculation of the 4×5 matrix, it stores the 20 coordinate positions sequentially into the target coordinate set from left to right and from front to back, forming a coordinate sequence such as [(95, 195), (97, 195), (99, 195), (101, 195), (103, 195), (95, 197), (97, 197), (99, 197), (101, 197), (103, 197), ...]. This ensures that each position has clear spatial positioning information, providing accurate target position data for subsequent unit allocation and movement control.
[0088] In a method for controlling the movement of a square array according to an embodiment of this application, the target coordinate set is sorted based on the current state and a preset movement type to determine the allocation order of each target coordinate, including: When the preset movement type is a move-in-place formation change, the distance from each target coordinate to the center point of the current formation is calculated, and the set of target coordinates is sorted in ascending order of distance; When the preset movement type is a moving formation, the distance from each target coordinate to the current position is calculated, and the set of target coordinates is sorted in descending order of distance.
[0089] The method provided in this embodiment enables different formation transformation needs to be met by using two different sorting strategies: in-situ formation transformation and moving formation transformation. In-situ formation transformation uses increasing distance sorting to ensure that inner circle units obtain nearby coordinates first, reducing overall movement time and path conflicts. Moving formation transformation uses decreasing distance sorting to ensure that outer units move to distant positions first, avoiding internal unit blockage, thus improving the efficiency and coordination of formation transformation.
[0090] Among them, the in-situ formation change is a formation change mode that adjusts the formation near the current position of the square formation. Its characteristic is that it keeps the overall position of the square formation relatively stable, and it mainly targets changes in formation specifications or orientation.
[0091] In one optional implementation, in-situ formation transformation uses the geometric center point of the current formation as a reference to determine the spatial distribution relationship of each unit relative to the center point, thereby achieving local adjustment and optimization of the formation. For example, when the terminal device detects that the formation needs to be transformed from a 4×4 formation to a 3×5 formation, it first determines the coordinates of the center point of the current 4×4 formation, then calculates the straight-line distance from each position of the target 3×5 formation to the center point, and sorts the distance values from smallest to largest.
[0092] In one optional implementation, the center point of the matrix is calculated based on the arithmetic mean of the coordinates of all units in the current matrix, providing a stable reference for subsequent distance calculations. For example, for a 4×4 matrix containing 16 units, the terminal device sums the X coordinates of all units and divides by 16 to obtain the center X coordinate, and sums the Y coordinates of all units and divides by 16 to obtain the center Y coordinate, thereby determining the position of the matrix center point.
[0093] In an optional implementation, the sorting strategy from smallest to largest distance reduces the overall distance and time consumed per unit movement by prioritizing the allocation of coordinates closer to the center point. For example, when the terminal device calculates that the distances from each coordinate in the target formation to the center point are 2 meters, 5 meters, 3 meters, and 7 meters, the priority after sorting from smallest to largest is 2 meters, 3 meters, 5 meters, and 7 meters, ensuring that the inner circle positions are allocated first.
[0094] In a specific application, suppose a soldier formation in a military exercise needs to change from a marching formation to a review formation. The terminal device first calculates the center point coordinates of the current formation as (50, 50), and the positions of the target review formation are located at coordinates (48, 48), (52, 48), (48, 52), (52, 52), etc. By calculating the distance from each coordinate to the center point and sorting them in ascending order, it ensures that the positions closer to the center are allocated first, so as to minimize the movement distance during the formation change.
[0095] Among them, the marching formation change is a formation change mode in which the formation is adjusted at the same time during the movement of the square formation. Its characteristic is that it combines position movement and formation change to achieve dynamic overall reconstruction.
[0096] In one optional implementation, the marching formation change optimizes the movement paths and timing of units by analyzing the movement direction of the formation and the target formation layout, thus avoiding mutual interference during the movement. For example, when the terminal device controls the formation to move 500 meters forward from its current position while simultaneously changing formation, it is necessary to comprehensively consider the direction of movement, the target formation structure, and the starting positions of each unit to formulate a reasonable movement strategy.
[0097] In an optional implementation, the current position serves as a reference point for distance calculation, providing a personalized movement distance reference for each unit and ensuring the rationality of the movement path. For example, for a unit located at the front left corner of the formation, the terminal device uses its current coordinates (10, 90) as the starting point to calculate the straight-line distance to each position in the target formation and selects appropriate target coordinates for that unit.
[0098] In an optional implementation, the distance-to-minimum sorting strategy avoids path conflicts and blockages during the movement of internal units by prioritizing the allocation of coordinates with greater distances. For example, when the terminal device calculates that the distances from a certain unit to the various target coordinates are 100 meters, 300 meters, 200 meters, and 400 meters, the priority after sorting from largest to smallest is 400 meters, 300 meters, 200 meters, and 100 meters, ensuring that coordinates requiring movement over greater distances are allocated first.
[0099] In a specific application, suppose a drone formation needs to change from a straight formation to a V-formation during flight. The terminal device calculates the flight distance from each drone in the formation to each position of the target V-formation, sorts them in descending order of distance, and prioritizes assigning target coordinates to drones that need to move to the edge of the formation, so as to avoid the risk of flight path intersection and collision within the formation.
[0100] In a method for controlling the movement of a square array according to an embodiment of this application, matching each unit in the target square array with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates includes: Step S41: Traverse the sorted set of target coordinates and calculate the distance from the currently available unit to each target coordinate. Step S42: Select the nearest unassigned unit for each target coordinate to generate a one-to-one correspondence table between units and target coordinates.
[0101] The method provided in this embodiment enables precise unit matching and allocation by traversing the sorted coordinate set one by one and calculating the distance. This avoids the problems of overlapping movement paths and low efficiency that may be caused by random allocation, thereby improving the execution efficiency and movement coordination of the matrix transformation.
[0102] The above plan will be explained in detail below.
[0103] In step S41, the sorted set of target coordinates is traversed, and the distance from the currently available units to the target coordinate is calculated for each target coordinate.
[0104] The process of traversing the sorted target coordinate set is a data processing procedure that accesses each coordinate element in the sorted coordinate set in a predetermined order.
[0105] In an optional implementation, traversing the sorted set of target coordinates means that the terminal device visits each coordinate location sequentially, starting from the first coordinate, according to a predetermined order in the set, ensuring that each coordinate is processed without duplication. For example, when the sorted set of coordinates contains 10 location coordinates, the terminal device will start from index 0 and visit indices 1, 2, 3, up to index 9 in sequence, obtaining the specific coordinate value of the location at each visit for subsequent distance calculations.
[0106] In an optional implementation, traversing the sorted set of target coordinates specifically refers to the terminal device performing a comprehensive scan of the coordinate set using an iterative loop. This ensures that each coordinate location receives an appropriate unit allocation, providing a complete coordinate data foundation for distance calculations. For example, in a 3×3 matrix transformation scenario, the sorted coordinate set is arranged from the inside out. The terminal device first processes the coordinates of the center position, then sequentially processes the coordinates of the surrounding eight positions, ensuring that all nine positions have corresponding units.
[0107] The calculation of the distance from the currently available unit to the coordinate is a numerical calculation process that uses mathematical formulas to determine the spatial interval between the current position of the unit and the coordinate position.
[0108] In an optional implementation, calculating the distance from the currently available unit to the coordinates means that the terminal device uses the Euclidean distance formula or the Manhattan distance formula to perform mathematical operations based on the current x and y coordinate values of the unit and the x and y coordinate values of the coordinates to obtain a precise distance value between the two points. For example, when a unit is located at coordinates (2,3) and the coordinates are located at (5,7), the terminal device will calculate the Euclidean distance between the two points to be 5.0 units.
[0109] In an optional implementation, calculating the distance from the currently available unit to the coordinate specifically refers to the terminal device's precise measurement of the distance between two points in a two-dimensional plane. Its purpose is to provide a quantitative basis for unit allocation, and its function is to support the execution of the optimal matching algorithm. For example, during the rearrangement of a matrix, when it is necessary to allocate units to the coordinate (10, 15), the terminal device will calculate the distance from all unallocated units to that coordinate, including units located at (8, 12) with a distance of 3.61, units located at (12, 18) with a distance of 3.61, and units located at (7, 16) with a distance of 3.16, etc.
[0110] In a specific application, when a terminal device processes a 4×4 matrix transformation containing 16 units, it first obtains the 16 sorted coordinate positions, and then visits each coordinate one by one. For each visited coordinate, the terminal device scans all unassigned units and calculates the precise distance value from each unit to the current coordinate using the Euclidean distance formula, providing data support for subsequent optimal allocation decisions.
[0111] In step S42, the nearest unassigned unit is selected for each coordinate, thereby generating a one-to-one correspondence table between units and coordinates.
[0112] Among them, selecting the nearest unassigned unit is an optimized selection process that finds the unit with the smallest distance to the current coordinate and which is not occupied by other coordinates among the available units.
[0113] In an optional implementation, selecting the nearest unassigned unit means that the terminal device compares the distance values of all available units to the current coordinate, filters out the unit with the smallest distance value, and verifies the allocation status of this unit to ensure that it is not occupied by other coordinates. For example, when coordinate A has 3 available units with distances of 2.5, 1.8, and 3.2, the terminal device will select the unit with a distance of 1.8, provided that this unit has not been assigned to other coordinates.
[0114] In an optional implementation, selecting the nearest unassigned unit specifically refers to the terminal device executing a greedy algorithm strategy. This strategy aims to achieve locally optimal unit allocation, minimizing the movement cost of individual units and avoiding allocation conflicts. For example, when assigning coordinates to the center of a square array, the terminal device will select the unit closest to that center position from all available units. Even if this selection is not globally optimal, it guarantees the best allocation result for the current coordinates.
[0115] The process of generating a one-to-one correspondence table between units and coordinates is the construction process of creating a data structure that records the mapping relationship between each unit and its assigned coordinates.
[0116] In an optional implementation, generating a one-to-one correspondence table between units and coordinates means that the terminal device constructs a data table containing paired records of unit identifiers and coordinate information, ensuring that each unit has one and only one corresponding coordinate, and each coordinate also has one and only one corresponding unit. For example, when the matrix contains 9 units, the generated table will contain 9 records, such as "Unit 1 - Coordinate (0,0)", "Unit 2 - Coordinate (0,1)", and other paired information.
[0117] In an optional implementation, generating a one-to-one correspondence table between units and coordinates specifically refers to the terminal device creating a bidirectional mapping data structure. Its purpose is to maintain the integrity and accuracy of the allocation results, and its function is to provide clear instruction guidelines for subsequent movement control. For example, after completing the coordinate allocation of all units, the terminal device generates a table containing complete mapping information. This table not only records which coordinate each unit should move to, but also which unit will occupy each coordinate, ensuring the accurate execution of movement commands.
[0118] In a specific application, when a terminal device is processing a 6×6 matrix rearrangement task, it first selects the nearest unit for the coordinates of the central area according to the sorted coordinate order, and then gradually expands outwards, assigning the optimal unit to each coordinate. Finally, it generates a complete relation table containing 36 mapping records, ensuring that each unit has a clear destination and that each coordinate position is filled with a specified unit.
[0119] In a matrix movement control method provided in one embodiment of this application, selecting the nearest unassigned unit for each target coordinate includes: When multiple units are equidistant from the same target coordinate, priority is determined based on the original order of the units in the preset sequence.
[0120] The method provided in this embodiment enables priority to be determined by a preset sequence when units of equal distance compete for the same target coordinates, thereby avoiding allocation conflicts and uncertainties, improving the certainty and consistency of unit allocation, and ensuring the stability and predictability of the phalanx movement control.
[0121] The above plan will be explained in detail below.
[0122] In the steps, when multiple units are equidistant from the same target coordinate, priority is determined based on the original order of the units in the preset sequence.
[0123] Among them, the fact that multiple units are equidistant from the same target coordinate is a special case that may occur during the unit allocation process, that is, there is a state in which two or more units have the same calculated distance from a certain target coordinate.
[0124] In an optional implementation, having multiple units at the same target coordinate equal distances specifically means that when calculating the Euclidean distance from each available unit to a certain target coordinate, there are two or more units with the same calculated value. For example, assuming the target coordinate is (10,10), unit A is located at (8,8), unit B is located at (12,8), and unit C is located at (8,12), then the distances from units A, B, and C to the target coordinate are all 2√2, resulting in equal distances.
[0125] In an optional implementation, having multiple units at equal distances to the same target coordinates serves to trigger a priority determination mechanism. This ensures that when multiple optimal choices exist, decisions are made according to predetermined rules, avoiding uncertainty caused by random allocation. For example, when the terminal device detects that three units are at the shortest distance to the target location, the system automatically initiates a priority determination process based on a preset sequence.
[0126] The original order of the units in the preset sequence is the fixed arrangement order determined by each unit during system initialization or matrix construction.
[0127] In an optional implementation, the original order of units in the preset sequence specifically refers to the unique identifier or sorting position assigned to each unit during the initialization of the matrix. This order remains unchanged throughout the movement control process, providing a clear sorting basis when priority determination is required. For example, the units in the matrix are numbered 1, 2, 3, ... from left to right and front to back; this numbering order is the original order in the preset sequence.
[0128] In an optional implementation, the original order of units in the preset sequence serves to provide a clear priority ranking standard for units that are equidistant, ensuring the consistency and reproducibility of the allocation results and avoiding different allocation results under the same input conditions. For example, when unit 1 and unit 3 are equidistant from a certain target coordinate, according to the preset sequence order, unit 1 has a higher priority and will be allocated to that target coordinate first.
[0129] Priority determination is a decision-making process that sorts and selects units that are equidistant from a preset sequence.
[0130] In an optional implementation, priority determination specifically refers to the process where, when multiple units are detected to be equidistant from the target coordinates, the terminal device obtains the original sequence number of these units in a preset sequence and determines their priority in ascending order of sequence number, with units having smaller sequence numbers receiving higher allocation priority. For example, when units 2, 5, and 7 are all at the shortest distance to target coordinate A, the system will prioritize allocating unit 2 to target coordinate A.
[0131] In an optional implementation, priority determination serves to eliminate uncertainty in the allocation process, ensuring that the same allocation result is always produced under the same conditions, improving the stability and predictability of the algorithm, while simplifying the decision-making logic and avoiding complex conflict resolution mechanisms. For example, in a military exercise simulation system, when multiple soldier units are equidistant from the assembly point, they are always allocated according to their numerical order to ensure consistent results in each exercise.
[0132] In a specific application, when the terminal device performs the unit allocation process, it first calculates the distance from all available units to the current target coordinate and identifies the group of units with the shortest distance. When it finds that multiple units have the same distance value and are all the shortest distance, the terminal device queries the preset sequence number of these units, compares the number size, selects the unit with the smallest number as the allocation object for the target coordinate, and then marks the unit as allocated, and continues to process the allocation of the next target coordinate, as shown in Figures 3(a)-3(b) as a schematic diagram of sorting the set of target coordinates.
[0133] In a method for controlling the movement of a target array according to an embodiment of this application, obtaining the current state of the target array includes: Obtain the identification information of each unit in the target array, and store the identification information of each unit in a predetermined order.
[0134] The method provided in this embodiment enables the acquisition of identification information of each unit and storage in a predetermined order, which provides an accurate identification basis for subsequent unit matching and movement control, improves the accuracy and reliability of the formation movement control, and ensures that each unit can correctly execute the corresponding movement task.
[0135] The above plan will be explained in detail below.
[0136] The identification information for each unit serves as a unique identifier to distinguish different units within the matrix. This identification information can take the form of a numerical code, string encoding, or a composite identifier, ensuring that each unit has a unique identity within the matrix, facilitating accurate identification and management by the system.
[0137] In an optional implementation, the identification information of each unit specifically refers to a unique identification code assigned to each unit in the matrix. This identification code can accurately distinguish different individual units, specifically serving to establish unit identity mapping relationships and supporting precise matching during subsequent motion control. For example, the terminal device assigns identification information to a 4×4 matrix containing 16 units, which can be in the form of strings from "Unit_001" to "Unit_016", or in the form of numbers from 1 to 16, with each identifier corresponding to a specific unit in the matrix.
[0138] In an optional implementation, the identification information of each unit is specifically a unit identity tag generated based on predefined rules. This tag reflects the logical relationship of the units in the matrix, specifically serving to maintain the relative position information between units and facilitating the system's rapid retrieval and location of specific units. For example, the terminal device can generate identification information using a combination of row and column coordinates, such as "R1C1" and "R1C2" representing units in the first row and first column, and the first row and second column, respectively. This identification method can uniquely identify units and intuitively reflect their relative positional relationship in the matrix.
[0139] Among them, predetermined order storage is a storage method that manages identification information in an orderly manner according to a pre-determined arrangement rule. The predetermined order can be based on the physical location of the unit in the matrix, logical number, or other business-related sorting criteria, ensuring that the storage of identification information has a clear order and predictability.
[0140] In an optional implementation, predetermined order storage specifically refers to arranging and storing the identification information in a row-major traversal order from left to right and top to bottom. This storage method maintains consistency with the physical layout of the matrix and simplifies subsequent unit positioning and matching calculations. For example, for a 3×3 matrix, the terminal device stores the identification information in a predetermined order as ["Unit_001", "Unit_002", "Unit_003", "Unit_004", "Unit_005", "Unit_006", "Unit_007", "Unit_008", "Unit_009"], where the first three identifiers correspond to the units in the first row, the middle three correspond to the units in the second row, and the last three correspond to the units in the third row.
[0141] In one optional implementation, the predetermined sequential storage is specifically an ordered arrangement based on the importance or priority of units. This arrangement highlights the status of key units and optimizes resource allocation and processing efficiency. For example, in a military simulation scenario, the terminal device can place the identification information of the commander unit first, and then arrange the identification information of other units in order of rank, forming an ordered storage structure such as ["Commander_001", "Officer_001", "Officer_002", "Soldier_001", "Soldier_002"].
[0142] In a specific application, the terminal device needs to control the movement of a 5×5 tank formation containing 25 units. First, it obtains the identification information of each tank unit, using the numbering method from "Tank_001" to "Tank_025". Then, it stores this identification information in the system's unit management array in a predetermined order from left to right and from front to back, ensuring that each tank unit has a clear identity and storage location, providing an accurate unit mapping basis for subsequent movement command distribution and status monitoring.
[0143] In a method for controlling the movement of a square array according to an embodiment of this application, controlling each unit to move towards the corresponding target coordinates based on the correspondence includes: Step S71: Send movement commands concurrently to each unit within the same time frame; Step S72: Monitor the movement status of each unit; Step S73: When the movement of the square is detected to be complete, update the overall state of the square.
[0144] The method provided in this embodiment enables synchronous movement of various units by sending movement commands concurrently, ensures the controllability of the movement process by monitoring the movement status in real time, and guarantees the consistency of the system status by updating the array status in a timely manner, thereby improving the efficiency and reliability of array movement control as a whole.
[0145] The above plan will be explained in detail below.
[0146] In step S71, movement commands are sent concurrently to each unit within the same time frame.
[0147] Within this framework, a single time frame is a system-defined unified time window, and operations performed within this window are considered synchronous. The length of the time frame is typically set based on the system's processing capacity and the real-time requirements of the application scenario, ensuring that all units receive the movement command at a relatively consistent point in time.
[0148] In an optional implementation, the same time frame specifically refers to a fixed time interval preset by the system. This time interval serves to ensure the synchronization of command transmission and reduce the time difference in movement between units. For example, the terminal device sets each time frame to 100 milliseconds, and sends movement commands to all units in the array at the beginning of each time frame, ensuring that each unit starts executing movement operations almost simultaneously, thus avoiding array deformation caused by time differences in command transmission.
[0149] In an optional implementation, the same time frame specifically refers to a standard time window determined based on the system clock synchronization mechanism. This time window serves to maintain global time consistency and supports coordinated movement of large-scale units. For example, in a large-scale formation movement scenario involving hundreds of units, the terminal device ensures clock synchronization among all units through the Network Time Protocol (NTP), and then broadcasts movement instructions within a unified time frame to ensure that all units begin moving under the same time reference.
[0150] Concurrent transmission of movement commands is a communication method that transmits movement control commands to multiple units simultaneously. Concurrent transmission maximizes the utilization of the system's communication bandwidth and processing power, and achieves simultaneous command transmission to multiple units through multi-threaded or asynchronous communication mechanisms, significantly improving the response speed of movement control.
[0151] In an optional implementation, concurrent transmission of movement commands specifically employs multi-threaded parallel communication to simultaneously transmit movement commands to various units. This communication method improves command transmission efficiency and reduces overall movement response time. For example, the terminal device creates 36 parallel communication threads for a 6×6 square array containing 36 units. Each thread is responsible for sending a movement command containing target coordinates, movement speed, and path information to one unit. All threads begin execution simultaneously, achieving true concurrent communication.
[0152] In an optional implementation, the concurrent transmission of movement instructions is specifically based on a batch instruction distribution implemented using a broadcast or multicast protocol. This distribution method simplifies communication complexity and improves network transmission efficiency. For example, the terminal device encapsulates the movement instructions of all units into a single broadcast data packet and simultaneously sends it to all units within the array area via the local area network. Each unit extracts and executes the corresponding movement instruction based on the unit identifier in the data packet.
[0153] In one specific application, the terminal device controls an 8×8 square formation containing 64 robot units to perform formation changes. The system sets the time frame period to 50 milliseconds. At the beginning of each time frame, a multi-threaded concurrent communication mechanism is used to send movement commands to all 64 robot units simultaneously. Each command includes the target position coordinates, movement speed parameters, and expected arrival time, ensuring that all robots can start moving in a coordinated manner and maintain the integrity of the square formation.
[0154] In step S72, the movement status of each unit is monitored.
[0155] The movement status is a comprehensive set of information describing the real-time operational status of a unit during its movement. Movement status typically includes the unit's current position, movement speed, direction of movement, remaining distance to move, and potential anomalies, providing the system with a comprehensive awareness of the unit's operational status.
[0156] In an optional implementation, the movement status specifically refers to real-time data on the unit's position, speed, and direction during movement. This data reflects the unit's movement progress and supports dynamic adjustments during the movement process. For example, the terminal device receives real-time status information from each unit in the array, including its current coordinate position (x, y), instantaneous movement speed v, movement direction angle θ, and remaining distance d from the target position. This data is used to determine the movement progress of each unit.
[0157] In an optional implementation, the movement status specifically includes comprehensive operational status information encompassing the unit's health status and operational capabilities. This information serves to provide early warnings of potential anomalies and ensures the smooth completion of movement tasks. For example, in a military vehicle formation movement scenario, the terminal equipment not only monitors the position and speed information of each vehicle but also key parameters such as engine status, fuel level, and communication signal strength. When a fault warning is detected in a vehicle, the movement strategy of the entire formation is adjusted in a timely manner.
[0158] Monitoring is the process of continuously observing and collecting data on the movement status of each unit. Monitoring acquires unit status information through methods such as periodic polling, event triggering, or continuous data streaming, establishing the system's real-time perception capability of the entire formation's movement process.
[0159] In an optional implementation, monitoring specifically involves periodically acquiring the status information of each unit through a timed polling mechanism. This mechanism ensures the timeliness of status information updates and maintains the system's accurate perception of the array's status. For example, the terminal device sends a status query request to all units in the array every 200 milliseconds. Upon receiving the request, each unit immediately transmits its current position, speed, and direction information. The system then aggregates this information and updates the overall movement status diagram of the array.
[0160] In one optional implementation, the monitoring is specifically based on an event-driven asynchronous status reporting mechanism. This mechanism improves monitoring efficiency and reduces unnecessary network communication burden. For example, when each unit moves and its position changes beyond a preset threshold, its speed changes significantly, or it encounters an anomaly, it proactively sends status update messages to the terminal device. The system maintains real-time control over the array's status by processing these asynchronous events.
[0161] In a specific application, the terminal device monitors a UAV formation that is performing a formation change mission. By establishing a real-time communication link, it receives the status data packets sent by each UAV every second. The data packets contain information such as GPS coordinates, flight altitude, flight speed, battery level, and communication signal strength. The system analyzes this data in real time to determine the movement progress of each UAV. When it finds that a UAV has deviated from the predetermined trajectory and exceeded the set range, it immediately sends a correction command to adjust the path.
[0162] In step S73, when the movement of the square matrix is detected to be complete, the overall state of the square matrix is updated.
[0163] The completion of the square formation movement is defined as the state in which all units have reached their respective target coordinates and formed the expected formation. The criteria for determining the completion of the movement include the distance error between each unit and the target coordinates being within the allowable range, the overall shape of the square formation conforming to the expected specifications, and the movement speed of all units approaching zero.
[0164] In an optional implementation, the completion of the square formation movement specifically refers to the state where all units have reached the target coordinates and the positional error is within a preset threshold range. This state serves to indicate that the movement task has been successfully executed and has the function of triggering subsequent processing procedures. For example, the terminal device sets the positional error threshold to 0.5 meters. When it detects that the distance between all units in the square formation and their respective target coordinates is less than 0.5 meters and the duration exceeds 2 seconds, it determines that the square formation movement is complete.
[0165] In one optional implementation, the completion of the phalanx movement is specifically based on a comprehensive evaluation of the overall formation integrity and unit stability. This evaluation ensures the quality of the movement and guarantees the tactical effectiveness of the phalanx. For example, the system not only checks the positional accuracy of each unit but also verifies the alignment of the rows and columns, the uniformity of unit spacing, and the consistency of overall orientation. The movement is considered complete only when all indicators meet the standards.
[0166] Updating the overall state of the formation involves correcting the stored formation state information in the system based on the actual situation after the movement is completed. State updates include the synchronous correction of key parameters such as current position, current formation specifications, current orientation vector, and the latest coordinates of each unit, ensuring that the system state remains consistent with the actual situation.
[0167] In an optional implementation, updating the overall state of the formation specifically involves synchronizing the actual arrival positions of each unit as the new current position reference. This synchronization eliminates accumulated errors and provides an accurate starting state for the next movement. For example, after confirming the completion of the movement, the terminal device collects the actual position coordinates of all units, recalculates the center point and boundary range of the formation, and updates the current position, current formation specification, and current orientation vector, among other state parameters, in the system.
[0168] In an optional implementation, updating the overall state of the matrix involves comprehensive state correction and optimization based on the movement results. This process improves the accuracy of subsequent operations and maintains the long-term stability of the system. For example, during state updates, the system not only records the new coordinates of each unit but also analyzes the execution effect of the movement, adjusts the movement parameter model, and provides optimized control strategies for future similar movement tasks.
[0169] In a specific application, after the tank formation controlled by the terminal device completes the transformation from a 4×3 formation to a 3×4 formation, the system detects that all 12 tanks have reached the predetermined position and the formation is stable. It immediately performs a state update operation, records the actual position of each tank as the new current coordinates, recalculates the geometric center and orientation vector of the formation, and saves the updated state information to the system database. This provides an accurate state basis for the execution of the next movement command, as shown in Figures 4(a)-4(b)-4(c)-4(d)-4(e), which are schematic diagrams of the formation transformation from a 4×3 formation to a 3×4 formation.
[0170] In a matrix movement control method provided in one embodiment of this application, after generating the target coordinate set, the method includes: Step S81: Detect whether there are obstacles in the movement path; Step S82: When an obstacle is detected, adjust the target position and / or detour path to avoid the obstacle.
[0171] The method provided in this embodiment enables intelligent obstacle avoidance movement of a phalanx in complex environments through path obstacle detection and dynamic path adjustment technologies. This effectively avoids movement failure caused by obstacles and improves the environmental adaptability and reliability of phalanx movement control.
[0172] The above plan will be explained in detail below.
[0173] In step S81, it is detected whether there are obstacles in the movement path.
[0174] The movement path is the trajectory that each unit takes from its current position to the target coordinates. The movement path can be a straight path or a path that includes complex trajectories such as turns and detours, and is used to determine the specific sequence of positions that each unit needs to pass through during the movement.
[0175] In one alternative implementation, the movement path is detected through real-time scanning and analysis using environmental perception sensors. For example, the terminal device can utilize devices such as LiDAR, cameras, or ultrasonic sensors to perform a three-dimensional spatial scan of the area where the array moves, acquiring environmental terrain data and obstacle distribution information, thereby constructing a detailed movement path map.
[0176] In an optional implementation, the detection of the movement path is analyzed using a preset gridded area division method. For example, the terminal device divides the entire movement area into several grid cells, each marked as passable or impassable. By traversing the grid cells involved in the expected movement path of each unit, it determines whether there are areas marked as impassable.
[0177] Obstacles are physical entities or areas that impede the normal movement of the formation. Obstacles can include static obstacles such as buildings and terrain barriers, as well as dynamic obstacles such as other mobile units and temporary facilities, and are used to identify external factors that affect the safety and feasibility of the formation's movement.
[0178] In an alternative implementation, obstacle detection uses collision prediction algorithms for advance assessment. For example, the terminal device calculates the trajectory of position changes over a future period based on the current speed, direction of movement, and estimated arrival time of each unit, and performs spatial overlap detection with known obstacle positions to identify potential collision risks in advance.
[0179] In an optional implementation, obstacle detection employs a combination of real-time environmental monitoring and historical data analysis. For example, the terminal device not only acquires obstacle information in the current environment in real time, but also accesses historical movement records and map data to identify frequently occurring obstacle types and distribution patterns within the area, thereby improving the accuracy and predictability of obstacle detection.
[0180] In a specific application, when the formation needs to move from one end of the training field to the other, the terminal device first activates the environmental scanning module, which monitors the entire moving area in real time through a sensor network installed around the field. If temporary training equipment is detected as an obstacle in the moving path, the system immediately marks the precise location and size information of these obstacles.
[0181] In step S82, when an obstacle is detected, the target position and / or detour path are adjusted to avoid the obstacle.
[0182] The adjustment strategy is a path correction scheme formulated based on obstacle characteristics. The adjustment strategy includes various processing methods such as target position offsetting, detour path planning, and waiting strategy selection, used to find feasible alternative movement schemes while maintaining the overall movement target of the formation.
[0183] In an optional implementation, the adjustment strategy selects the optimal solution using a multi-objective optimization algorithm. For example, the terminal device comprehensively considers multiple factors such as travel distance, time cost, and formation maintenance, calculates a comprehensive score for each possible adjustment scheme, and selects the scheme with the highest score as the final path adjustment strategy.
[0184] In an alternative implementation, the adjustment strategy employs a hierarchical decision-making mechanism. For example, the terminal device first attempts to fine-tune the local path; if this fails, it attempts to slightly shift the target location; if this still proves infeasible, it initiates large-scale detour path planning to ensure that a suitable solution can be found for obstacles of varying complexity.
[0185] The detour path is an alternative movement trajectory to avoid obstacles. While ensuring movement safety, the detour path aims to minimize additional movement distance and time costs, providing a feasible movement solution when obstacles cannot be removed.
[0186] In an optional implementation, the detour path is automatically generated using an intelligent path search algorithm. For example, the terminal device uses the A* algorithm or Dijkstra's algorithm to search for the optimal detour path with the minimum movement cost, starting from the current position and ending at the adjusted target position, while avoiding known obstacles.
[0187] In an alternative implementation, the detour path is planned in a coordinated manner, taking into account the overall constraints of the formation. For example, the terminal device not only plans detour paths for individual units, but also ensures that the entire formation maintains its basic formation structure during the detour, avoiding the formation from becoming scattered or separated due to the detour of individual units.
[0188] In a specific application, when training equipment is detected to be blocking the straight-line movement path of the formation, the terminal device immediately initiates a path replanning program. First, it attempts to shift the target position 5 meters to the left. If there are still obstacles on the shifted path, it plans a path that goes around the right side of the obstacle to ensure that the formation can safely reach the target area with a slightly longer movement distance.
[0189] In a square array movement control method provided in one embodiment of this application, when the movement distance is greater than a preset distance threshold, controlling each unit to move towards the corresponding target coordinate according to the correspondence includes: Step S91: Calculate the distance traveled by each unit; Step S92: When the moving distance is greater than a preset threshold, the total moving process is divided into multiple stages; In step S93, each unit arrives at the intermediate node position in sequence according to the stage. Step S94: After each stage is completed, the matching calculation is performed again.
[0190] The method provided in this embodiment enables the effective handling of complex coordination issues in long-distance formation movement through phased movement control and dynamic rematching techniques. It avoids formation disorder and unit loss of control caused by excessive movement distance, and significantly improves the stability and coordination of large-scale formation movement.
[0191] The above plan will be explained in detail below.
[0192] In step S91, the movement distance of each unit is calculated.
[0193] The movement distance is the spatial distance between each unit's current position and the target coordinates. Movement distance can be calculated using different methods such as Euclidean distance, Manhattan distance, or actual path distance to quantify the specific distance each unit needs to move.
[0194] In an alternative implementation, the distance traveled is precisely measured using three-dimensional spatial coordinates. For example, the terminal device acquires the current three-dimensional coordinates (x1, y1, z1) and the target three-dimensional coordinates (x2, y2, z2) for each unit, and obtains the precise straight-line distance using the formula √[(x2-x1)²+(y2-y1)²+(z2-z1)²].
[0195] In an alternative implementation, the movement distance is calculated with adjustments made to account for actual terrain and path constraints. For example, the terminal device not only calculates the straight-line distance but also the actual path distance that each unit needs to move, taking into account factors such as changes in terrain elevation and path obstacles, in order to more accurately assess the complexity of the movement.
[0196] The preset threshold is the distance criterion for triggering phased movement. The preset threshold is dynamically set based on factors such as the size of the formation, the unit movement capacity, and the complexity of the environment, to determine when long-distance movement needs to be broken down into multiple phases for processing.
[0197] In one optional implementation, the preset threshold is adaptively adjusted based on historical mobility data and performance analysis. For example, the terminal device statistically analyzes the optimal phased mobility trigger distance based on the mobility performance of different sized formations in various environments, and continuously optimizes the threshold setting based on actual usage results.
[0198] In one optional implementation, the preset threshold is set using a multi-level judgment mechanism. For example, the terminal device sets different threshold standards for different types of mobile tasks; a smaller threshold is used for precise mobile tasks to ensure accuracy, while a larger threshold is used for fast mobile tasks to improve efficiency.
[0199] In a specific application, when a formation of 100 people needs to move from one end of the playground to the other end, which is 1,000 meters away, the terminal device calculates that the moving distance of most units exceeds the preset threshold of 800 meters. The system immediately starts the phased movement mode to avoid formation control difficulties caused by excessive distance.
[0200] In step S92, when the moving distance is greater than a preset threshold, the total moving process is divided into multiple stages.
[0201] The segmentation strategy involves dividing a long-distance movement into several short-distance movements. This strategy requires comprehensive consideration of factors such as movement distance, terrain features, and formation size to determine the appropriate number of stages and the specific movement distance for each stage.
[0202] In an optional implementation, the segmentation strategy sets the stages using an equidistant division method. For example, the terminal device divides the total travel distance into several equal stages, with the travel distance of each stage controlled within a preset threshold range, ensuring that the travel in each stage is within a controllable range.
[0203] In an optional implementation, the segmentation strategy employs a terrain-feature-oriented intelligent segmentation method. For example, the terminal device sets segmentation points in flat areas or locations that facilitate regrouping, based on factors such as terrain changes and key node locations along the movement path, thereby improving the safety and coordination of movement at each stage.
[0204] The intermediate nodes serve as temporary assembly points for each phase. These intermediate nodes should be selected from relatively flat terrain with sufficient space to accommodate the entire formation and facilitate formation adjustments, allowing units to regroup and coordinate after each phase.
[0205] In an alternative implementation, intermediate nodes are automatically selected using terrain analysis and spatial optimization algorithms. For example, the terminal device analyzes terrain data along the movement path, identifies candidate locations with sufficient space and satisfactory terrain flatness, and selects the location with the most even distance distribution as the intermediate node.
[0206] In an alternative implementation, intermediate nodes make a comprehensive selection considering tactical requirements and security factors. For example, the terminal equipment not only considers terrain and spatial factors, but also evaluates the tactical characteristics of each candidate location, such as security and concealment, to select the most suitable location for the temporary deployment and reorganization of the formation.
[0207] In a specific application, when faced with a total travel distance of 1000 meters, the terminal device divides it into 4 stages, each stage being approximately 250 meters, and sets intermediate nodes at 300 meters, 500 meters, and 750 meters to ensure that the travel in each stage is within a controllable range.
[0208] In step S93, each unit arrives at the intermediate node position in sequence according to the stages.
[0209] Phased movement is a step-by-step movement process carried out according to a preset node sequence. Phased movement requires that after each unit completes the current phase of movement, it must wait for the entire formation to reach a state of assembly before it can begin the next phase of movement.
[0210] In an alternative implementation, phased movement ensures overall coordination of the formation through a synchronization control mechanism. For example, the terminal equipment sets unified start and end signals for each phase, and each unit must receive the start signal before initiating movement, and wait for the end signal confirmation after reaching an intermediate node.
[0211] In one alternative implementation, a dynamic speed adjustment strategy is employed during phased movement to maintain formation alignment. For example, the terminal device monitors the movement progress of each unit in real time, appropriately reducing the speed of faster-moving units and providing movement assistance to slower-moving units, ensuring that the entire formation can reach each intermediate node relatively neatly.
[0212] In a specific application, during the first phase of movement, each unit moves from its starting position to the first intermediate node 300 meters away. The terminal equipment monitors the movement progress in real time to ensure that all units arrive at the assembly area within the predetermined time.
[0213] In step S94, the matching calculation is re-performed after each stage is completed.
[0214] Re-matching involves recalculating the movement plan for the next stage based on the results of the current stage. Re-matching requires considering the actual position distribution of each unit after the current stage ends and re-analyzing the optimal correspondence between unit and target coordinates.
[0215] In an alternative implementation, rematching is dynamically adjusted through real-time location updates and optimization algorithms. For example, after each phase, the terminal device reacquires the precise location of each unit and recalculates the optimal allocation scheme to the target in the next phase based on the new location distribution.
[0216] In an alternative implementation, the re-matching process incorporates cumulative error correction for optimization. For example, the terminal device analyzes the positional deviations of each unit in the preceding stages and performs error compensation during re-matching to ensure that the final square formation achieves the desired effect.
[0217] In a specific application, after the first phase of movement is completed, the terminal device rescans the actual position of each unit and finds that some units have slight deviations. It then immediately recalculates the movement allocation scheme for the second phase to ensure that subsequent movements can gradually correct these deviations.
[0218] This exemplary embodiment also discloses a square array movement control device. Figure 5 This is a diagram illustrating the composition of a translucent material effect fabrication apparatus according to an exemplary embodiment of this disclosure. Figure 5 As shown, the device includes: The receiving module is used to receive movement instructions for the target array, the movement instructions including the target position, target formation size and target orientation vector corresponding to the target array; The first generation module is used to generate a target coordinate set based on the target position, target formation specifications and target orientation vector, wherein the target coordinate set contains the target coordinates of each unit in the target matrix; The acquisition module is used to acquire the current state of the target array, which includes the current position, current formation size, and current orientation vector. The determination module is used to sort the target coordinate set based on the current state and the preset movement type, and determine the allocation order of each target coordinate; The second generation module is used to match each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates. The control module is used to control each unit to move towards the corresponding target coordinates according to the correspondence.
[0219] Optionally, a set of target coordinates is generated based on the target location, target formation specifications, and target orientation vector, including: Determine the number of rows and columns of the target square based on the target formation specifications; Using the target location as a reference point, and combining the target orientation vector and the number of rows and columns of the target matrix, calculate the target coordinate position of each unit; Store the target coordinates in the target coordinate set in order.
[0220] Optionally, the preset movement type includes in-situ relocation or traversal relocation. Based on the movement type and current state, the target coordinate set is sorted to determine the allocation order of each target coordinate. The system also includes: When the preset movement type is "moving in place and changing formation", the distance from each target coordinate to the center point of the current formation is calculated, and the target coordinate set is sorted in ascending order of distance. When the preset movement type is moving formation, the distance from each target coordinate to the current position is calculated, and the target coordinate set is sorted in descending order of distance.
[0221] Optionally, each unit in the target matrix is matched with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates, including: Iterate through the sorted set of target coordinates and calculate the distance from the currently available units to each target coordinate. For each target coordinate, select the nearest unassigned unit to generate a one-to-one correspondence table between units and target coordinates.
[0222] Optionally, selecting the nearest unassigned unit for each target coordinate also includes: When multiple units are equidistant from the same target coordinate, priority is determined based on the original order of the units in the preset sequence.
[0223] Optionally, obtaining the current state of the target matrix also includes: Obtain the identification information of each unit in the target array, and store the identification information of each unit in a predetermined order.
[0224] Optionally, controlling the movement of each unit towards the corresponding target coordinates according to the correspondence also includes: Send movement commands concurrently to various units within the same time frame; Monitor the movement status of each unit; When the movement of the square formation is detected to be complete, the overall state of the square formation is updated.
[0225] Optionally, after generating the target coordinate set, the following may also be included: Detect whether there are obstacles in the movement path; When an obstacle is detected, adjust the target position and / or detour path to avoid the obstacle.
[0226] Optionally, when the moving distance exceeds a preset distance threshold, the corresponding relationship is used to control each unit to move towards the corresponding target coordinate, which also includes: Calculate the distance each unit moves; When the moving distance exceeds a preset threshold, the total moving process will be divided into multiple stages; Each unit arrives at the intermediate node position in stages; The matching calculation is recalculated after each stage is completed.
[0227] The method provided in this embodiment enables precise control of the square matrix movement. Through reasonable coordinate allocation and matching algorithms, the efficiency and accuracy of the square matrix transformation are improved, while reducing conflicts and confusion during unit movement and ensuring the overall coordination of the square matrix movement.
[0228] The specific details of each module unit in the above embodiments have been described in detail in the corresponding matrix movement control method. In addition, the matrix movement control device also includes other unit modules corresponding to the display control method, so they will not be described again here.
[0229] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0230] Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium according to an exemplary embodiment of the present disclosure. Figure 6 As shown, a program product 1100 according to an embodiment of the present disclosure is described, on which a computer program is stored, which, when executed by a processor, implements the method steps of the above-described matrix movement control method. The method provided by this embodiment enables precise control of matrix movement, improves the efficiency and accuracy of matrix transformation through reasonable coordinate allocation and matching algorithms, reduces conflicts and confusion during unit movement, and ensures the overall coordination of matrix movement.
[0231] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable storage media may transmit, propagate, or transfer programs for use by or in connection with an instruction execution system, apparatus, or device.
[0232] The program code contained in a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, radio frequency, or any suitable combination thereof.
[0233] The following is combined Figure 7 The electronic device 1000 in this exemplary embodiment is described. The electronic device 1000 is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0234] See Figure 7As shown, the electronic device 1000 is presented in the form of a general-purpose computing device. The components of the electronic device 1000 may include, but are not limited to: at least one processor 1010, at least one memory 1020, a bus 1030 connecting different system components (including processor 1010 and memory 1020), and a display unit 1040.
[0235] The memory 1020 stores program code, which can be executed by the processor 1010, enabling the processor 1010 to execute the specific method steps of the aforementioned array movement control method by executing the executable instructions. The method provided in this embodiment enables precise control of array movement. Through reasonable coordinate allocation and matching algorithms, the efficiency and accuracy of array transformation are improved, while conflicts and confusion during unit movement are reduced, ensuring the overall coordination of array movement.
[0236] The electronic device may also include: a power supply component configured to manage the power of the electronic device; a wired or wireless network interface configured to connect the electronic device to a network; and an input / output (I / O) interface. The electronic device can operate on an operating system stored in memory, such as Android, iOS, Windows, Mac OS X, Unix, Linux, FreeBSD, or similar.
[0237] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, electronic device, or network device, etc.) to execute the method according to the embodiments of the present invention.
[0238] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0239] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for controlling the movement of a square array, characterized in that, include: Receive a movement command for a target array, the movement command including the target position, target formation size and target orientation vector corresponding to the target array; Based on the target location, target formation specifications, and target orientation vector, a target coordinate set is generated, which contains the target coordinates of each unit in the target matrix. Obtain the current state of the target square formation, which includes the current position, current formation size, and current orientation vector; Based on the current state and the preset movement type, the target coordinate set is sorted to determine the allocation order of each target coordinate; Match each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates; Based on the aforementioned correspondence, each unit is controlled to move towards its corresponding target coordinate.
2. The method according to claim 1, characterized in that, The step of generating a target coordinate set based on the target location, target formation specifications, and target orientation vector includes: The number of rows and columns of the target square array are determined based on the target formation specifications. Using the target location as a reference point, and combining the target orientation vector and the number of rows and columns of the target matrix, calculate the target coordinate position of each unit; The target coordinates are stored sequentially into the target coordinate set.
3. The method according to claim 1, characterized in that, The preset movement type includes in-situ relocation or moving relocation. The step of sorting the target coordinate set based on the movement type and the current state to determine the allocation order of each target coordinate also includes: When the preset movement type is a move-in-place formation change, the distance from each target coordinate to the center point of the current formation is calculated, and the set of target coordinates is sorted in ascending order of distance; When the preset movement type is a moving formation, the distance from each target coordinate to the current position is calculated, and the set of target coordinates is sorted in descending order of distance.
4. The method according to claim 1, characterized in that, The step of matching each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates includes: Iterate through the sorted set of target coordinates and calculate the distance from the currently available units to each target coordinate. For each target coordinate, select the nearest unassigned unit to generate a one-to-one correspondence table between units and target coordinates.
5. The method according to claim 4, characterized in that, The step of selecting the nearest unassigned unit for each target coordinate also includes: When multiple units are equidistant from the same target coordinate, priority is determined based on the original order of the units in the preset sequence.
6. The method according to claim 1, characterized in that, The process of obtaining the current state of the target matrix also includes: Obtain the identification information of each unit in the target array, and store the identification information of each unit in a predetermined order.
7. The method according to claim 1, characterized in that, The step of controlling each unit to move towards the corresponding target coordinates according to the correspondence relationship also includes: Send movement commands concurrently to various units within the same time frame; Monitor the movement status of each unit; When the movement of the square formation is detected to be complete, the overall state of the square formation is updated.
8. The method according to claim 1, characterized in that, After generating the target coordinate set, the following is also included: Detect whether there are obstacles in the movement path; When an obstacle is detected, adjust the target position and / or detour path to avoid the obstacle.
9. The method according to claim 1, characterized in that, When the moving distance exceeds a preset distance threshold, the correspondence, which controls each unit to move towards the corresponding target coordinate, also includes: Calculate the distance each unit moves; When the moving distance exceeds a preset threshold, the total moving process is divided into multiple stages; Each unit arrives at the intermediate node position in stages; The matching calculation is recalculated after each stage is completed.
10. A square array movement control device, characterized in that, include: The receiving module is used to receive movement instructions for the target array, the movement instructions including the target position, target formation size and target orientation vector corresponding to the target array; The first generation module is used to generate a target coordinate set based on the target position, target formation specifications and target orientation vector, wherein the target coordinate set contains the target coordinates of each unit in the target matrix; The acquisition module is used to acquire the current state of the target array, which includes the current position, current formation size, and current orientation vector. The determination module is used to sort the target coordinate set based on the current state and the preset movement type, and determine the allocation order of each target coordinate; The second generation module is used to match each unit in the target matrix with the target coordinates in the target coordinate set to generate a correspondence between units and target coordinates. The control module is used to control each unit to move towards the corresponding target coordinates according to the correspondence.
11. A computer-readable storage medium, characterized in that, The device contains a computer program that, when executed by a processor, implements the method of any one of claims 1 to 9.
12. An electronic device, characterized in that, include: Memory, which stores computer programs; A processor that executes the computer program to implement the method of any one of claims 1 to 9.