Method, device and equipment for controlling displacement of robot
By obtaining and calculating the robot path task on the client device, the problem of excessive resources occupied by the unified calculation of the robot path on the server side is solved, and efficient robot movement control is realized in large maps or scenarios with a high number of robots.
Patent Information
- Application Number
- CN202410873624.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-08-27
AI Technical Summary
In Metaverse scenarios with a large map area or a large number of robots, the existing method of uniformly calculating robot paths on the server side takes up too many resources, resulting in the server being unable to provide sufficient resources for other services.
By obtaining the robot path task table on the client device, requesting the path calculation task of the target robot from the server based on the task status attributes, and controlling the robot displacement after obtaining the real-time position, the client device can calculate and control the robot path in real time.
It effectively reduces the computing resource occupation of the server, improves the server's processing capabilities, and can efficiently control robot movement in large map areas or with a high number of robots.
Smart Images

Figure CN118544356A
Abstract
Description
Technical Field
[0001] The present application relates to the field of metaverse technology, and in particular to a method, device and equipment for controlling the displacement of a robot. Background Art
[0002] Robot non-player characters (NPCs) can significantly increase the popularity of the metaverse scene and add to the atmosphere of the scene. Since the robot NPC is an Internet-connected object, its movement path and behavior need to be synchronized to everyone, so the existing solutions all calculate the path on the server side and distribute it to each client. There are two specific implementation methods. One is to pre-record the robot's movement trajectory on the client side, read the trajectory information on the server side, and drive the character movement at a fixed frequency; the other is to implement the path-finding algorithm on the server side, provide map information through the client, dynamically obtain the robot NPC's movement path, and send the character position at a fixed frequency.
[0003] However, when the map area is large and the number of robots is large (for example, the map area in the metaverse scenario (the radius can reach tens or hundreds of kilometers) is several orders of magnitude larger than the traditional map (the radius is roughly tens of meters), and the number of robots often needs to be increased by dozens of times accordingly), if the pathfinding algorithm is implemented on the server side, it is necessary to import the full map information. It is difficult for the server memory to load a map with a radius of tens of kilometers. Even if the map can be successfully loaded, the pathfinding algorithm will occupy a large amount of central processing unit (CPU) resources, which makes it impossible for the server to provide sufficient resources for other businesses. Summary of the invention
[0004] The purpose of the present application is to provide a method, device and equipment for controlling the displacement of a robot, so as to solve the problem that the method of calculating the path of robot movement in the prior art occupies more resources when the map area is large or the number of robots is large.
[0005] In a first aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a method for controlling the displacement of a robot, which is applied to a client device, comprising:
[0006] Obtaining a robot path task table, wherein the robot path task table includes a plurality of robot path calculation tasks;
[0007] Sending a first request to a server device according to the task state attributes of the multiple robot path calculation tasks, wherein the first request is used to request to obtain the path calculation task of the target robot;
[0008] receiving a first response sent by the server device, where the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot;
[0009] When the path calculation task of the target robot is obtained, obtaining the real-time position of the target robot;
[0010] The target robot is controlled to move according to the real-time position of the target robot.
[0011] Optionally, sending a first request to a server device according to the task state attributes of the plurality of robot path calculation tasks includes:
[0012] Obtaining a candidate robot according to the task state attributes of the plurality of robot path calculation tasks;
[0013] Filtering the target robot from the candidate robots according to the distance between the candidate robots and the player character corresponding to the client device;
[0014] Send the first request to the server device.
[0015] Optionally, in the case of acquiring the path calculation task of the target robot, acquiring the real-time position of the target robot includes:
[0016] Starting from the first position of the target robot, the second position of the target robot is calculated in real time; wherein, when the task state attribute of the path calculation task of the target robot is the received state, the first position is the currently synchronized position of the target robot; when the task state attribute of the path calculation task of the target robot is the unreceived state, the first position is the starting position of the target robot;
[0017] Periodically sending the currently calculated second position to the server device;
[0018] The real-time location sent by the server device is received, wherein the real-time location is related to second locations sent by multiple client devices in a current period.
[0019] In a second aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a method for controlling the displacement of a robot, which is applied to a server device, comprising:
[0020] Receiving a first request sent by a client device, where the first request is used to request to obtain a path calculation task of a target robot;
[0021] In a case where the client device is allowed to obtain the path calculation task of the target robot, a first response is sent to the client device, where the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot.
[0022] Optionally, after receiving the first request sent by the client device, the method further includes:
[0023] When the first number of client devices that have obtained the path calculation task of the target robot is less than a first threshold, performing the following steps:
[0024] Determine to allow the client device to obtain the path calculation task of the target robot;
[0025] When the task state attribute of the path calculation task of the target robot is in an unclaimed state, updating the task state attribute of the path calculation task of the target robot to a claimed state;
[0026] The information of the client device is updated to a client list, wherein the client list includes information of the client device that has obtained the path calculation task of the target robot.
[0027] Optionally, the method further comprises at least one of the following:
[0028] When detecting that the client device is offline, deleting the information of the client device from the client list;
[0029] When there is no information of the client device in the client list, the task state attribute of the path calculation task of the target robot is updated to an unclaimed state.
[0030] Optionally, the method further comprises:
[0031] Receiving a second position of the target robot periodically sent by a plurality of client devices;
[0032] Calculating the real-time position of the target robot according to the plurality of second positions received in the current cycle;
[0033] The real-time location is sent to each of the client devices.
[0034] In a third aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a device for controlling the displacement of a robot, which is applied to a client device, including:
[0035] A first acquisition module is used to acquire a robot path task table, wherein the robot path task table includes a plurality of robot path calculation tasks;
[0036] A sending module, configured to send a first request to a server device according to the task state attributes of the plurality of robot path calculation tasks, wherein the first request is used to request to obtain a path calculation task of a target robot;
[0037] A receiving module, used to receive a first response sent by the server device, where the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot;
[0038] A second acquisition module is used to acquire the real-time position of the target robot when the path calculation task of the target robot is acquired;
[0039] The control module is used to control the displacement of the target robot according to the real-time position of the target robot.
[0040] In a fourth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a device for controlling the displacement of a robot, which is applied to a server device, including:
[0041] A first receiving module, configured to receive a first request sent by a client device, wherein the first request is used to request to obtain a path calculation task of a target robot;
[0042] The first sending module is used to send a first response to the client device when the client device is allowed to obtain the path calculation task of the target robot, wherein the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot.
[0043] In the fifth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides an electronic device, including a transceiver, a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for controlling the displacement of the robot as described in the first aspect is implemented, or the method for controlling the displacement of the robot as described in the second aspect is implemented.
[0044] In the sixth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the method for controlling the displacement of a robot as described in the first aspect is implemented, or the method for controlling the displacement of a robot as described in the second aspect is implemented.
[0045] The above technical solution of the present application has at least the following beneficial effects:
[0046] The robot path-finding method of the embodiment of the present application first obtains a robot path task table, wherein the robot path task table includes a plurality of robot path calculation tasks; secondly, according to the task state attributes of the plurality of robot path calculation tasks, sends a first request to the server device, wherein the first request is used to request to obtain the path calculation task of the target robot; thirdly, receives a first response sent by the server device, wherein the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot; in this way, the path calculation task of the target robot can be obtained if the server device allows it; thereafter, when the path calculation task of the target robot is obtained, the real-time position of the target robot is obtained; finally, according to the real-time position of the target robot, the displacement of the target robot is controlled. In this way, the corresponding client device controls the robot to move to a specific destination according to the calculated position. This solves the problem that the method of uniformly calculating the robot path by the server in the existing solution occupies more resources when the map area is large or the number of robots is large. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is one of the flowcharts of the method for controlling the displacement of a robot according to an embodiment of the present application;
[0048] Figure 2 This is a second flow chart of the method for controlling the displacement of a robot according to an embodiment of the present application;
[0049] Figure 3 This is one of the structural schematic diagrams of the device for controlling the displacement of a robot according to an embodiment of the present application;
[0050] Figure 4 This is a second structural schematic diagram of the device for controlling the displacement of a robot according to an embodiment of the present application;
[0051] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, the "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.
[0054] The method, device and equipment for controlling the displacement of a robot provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0055] The embodiment of the present application provides a method for controlling the displacement of a robot, which is applied to a client device. Here, the client device is, for example, a mobile terminal, such as a mobile phone, a tablet computer, or a computer. Figure 1 As shown, the method includes:
[0056] Step 101, obtaining a robot path task table, wherein the robot path task table includes a plurality of robot path calculation tasks; here, firstly, the robot is, for example, an NPC in a game software; secondly, each robot path calculation task in the robot path task table includes a robot identification (such as a robot ID) and a predefined robot starting position and ending position, and may also include information such as the robot's current task state attribute and / or a client list (used to indicate a client that has received the path calculation task), specifically, the robot identification, starting position and ending position, etc. are static data, while information such as the task state attribute and the client list are dynamic data; in this step, the client device may obtain information other than the client list in the robot path task table; thirdly, the client device may obtain the robot path task table from the server device, for example, based on a request-response method, or the server device may actively send the robot path task table to the client device after detecting that the client device has established a communication connection with itself, etc. The embodiment of the present application does not limit the specific method for obtaining the robot path task table, and any method that can enable the client device to obtain the latest robot path task table should be within the protection scope of the embodiment of the present application;
[0057] Step 102, according to the task state attributes of the plurality of robot path calculation tasks, a first request is sent to the server device, wherein the first request is used to request to obtain the path calculation task of the target robot; here, the task state attribute includes a received state (the path calculation task of the robot has been received by the client device, that is, a client device has been calculating the path of the robot) or an unreceived state (the path calculation task of the robot has not been received by any client device, and the robot is still in a pre-configured starting position); in addition, the client device should give priority to requesting the path calculation task of the robot whose task state attribute is an unreceived state;
[0058] Step 103, receiving a first response sent by the server device, the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot; that is, when the client device receives the indication that the client device is allowed to obtain the path calculation task of the target robot, it determines that the client device has obtained the path calculation task of the target robot. Specifically, when the number of client devices that have received the path calculation task of the target robot is less than a first threshold, the server device determines to allow the client device to obtain the path calculation task of the target robot;
[0059] Step 104, when the path calculation task of the target robot is obtained, the real-time position of the target robot is obtained; as an example, the real-time position may be provided by a server device, specifically, the server device may obtain the position of the target robot based on the position calculation sent by multiple client devices, so that the client device and the server device cooperate to calculate the real-time position of the target robot;
[0060] Step 105: Control the target robot to move according to the real-time position of the target robot.
[0061] In the method for controlling the displacement of a robot in an embodiment of the present application, first, the client device obtains the robot path task table, and secondly, the client device sends a first request to the server device according to the task state attributes of the plurality of robot path calculation tasks, the first request being used to request the path calculation task of the target robot; thirdly, receiving the first response sent by the server device, the first response being used to indicate that the client device is allowed to obtain the path calculation task of the target robot; in this way, the path calculation task of the target robot can be obtained if the server device allows it; thereafter, when the path calculation task of the target robot is obtained, the real-time position of the target robot is obtained; finally, the displacement of the target robot is controlled according to the real-time position of the target robot. In this way, each client device is implemented to calculate the path of the target robot in real time based on its existing path-finding capability to control the displacement of the robot. In this way, the corresponding client device is implemented to control the robot to move to a specific destination according to the calculated position. The problem that the method of uniformly calculating the robot path by the server in the existing solution occupies more resources when the map area is large or the number of robots is large is solved.
[0062] As a specific implementation, step 101 includes:
[0063] Send a second request to the server device, the second request is used to request the robot path task table; this step is specifically performed when the player of the client device enters the metaverse and the positions of all robots in the scene are synchronized. That is: after the client device requests to connect to the server and receives a task from the server indicating a successful connection, and the client device has completed synchronization of the positions of each robot in the game scene, the client device sends a second request to the server device requesting the robot path task table;
[0064] A second response fed back by the server device is received, where the second response carries the robot task list.
[0065] As an optional implementation, step 102 includes:
[0066] According to the task state attributes of the plurality of robot path calculation tasks, candidate robots are obtained; here, when there is a task state attribute of an unclaimed state, the candidate robots are at least part of the robots corresponding to the path calculation tasks in the unclaimed state, and when there is no task state attribute of an unclaimed state, the candidate robots are at least part of the robots corresponding to the path calculation tasks in the claimed state;
[0067] Filtering the target robot from the candidate robots according to the distance between the candidate robots and the player character corresponding to the client device; here, the target robot is one or more of the candidate robots that are closer to the player character;
[0068] The first request is sent to the server device, where the first request may carry an identifier of the determined target robot.
[0069] In this optional implementation, the client device selects a candidate robot based on the task state attributes in the robot path task table, and further selects a target robot based on the distance between each candidate robot and the game player, thereby requesting the path calculation task of the target robot from the server device. In this way, path calculation can be performed on robots that are closer to their corresponding game players, thereby improving the accuracy of robot position calculation.
[0070] Further, as an optional implementation, step 104 includes:
[0071] Starting from the first position of the target robot, the second position of the target robot is calculated in real time; wherein, when the task state attribute of the path calculation task of the target robot is the received state, the first position is the currently synchronized position of the target robot; when the task state attribute of the path calculation task of the target robot is the unreceived state, the first position is the starting position of the target robot; that is, when the target robot is a robot with a synchronized position (other client devices perform path finding calculations for the robot), path finding is performed for the target robot from the currently synchronized position of the target robot to calculate the second position of the target robot at the current moment; when the target robot is an unsynchronized robot (no client device performs path finding calculations for the robot), path finding is performed for the robot from the starting position of the robot recorded in the robot path task table to calculate the second position of the target robot at the current moment; in this way, the robot paths are calculated in real time on different client sides (i.e., the path calculation tasks of all robots are shared by different client sides), which can carry dozens of times more robots than traditional solutions in the metaverse scenario;
[0072] Periodically sending the currently calculated second position to the target robot, so that the server device can calculate a more accurate real-time position of the robot according to the second positions of the same robot received from multiple client devices most recently;
[0073] The real-time position sent by the server device is received, wherein the real-time position is related to the first positions sent by multiple client devices in the current cycle. Here, the real-time position is calculated based on the second positions of the same target robot reported by multiple client devices, for example, by weighted summing, averaging, median, or other correction or filtering methods.
[0074] In the above-mentioned optional implementation method, each client device sends the second position of the same robot (the position of the robot calculated by each client device based on its own existing path-finding capability) to the server device, so that the server device calculates the precise real-time position of the robot based on the received multiple second positions, thereby realizing the coordinated cooperation between the client device and the server device to calculate the path of each robot and realize the networking of robot behavior. Compared with the related technology, in which the server device first imports the full map information and then the server device finds the path for each robot by occupying a large amount of CPU resources, the method of the embodiment of the present application can implement the path-finding method without the server device spending a lot of work, thereby saving computing resources.
[0075] Further, as another optional implementation, after step 102, the method includes:
[0076] receiving a third response sent by the server device, wherein the third response is used to indicate that the task claiming fails; here, when a first threshold number (such as the first threshold number is 5) of client devices have claimed the path calculation task of the target robot, the server device sends the third response to the client device;
[0077] After receiving the third response, the process returns to step 102 to request the server device to reselect the path calculation task of the target robot, wherein the reselected target robot does not include the robot that failed to receive the task.
[0078] The embodiment of the present application also provides a method for controlling the displacement of a robot, which is applied to a server device. Here, the server device is, for example, a game server. Figure 2 As shown, the method includes:
[0079] Step 201, receiving a first request sent by a client device, wherein the first request is used to request to obtain a path calculation task of a target robot; here, as mentioned above, the client device can determine the target robot based on a task state attribute, wherein the task state attribute includes a received state or an unreceived state;
[0080] Step 202, when the client device is allowed to obtain the path calculation task of the target robot, a first response is sent to the client device, and the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot; specifically, when the server device determines that the number of client devices that receive the path calculation task of the target robot is less than a first threshold, the server device determines to allow the client device to obtain the path calculation task of the target robot.
[0081] In the method for controlling the displacement of a robot in an embodiment of the present application, first, a server device receives a first request sent by a client device, wherein the first request is used to request to obtain a path calculation task for a target robot; secondly, when the client device is allowed to obtain the path calculation task for the target robot, a first response is sent to the client device, wherein the first response is used to indicate that the client device is allowed to obtain the path calculation task for the target robot. In this way, the server device allocates the path calculation task of the robot to each client device according to actual conditions, so that multiple client devices respectively calculate the current position of the same robot to improve the accuracy of the robot position calculated by the client device, and further calculates a more accurate position of the robot according to the multiple current positions received by the server device. Finally, the client device and the server device collaboratively calculate the paths of each robot and network the robot behaviors. Compared with the path-finding method of the related technology, it avoids occupying a large amount of CPU resources of the server device and saves computing resources.
[0082] Further, as an optional implementation, before step 201, the method further includes:
[0083] The robot path task table is read from the database, and the task status attributes corresponding to all robots are marked as unclaimed. Here, the robot path task table is planned by the software developer with reference to the map layout, and the robot path key points are configured.
[0084] After establishing a communication connection with the client device, receiving a second request sent by the client device, wherein the second request is used to request the robot path task table;
[0085] A second response is sent to the client device, wherein the second response carries the robot task list.
[0086] Further, as an optional implementation, after step 201, the method further includes:
[0087] When the first number of client devices that have obtained the path calculation task of the target robot is less than the first threshold, where the first threshold is a preset value, for example, the first threshold is temporarily set to 5, the following steps are performed:
[0088] Determine to allow the client device to obtain the path calculation task of the target robot;
[0089] When the task state attribute of the path calculation task of the target robot is in an unclaimed state, updating the task state attribute of the path calculation task of the target robot to a claimed state;
[0090] The information of the client device is updated to a client list, wherein the client list includes information of the client device that has obtained the path calculation task of the target robot.
[0091] In this optional implementation, when the number of other client devices that receive the path calculation task requested by the client device does not reach the first threshold, the server device determines that the client device that sends the first request can obtain the path calculation task of the target robot. At this time, on the one hand, the server device can add the information of the client device to the client list; on the other hand, the server device updates the task status attribute corresponding to the target robot to the received state (the task status attribute corresponding to the target robot was originally the unreceived state) or maintains the received state (the task status attribute corresponding to the target robot was originally the received state).
[0092] Further, as another optional implementation, after step 201, the method further includes:
[0093] When a first number of client devices that have obtained the path calculation task of the target robot is greater than or equal to a first threshold, a third response is sent to the client device, where the third response is used to indicate that the task has failed to be obtained.
[0094] Furthermore, as another optional implementation, the method further includes at least one of the following:
[0095] When it is detected that the client device is offline, the information of the client device is deleted from the client list; here, the server device can perform heartbeat detection on the client device. When it is detected that the client device is offline, the server device removes the information of the client device from the task table, that is, the server device will update the client list in real time based on the status of the client device;
[0096] When there is no information of the client device in the client list, the task status attribute of the path calculation task of the target robot is updated to an unclaimed state, that is, when no online client device claims the path calculation task of the target robot, the task status attribute of the path calculation task is updated to an unclaimed state to wait for subsequent clients to claim the path calculation task.
[0097] Further, as an optional implementation, after step 202, the method further includes:
[0098] Receive the second position of the target robot periodically sent by multiple client devices; here, the second position is the second position of the target robot calculated in real time by each client device starting from the first position of the target robot; wherein, when the task state attribute of the path calculation task of the target robot is the received state, the first position is the currently synchronized position of the target robot; when the task state attribute of the path calculation task of the target robot is the unreceived state, the first position is the starting position of the target robot;
[0099] Calculate the real-time position of the target robot according to the multiple second positions received in the current cycle; the specific implementation method of this step is, for example, to obtain the real-time position of the target robot by averaging, weighted summing or median or other correction or filtering of the latest received second positions; in this way, the accuracy of the real-time position of the target robot is improved;
[0100] The real-time position is sent to each of the client devices. Here, this step may specifically be sending the second position to each of the client devices that are communicatively connected to the server device, so that the robot NPC behavior can be networked.
[0101] In the above optional implementation method, by receiving the second position of the target robot sent by each client device (the position of the robot calculated by each client device based on its own existing pathfinding capability), the server device calculates the precise real-time position of the robot based on the received multiple second positions, thereby realizing the coordinated cooperation between the client device and the server device to calculate the path of each robot and realize the networking of robot behavior. Compared with the related technology, in which the server device first imports the full map information and then the server device finds the path for each robot by occupying a large amount of CPU resources, the method of the embodiment of the present application can implement the pathfinding method without the server device spending a lot of work, thereby saving computing resources.
[0102] In the method for controlling the displacement of the robot in the embodiment of the present application, the client device and the server device cooperate with each other, and each client device respectively calculates the second position of each robot in real time based on the existing path-finding capability, and the server device processes the received multiple second positions to obtain the real-time position of each robot, and sends the real-time position to each client device. In this way, the existing path-finding capability on the client side is utilized to obtain the nearby robot tasks from the server side, calculate the corresponding robot NPC path in real time, and send the robot path behavior to all client devices through the server device, thereby realizing the networking of NPC behavior. Compared with the existing method of pre-recording the robot motion trajectory, the embodiment of the present application has greater flexibility, and there is no need to re-record the robot path when the map changes later; compared with the existing implementation of the path-finding algorithm on the server device, the embodiment of the present application does not require the server device to spend a lot of work to implement the path-finding algorithm, and when the network synchronization scheme is subsequently changed, it can be seamlessly replaced, and has greater versatility. In addition, in the prior art, if the server solution is replaced later, it is necessary to re-implement a corresponding robot path-finding algorithm, which will consume a huge amount of R&D resources; if the recording method is adopted, since the number of robots is dozens of times that of the traditional method, the recording process requires manpower, and when the map changes, all robots need to be re-recorded, which is inefficient. However, in the method for controlling the displacement of the robot in the embodiment of the present application, the server-side device can dynamically allocate the path calculation tasks of the robot, and use the capabilities of the client device to calculate the position of the robot in real time and control the displacement of the robot. Therefore, there is no need to record the robot path in advance and no R&D resources will be consumed.
[0103] Below, the interaction process between the client device and the server device in the method for controlling the displacement of the robot according to the embodiment of the present application is briefly described.
[0104] First, R&D personnel plan the reference map layout, configure the key points of the robot path, and create a robot path task table.
[0105] Second, when the server device is turned on, it reads the robot path task table and marks all tasks as unclaimed.
[0106] Third, when the client player enters the metaverse, it first synchronizes the positions of all robots in the scene and requests the robot path task table from the server.
[0107] Fourth, if there is an NPC path calculation task that has not been received, the client player obtains the nearest NPC path task that has not been received, and requests the server device to accept the task; after receiving the request, the server device marks the task status as received, notifies the client device that the character has successfully accepted it, and stores the client information in the client list of the task;
[0108] If all robot path calculation tasks are already claimed, the client device requests to claim the nearest NPC path calculation task that has been claimed. After receiving the request, the server device determines whether the client list of the task has reached the upper limit (tentatively 5). If not, the client information is stored in the client list of the task and a claim success message is sent to the client. If the upper limit has been reached, a claim failure message is returned.
[0109] Fifth, after the client device receives the task, for the unreceived path calculation tasks, the robot path is calculated directly from the beginning. For the tasks that have been received, the subsequent path is calculated from the current position of the robot. The calculated robot position is reported to the server at a fixed frequency. After the server device receives the robot position, it averages the positions of multiple clients for the same task and sends the calculation result to all clients.
[0110] Sixth, the client device receives the robot's real-time position information and moves.
[0111] Seventh, the server device detects the client information through heartbeat. When the client goes offline, the client is removed from the task list. If the client list of the task is empty, the task is marked as unclaimed and waits for subsequent clients to pick it up.
[0112] The embodiment of the present application also provides a device for controlling the displacement of a robot, which is applied to a client device, such as Figure 3 As shown, including:
[0113] A first acquisition module 301 is used to acquire a robot path task table, wherein the robot path task table includes a plurality of robot path calculation tasks;
[0114] A sending module 302 is used to send a first request to a server device according to the task state attributes of the plurality of robot path calculation tasks, wherein the first request is used to request to obtain a path calculation task of a target robot;
[0115] A receiving module 303 is used to receive a first response sent by the server device, where the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot;
[0116] A second acquisition module 304 is used to acquire the real-time position of the target robot when the path calculation task of the target robot is acquired;
[0117] The control module 305 is used to control the displacement of the target robot according to the real-time position of the target robot.
[0118] Optionally, the sending module 302 includes:
[0119] An acquisition submodule, configured to obtain a candidate robot according to the task state attributes of the plurality of robot path calculation tasks;
[0120] A screening submodule, configured to screen the target robot from the candidate robots according to the distance between the candidate robots and the player character corresponding to the client device;
[0121] The first sending submodule is used to send the first request to the server device.
[0122] Optionally, the second acquisition module 304 includes:
[0123] A calculation submodule, configured to calculate the second position of the target robot in real time starting from the first position of the target robot; wherein, when the task state attribute of the path calculation task of the target robot is in the received state, the first position is the currently synchronized position of the target robot; and when the task state attribute of the path calculation task of the target robot is in the unreceived state, the first position is the starting position of the target robot;
[0124] A second sending submodule, used for periodically sending the second position currently calculated to the server device;
[0125] The receiving submodule is used to receive the real-time position sent by the server device, wherein the real-time position is related to the second positions sent by multiple client devices in the current period.
[0126] It should be noted here that the above-mentioned device for controlling the displacement of the robot provided in the embodiment of the present application can implement all the method steps implemented by the above-mentioned method embodiment for controlling the displacement of the robot applied to the client device, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those of the method embodiment will not be described in detail here.
[0127] The embodiment of the present application also provides a device for controlling the displacement of a robot, which is applied to a server device, such as Figure 4 As shown, including:
[0128] A first receiving module 401 is used to receive a first request sent by a client device, where the first request is used to request to obtain a path calculation task of a target robot;
[0129] The first sending module 402 is used to send a first response to the client device when the client device is allowed to obtain the path calculation task of the target robot, wherein the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot.
[0130] Optionally, the device further comprises:
[0131] An execution module is used to execute the following steps when a first number of client devices that have obtained the path calculation task of the target robot is less than a first threshold:
[0132] Determine to allow the client device to obtain the path calculation task of the target robot;
[0133] When the task state attribute of the path calculation task of the target robot is in an unclaimed state, updating the task state attribute of the path calculation task of the target robot to a claimed state;
[0134] The information of the client device is updated to a client list, wherein the client list includes information of the client device that has obtained the path calculation task of the target robot.
[0135] Optionally, the device further comprises:
[0136] A deleting module, used to delete the information of the client device from the client list when detecting that the client device is offline;
[0137] The updating module is used to update the task state attribute of the path calculation task of the target robot to an unclaimed state when there is no information of the client device in the client list.
[0138] Optionally, the device further comprises:
[0139] A second receiving module, used for receiving a second position of the target robot periodically sent by a plurality of client devices;
[0140] A calculation module, used for calculating the real-time position of the target robot according to a plurality of the second positions received in a current cycle;
[0141] The second sending module is used to send the real-time position to each of the client devices.
[0142] It should be noted here that the above-mentioned device for controlling the displacement of the robot provided in the embodiment of the present application can implement all the method steps implemented by the above-mentioned method embodiment for controlling the displacement of the robot applied to the server-side device, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those of the method embodiment will not be described in detail here.
[0143] An embodiment of the present application also provides an electronic device, including a transceiver 510, a processor 500, a memory 520, and a program stored in the memory 520 and executable on the processor 500; wherein, when the processor 500 executes the program, the method for controlling the displacement of a robot applied to a client device as described above is implemented, or, the method for controlling the displacement of a robot applied to a server device as described above is implemented.
[0144] The transceiver 510 is used to receive and send data under the control of the processor 500.
[0145] Among them, Figure 5 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 500 and various circuits of memory represented by memory 520 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 510 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. For different electronic devices, the user interface 530 may also be an interface capable of externally and internally connecting required devices, and the connected devices include but are not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.
[0146] The processor 500 is responsible for managing the bus architecture and general processing, and the memory 520 can store data used by the processor 500 when performing operations.
[0147] It should be noted here that the above-mentioned electronic device provided in the embodiment of the present application can implement all the method steps implemented by the above-mentioned method embodiment for controlling the displacement of a robot applied to a server-side device, or implement all the method steps implemented by the above-mentioned method embodiment for controlling the displacement of a robot applied to a client device, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those of the method embodiment will not be described in detail here.
[0148] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, each process of the method embodiment of controlling the displacement of a robot applied to a client device is implemented, or each process of the method embodiment of controlling the displacement of a robot applied to a server device is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for executing the methods described in each embodiment of the present application.
[0150] Therefore, an embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps in the method for controlling the displacement of a robot applied to a client device as described above, or implement the steps in the method for controlling the displacement of a robot applied to a server device as described above, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.
[0151] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0152] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for controlling the displacement of a robot, It is characterized in that Applied to client devices, including: Obtaining a robot path task table, wherein the robot path task table includes a plurality of robot path calculation tasks; Sending a first request to a server device according to the task state attributes of the multiple robot path calculation tasks, wherein the first request is used to request to obtain the path calculation task of the target robot; receiving a first response sent by the server device, where the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot; When the path calculation task of the target robot is obtained, obtaining the real-time position of the target robot; The target robot is controlled to move according to the real-time position of the target robot.
2. The method for controlling the displacement of a robot according to claim 1, It is characterized in that Sending a first request to a server device according to the task state attributes of the plurality of robot path calculation tasks includes: Obtaining a candidate robot according to the task state attributes of the plurality of robot path calculation tasks; Filtering the target robot from the candidate robots according to the distance between the candidate robots and the player character corresponding to the client device; Send the first request to the server device.
3. The method for controlling the displacement of a robot according to claim 1 or 2, It is characterized in that In the case of obtaining the path calculation task of the target robot, obtaining the real-time position of the target robot includes: Starting from the first position of the target robot, the second position of the target robot is calculated in real time; wherein, when the task state attribute of the path calculation task of the target robot is the received state, the first position is the currently synchronized position of the target robot; when the task state attribute of the path calculation task of the target robot is the unreceived state, the first position is the starting position of the target robot; Periodically sending the currently calculated second position to the server device; The real-time location sent by the server device is received, wherein the real-time location is related to second locations sent by multiple client devices in a current period.
4. A method for controlling the displacement of a robot, It is characterized in that Applied to server devices, including: Receiving a first request sent by a client device, where the first request is used to request to obtain a path calculation task of a target robot; In a case where the client device is allowed to obtain the path calculation task of the target robot, a first response is sent to the client device, where the first response is used to indicate that the client device is allowed to obtain the path calculation task of the target robot.
5. The method for controlling the displacement of a robot according to claim 4, It is characterized in that After receiving the first request sent by the client device, the method further includes: When the first number of client devices that have obtained the path calculation task of the target robot is less than a first threshold, performing the following steps: Determine to allow the client device to obtain the path calculation task of the target robot; When the task state attribute of the path calculation task of the target robot is in an unclaimed state, updating the task state attribute of the path calculation task of the target robot to a claimed state; The information of the client device is updated to a client list, wherein the client list includes information of the client device that has obtained the path calculation task of the target robot.
6. The method for controlling the displacement of a robot according to claim 5, It is characterized in that The method further comprises at least one of the following: When detecting that the client device is offline, deleting the information of the client device from the client list; When there is no information of the client device in the client list, the task state attribute of the path calculation task of the target robot is updated to an unclaimed state.
7. The method for controlling the displacement of a robot according to claim 4, It is characterized in that The method further comprises: Receiving a second position of the target robot periodically sent by a plurality of client devices; Calculating the real-time position of the target robot according to the plurality of second positions received in the current cycle; The real-time location is sent to each of the client devices.
8. An electronic device comprising a transceiver, a processor, a memory, and a program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the method for controlling the displacement of a robot as claimed in any one of claims 1 to 3 is implemented, or the method for controlling the displacement of a robot as claimed in any one of claims 4 to 7 is implemented.
9. A readable storage medium, It is characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the method for controlling the displacement of a robot as described in any one of claims 1 to 3 is implemented, or the method for controlling the displacement of a robot as described in any one of claims 4 to 7 is implemented.
10. A computer program product, It is characterized in that The method comprises computer instructions, which, when executed by a processor, implement the method for controlling the displacement of a robot as claimed in any one of claims 1 to 3, or implement the method for controlling the displacement of a robot as claimed in any one of claims 4 to 7.
Citation Information
Patent Citations
Using contextual data to recommend relevant content
CA3042622A1
Control of player character with enhanced motion functionality
CA3044587A1
E-sports game keyboard and mouse device applied to cloud games and use method thereof
CN106657071A
Method and client for controlling way finding of analog object
CN108815850A
Load balancing and fault-tolerant method for Internet of Things flow calculation
CN109981710A
