Animation playing method and device and electronic equipment

By receiving sensor data and animation control, the problem that the robotic arm axis cannot accurately stop at the target angle in the three-dimensional model is solved, and the rotation of the three-dimensional model is achieved accurately following the rotation of the physical model.

CN118941678APending Publication Date: 2024-11-12CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410979693.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the prior art, the robotic arm axis cannot accurately stop at the target angle in the three-dimensional model, resulting in the three-dimensional model being unable to accurately follow the rotation of the physical model.

Method used

By receiving the angle data sent by the sensor, the rotation direction of the axis is determined, and after the animation stops playing, the appropriate rotation animation is intercepted according to the current angle and target angle for playback until the angle is accurately aligned.

Benefits of technology

The angle of the robot arm axis in the three-dimensional model is accurately stopped at the target angle, ensuring that the rotation of the three-dimensional model accurately follows the rotation of the physical model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118941678A_ABST
    Figure CN118941678A_ABST
Patent Text Reader

Abstract

The invention discloses an animation playing method and device and electronic equipment, and the method comprises the steps: determining the rotation direction of a shaft to be a reverse direction according to a first angle and a second angle in a physical model, intercepting a rotation animation corresponding to a zero angle to the first angle, and carrying out the animation playing; after the animation stops playing, determining a third angle corresponding to the axis of the current rotating animation in the three-dimensional model; if the third angle is larger than the second angle, rotating animations corresponding to the zero angle to the third angle are intercepted, and animation playing is carried out; and returning to the step of determining the third angle corresponding to the axis of the current rotating animation in the three-dimensional model after the animation is stopped playing until the third angle is the same as the second angle. According to the embodiment of the invention, after the animation stops playing, the rotation direction of the shaft is determined based on the second angle and the third angle, and the animation is played, so that when the animation is played, the shaft accurately stops at the second angle at the corresponding angle in the three-dimensional model, and the rotation of the three-dimensional model accurately follows the rotation of the physical model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of three-dimensional display technology, and in particular to an animation playing method, device and electronic equipment. Background Art

[0002] With the transformation of the country's new industrialization, manufacturing companies have begun to gradually use robotic arms to replace manual labor to complete assembly line work. To ensure production safety, 3D motion capture and real-time animation rendering of each axis of the robotic arm are essential. In actual operation, the angle of each axis of the robotic arm in the physical model can be collected through sensors to control the 3D model to follow the rotation of the physical model.

[0003] In the related art, a rotation animation of each axis of the mechanical arm in the three-dimensional model is drawn based on each axis of the mechanical arm in the physical model through modeling software, and the rotation animation is played in an open source 3D engine, such as Three.js, wherein the open source 3D engine realizes the playback of the rotation animation by frequently refreshing the interface. For example, if the axis is rotated from a first angle to a second angle, when it is determined that the rotation direction of the axis is positive, the rotation animation corresponding to the zero angle is intercepted to the rotation animation corresponding to the second angle, and the animation is played forward. After the rotation animation is played from the first angle to the second angle, the animation stops, that is, the angle corresponding to the axis in the three-dimensional model stops precisely at the second angle; when it is determined that the rotation direction of the axis is reverse, since the time interval of refreshing the interface of the open source 3D engine is a random number, when the animation is played, the angle corresponding to the axis in the three-dimensional model cannot stop precisely at the target angle, thereby causing the three-dimensional model to be unable to accurately follow the rotation of the physical model. Summary of the invention

[0004] The present invention provides an animation playing method, device and electronic device, which are used to solve the problem in the prior art that when playing an animation, the angle corresponding to the axis in the three-dimensional model cannot be accurately stopped at the target angle, thereby causing the three-dimensional model to be unable to accurately follow the rotation of the physical model.

[0005] The method of the present invention comprises:

[0006] In a first aspect, an embodiment of the present application provides an animation playback method, the method comprising:

[0007] For each axis of the robot arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis;

[0008] After determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle and playing the animation;

[0009] After the animation stops playing, determining a third angle corresponding to the axis in the current rotation animation in the three-dimensional model;

[0010] If the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle and playing the animation;

[0011] Return to the step of determining the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle.

[0012] In a possible implementation, when the third angle is smaller than the second angle, performing animation playback based on the rotation animation corresponding to the third angle and the rotation animation corresponding to the second angle includes:

[0013] According to the rotation animation corresponding to the third angle to the second angle, the animation is played forward.

[0014] In a possible implementation manner, when the third angle is equal to the second angle, the method further includes:

[0015] Determine that the animation playback of the axis from the first angle to the second angle ends.

[0016] In a possible implementation, the receiving, which is sent by a sensor corresponding to the axis, a first angle corresponding to a previous moment and a second angle corresponding to a current moment of the axis, includes:

[0017] Based on the MQTT protocol, the first angle and the second angle sent by the sensor are received.

[0018] In a possible implementation, before receiving, for each axis of the mechanical arm in the physical model, a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis, the method further includes:

[0019] For each axis of the robotic arm in the three-dimensional model, based on the zero position and positive direction of each axis of the robotic arm in the physical model, a rotation animation corresponding to each angle is drawn by modeling software.

[0020] In a second aspect, an embodiment of the present application provides an animation playback device, the device comprising:

[0021] A receiving module, for each axis of the mechanical arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment, which are sent by a sensor corresponding to the axis;

[0022] A playback control module is used to determine that the rotation direction of the axis is reverse based on the first angle and the second angle, intercept the rotation animation corresponding to the zero angle to the first angle, and play the animation; after the animation stops playing, determine the third angle corresponding to the axis in the current rotation animation in the three-dimensional model; if the third angle is greater than the second angle, intercept the rotation animation corresponding to the zero angle to the third angle, and play the animation; return to the step of determining the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle.

[0023] In a possible implementation manner, when the third angle is smaller than the second angle, the playback control module is specifically configured to:

[0024] According to the rotation animation corresponding to the third angle to the second angle, the animation is played forward.

[0025] In a possible implementation manner, when the third angle is equal to the second angle, the playback control module is specifically configured to:

[0026] Determine that the animation playback of the axis from the first angle to the second angle ends.

[0027] In a possible implementation manner, the receiving module is specifically configured to receive the first angle and the second angle sent by the sensor based on the MQTT protocol.

[0028] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a display, wherein:

[0029] The memory is used to store computer programs;

[0030] The processor is used to execute the computer program to perform the following steps:

[0031] For each axis of the robot arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis;

[0032] After determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle and playing the animation;

[0033] After the animation stops playing, determining a third angle corresponding to the axis in the current rotation animation in the three-dimensional model;

[0034] If the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle and playing the animation;

[0035] Returning to the step of determining, after the animation stops playing, a third angle corresponding to the axis in the current rotation animation in the three-dimensional model, until the third angle is the same as the second angle;

[0036] The display is used to display the rotation animation.

[0037] The beneficial effects of the present invention are as follows:

[0038] The present application provides an animation playback method, device and electronic device. In an embodiment of the present application, when it is determined that the rotation direction of an axis is reverse, after the animation stops playing, based on the second angle corresponding to the axis in the physical model and the third angle corresponding to the axis in the three-dimensional model in the rotation animation, the rotation direction of the axis is determined and the animation is played, so that when the animation is playing, the angle of the axis in the three-dimensional model stops precisely at the second angle, thereby achieving the rotation of the three-dimensional model accurately following the rotation of the physical model. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 A flowchart of an animation playing method is provided for an embodiment of the present application;

[0041] Figure 2 A flowchart of another animation playback method is provided for an embodiment of the present application;

[0042] Figure 3 A schematic diagram of an animation playback device provided in an embodiment of the present application;

[0043] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" is two or more.

[0046] With the transformation of the country's new industrialization, manufacturing companies have begun to gradually use robotic arms to replace manual labor to complete assembly line work. To ensure production safety, 3D motion capture and real-time animation rendering of each axis of the robotic arm are essential. In actual operation, the angle of each axis of the robotic arm in the physical model can be collected through sensors to control the 3D model to follow the rotation of the physical model.

[0047] In the related technology, a rotation animation of each axis of the robotic arm in a three-dimensional model is drawn through modeling software based on each axis of the robotic arm in a physical model, and the rotation animation is played in an open source 3D engine. The open source 3D engine achieves the playback of the rotation animation by frequently refreshing the interface.

[0048] For example, if the axis is rotated from a first angle to a second angle, when it is determined that the rotation direction of the axis is forward, the open source 3D engine is used to intercept the rotation animation corresponding to the zero angle to the rotation animation corresponding to the second angle, and the animation is played forward. The rotation animation stops after playing from the first angle to the second angle; when it is determined that the rotation direction of the axis is reverse, the rotation animation corresponding to the zero angle to the rotation animation corresponding to the first angle is intercepted, and the animation is played in reverse. However, since the time interval for refreshing the interface of the open source 3D engine is a random number, the angle corresponding to the axis in the three-dimensional model cannot stop accurately at the second angle, which causes the three-dimensional model to be unable to accurately follow the rotation of the physical model.

[0049] Based on the above problems, Figure 1 As shown, a flowchart of an animation playing method is provided in an embodiment of the present application, and the steps of the method are as follows:

[0050] S101, for each axis of the robotic arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis;

[0051] S102, after determining that the rotation direction of the shaft is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle, and playing the animation;

[0052] S103, after the animation stops playing, determining a third angle corresponding to the axis of the current rotating animation in the three-dimensional model;

[0053] S104: if the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle and playing the animation;

[0054] S105, returning to the step of determining a third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle.

[0055] The present application provides an animation playing method, the method comprising: for each axis of the mechanical arm in the physical model, receiving the first angle corresponding to the previous moment and the second angle corresponding to the current moment of the axis sent by the sensor corresponding to the axis; after determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle, and playing the animation; after the animation stops playing, determining the third angle corresponding to the axis in the three-dimensional model in the current rotation animation; if the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle, and playing the animation; returning to the step of determining the third angle corresponding to the axis in the three-dimensional model in the current rotation animation after the animation stops playing, until the third angle and the second angle are the same. In an embodiment of the present application, when it is determined that the rotation direction of the axis is reverse, after the animation stops playing, based on the second angle corresponding to the axis in the physical model and the third angle corresponding to the axis in the three-dimensional model in the rotation animation, the rotation direction of the axis is determined and the animation is played, so that when the animation is played, the angle of the axis in the three-dimensional model stops precisely at the second angle, thereby realizing that the rotation of the three-dimensional model accurately follows the rotation of the physical model.

[0056] In a possible implementation, for each axis of the robotic arm in the physical model, before receiving the first angle corresponding to the axis at the previous moment and the second angle corresponding to the current moment sent by the sensor corresponding to the axis, it includes: using modeling software to establish a robotic arm in a three-dimensional model based on the robotic arm in the physical model, and performing bone binding on each axis of the robotic arm in the three-dimensional model, establishing a connection relationship between the bottom axis and the top axis, so that the rotation of the bottom axis in the three-dimensional model can drive the movement of the top axis.

[0057] Among them, the modeling software can be 3dsMax.

[0058] In a specific embodiment, a mechanical arm in a three-dimensional model is established based on the mechanical arm in the physical model through modeling software, and after skeleton binding is performed for each axis of the mechanical arm in the three-dimensional model, the method further includes:

[0059] For each axis of the robotic arm in the three-dimensional model, the rotation animation corresponding to each angle is drawn through the modeling software based on the zero position and positive direction of each axis of the robotic arm in the physical model. Specifically, based on the 360-degree rotational motion of each axis of the physical model, a 360-frame rotational animation of each axis of the three-dimensional model is drawn, wherein the 360-degree rotational motion corresponds to the 360-frame rotational animation. After the rotational animation corresponding to each angle is drawn through the modeling software, the three-dimensional model and the rotational animation are uploaded to the three-dimensional scene established by the open source 3D engine, so that when the axis of the physical model rotates 1 degree, the corresponding rotational animation of the axis of the three-dimensional model plays 1 frame.

[0060] Among them, the open source 3D engine may be Three.js.

[0061] In a possible implementation, in order to achieve that the rotation of the 3D model accurately follows the rotation of the physical model, it is necessary to play the animation based on the third angle corresponding to the axis in the current rotation animation in the 3D model and the second angle corresponding to the axis in the physical model at the current moment after the animation stops playing. Figure 2 As shown, it is a complete flow chart of an animation playing method provided in an embodiment of the present application, and the specific steps are as follows:

[0062] S201, for each axis of the robot arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis;

[0063] S202, determining whether the difference between the first angle and the second angle is less than 0, if so, executing S203, otherwise, executing S206;

[0064] In a specific embodiment, a sensor is set on each axis of the mechanical arm in the physical model, and angle data sent in real time by the sensor corresponding to the axis is received. The rotation direction of the axis is determined according to the first angle corresponding to the previous moment and the second angle corresponding to the current moment. When the difference between the first angle and the second angle is less than 0, the rotation direction of the axis is determined to be forward; when the difference between the first angle and the second angle is greater than 0, the rotation direction of the axis is determined to be reverse.

[0065] For example, when the sensor on the A-axis sends the first angle of the axis at the last moment as 29 degrees, and the second angle at the current moment as 30 degrees, then according to 29-30=-1, the rotation direction of the axis is determined to be forward. When the sensor on the B-axis collects the first angle of the axis at the last moment as 29 degrees, and the second angle at the current moment as 28 degrees, then according to 29-28=1, the rotation direction of the axis is determined to be reverse.

[0066] It should be noted that, in the embodiment of the present application, the first angle and the second angle sent by the sensor are received based on the MQTT (Message Queuing Telemetry Transport) protocol.

[0067] S203, determining that the rotation direction of the shaft is forward;

[0068] S204, intercepting the rotation animation corresponding to the zero angle to the rotation animation corresponding to the second angle, and playing the animation forward;

[0069] S205, determining that the angle corresponding to the axis in the current rotation animation in the three-dimensional model is a second angle, and stopping the animation playing;

[0070] In a specific embodiment, the rotation animation corresponding to the zero angle to the rotation animation corresponding to the second angle is intercepted, the rotation animation corresponding to the first angle is used as the animation start, and the rotation animation corresponding to the second angle is used as the animation end.

[0071] For example, when the A-axis in the physical model rotates from a first angle of 25 degrees to a second angle of 30 degrees, the rotation animation corresponding to 0 degrees to the rotation animation corresponding to the second angle of 30 degrees is intercepted, and the rotation animation corresponding to the first angle of 25 degrees is used as the start of the animation. When the animation plays to the rotation animation corresponding to the second angle of 30 degrees, the playback of all intercepted animations has been completed, the animation playback stops automatically, and the rotation animation corresponding to the second angle of 30 degrees is used as the end of the animation. That is, when the rotation direction of the axis is determined to be positive, when the animation is played, the angle corresponding to the axis in the three-dimensional model stops precisely at the second angle.

[0072] S206, determining that the rotation direction of the shaft is reverse;

[0073] S207, intercepting the rotation animation corresponding to the zero angle to the rotation animation corresponding to the first angle, and playing the animation in reverse;

[0074] In a specific embodiment, it is determined that the rotation direction of the axis is reverse, the rotation animation corresponding to the zero angle is intercepted to the rotation animation corresponding to the first angle, and the rotation animation corresponding to the first angle is used as the start of the animation.

[0075] For example, when the B-axis in the physical model rotates from a first angle of 35 degrees to a second angle of 30 degrees, the rotation animation corresponding to 0 degrees to the rotation animation corresponding to the first angle of 35 degrees is intercepted, and the rotation animation corresponding to the first angle of 35 degrees is used as the start of the animation. The open source 3D engine realizes the rendering and playback of the rotation animation by frequently refreshing the interface. Since the time interval for refreshing the interface of the open source 3D engine is a random number, the angle corresponding to the axis in the rotation animation in the three-dimensional model may not stop accurately at the second angle of 30 degrees. Therefore, it is necessary to determine the rotation direction of the axis based on the second angle and the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after each interface refresh, that is, when the animation stops playing, so as to play the animation.

[0076] S208, after the animation stops playing, determining a third angle corresponding to the axis of the current rotation animation in the three-dimensional model;

[0077] S209, determining whether the third angle and the second angle corresponding to the axis in the current rotation animation in the three-dimensional model are the same, if they are the same, executing S210, otherwise, executing S211;

[0078] S210, determining that the animation playback of the axis from the first angle to the second angle ends;

[0079] S211, determining whether the difference between the third angle and the second angle is less than 0, if so, executing S212, otherwise, executing S215;

[0080] In a specific embodiment, after the animation stops playing, the third angle corresponding to the axis in the current rotating animation in the three-dimensional model is determined. When the third angle is the same as the second angle, the angle corresponding to the axis in the rotating animation in the three-dimensional model stops accurately at the second angle, and the animation playback of the axis from the first angle to the second angle is determined to be completed; when the difference between the third angle and the second angle is less than 0, the rotation direction of the axis is determined to be forward; when the difference between the third angle and the second angle is greater than 0, the rotation direction of the axis is determined to be reverse.

[0081] For example, the second angle of the axis in the physical model at the current moment is 30 degrees, and the third angle of the axis in the three-dimensional model in the current rotation animation is 30.7 degrees, 30.7-30=0.7, which determines that the rotation direction of the axis is reverse; the second angle of the axis in the physical model at the current moment is 30 degrees, and the third angle of the axis in the three-dimensional model in the current rotation animation is 29.1 degrees, 29.1-30=-0.9, which determines that the rotation direction of the axis is forward.

[0082] S212, determining that the rotation direction of the shaft is positive;

[0083] S213, playing the animation forward according to the rotation animation corresponding to the third angle to the rotation animation corresponding to the second angle.

[0084] S214, determining that the angle corresponding to the axis in the current rotation animation in the three-dimensional model is a second angle, and stopping the animation playing;

[0085] In a specific embodiment, the rotation animation corresponding to the third angle is used as the start of the animation, and the rotation animation corresponding to the second angle is used as the end of the animation.

[0086] For example, after the animation stops playing, it is determined that the third angle corresponding to the axis of the current rotation animation in the three-dimensional model is 29 degrees, and the second angle corresponding to the axis at the current moment in the physical model is 30 degrees, and the rotation animation corresponding to the third angle of 29 degrees is used as the start of the animation. When the animation plays to the rotation animation corresponding to the second angle of 30 degrees, the playback of all intercepted animations has been completed, and the animation playback stops automatically, that is, the rotation animation corresponding to the second angle of 30 degrees is used as the end of the animation.

[0087] S215, determining that the rotation direction of the shaft is reverse;

[0088] S216, playing the animation in reverse direction from the rotation animation corresponding to the third angle to the rotation animation corresponding to the zero angle, and returning to step S208;

[0089] In a specific embodiment, it is determined that the rotation direction of the axis is reverse, and the rotation animation corresponding to the third angle is used as the start of the animation.

[0090] For example, when the B-axis in the physical model rotates from the third angle of 31 degrees to the second angle of 30 degrees, the rotation animation corresponding to the third angle of 31 degrees is used as the start of the animation, and the open source 3D engine realizes the rendering and playback of the rotation animation by frequently refreshing the interface. Since the time interval for refreshing the interface of the open source 3D engine is a random number, the angle corresponding to the axis in the rotation animation in the three-dimensional model may not necessarily stop accurately at the second angle of 30 degrees. Therefore, it is necessary to return to step S208 after each interface refresh, that is, after the animation stops playing, determine the third angle corresponding to the axis in the three-dimensional model in the current rotation animation, and determine the rotation direction of the axis based on the second angle and the third angle corresponding to the axis in the three-dimensional model in the current rotation animation to play the animation until the third angle is the same as the second angle, and it is determined that the animation playback of the axis from the first angle to the second angle is finished.

[0091] Based on the same technical concept, the embodiment of the present application also provides an animation playback device, the principle of solving the problem by the animation playback device is similar to that of the above-mentioned animation playback method. Therefore, the implementation of the animation playback device can refer to the implementation of the animation playback method, and the repeated parts will not be repeated.

[0092] like Figure 3 FIG. 1 is a schematic diagram of an animation playback device provided in an embodiment of the present application, the device comprising:

[0093] A receiving module 301 is used for receiving, for each axis of the robot arm in the physical model, a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis;

[0094] The playback control module 302 is used to determine that the rotation direction of the axis is reverse based on the first angle and the second angle, and then intercept the rotation animation corresponding to the zero angle to the first angle for animation playback; after the animation stops playing, determine the third angle corresponding to the axis in the current rotation animation in the three-dimensional model; if the third angle is greater than the second angle, intercept the rotation animation corresponding to the zero angle to the third angle for animation playback; return to the step of determining the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle.

[0095] The present application provides an animation playback device, for each axis of the mechanical arm in the physical model, receiving the first angle corresponding to the axis at the previous moment and the second angle corresponding to the current moment sent by the sensor corresponding to the axis; after determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle, and playing the animation; after the animation stops playing, determining the third angle corresponding to the axis in the three-dimensional model in the current rotation animation; if the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle, and playing the animation; returning to the step of determining the third angle corresponding to the axis in the three-dimensional model in the current rotation animation after the animation stops playing, until the third angle and the second angle are the same. In an embodiment of the present application, when it is determined that the rotation direction of the axis is reverse, after the animation stops playing, based on the second angle corresponding to the axis in the physical model and the third angle corresponding to the axis in the three-dimensional model in the rotation animation, the rotation direction of the axis is determined and the animation is played, so that when the animation is played, the angle of the axis in the three-dimensional model stops precisely at the second angle, thereby realizing that the rotation of the three-dimensional model accurately follows the rotation of the physical model.

[0096] In some embodiments, when the third angle is smaller than the second angle, the playback control module 302 is specifically configured to:

[0097] According to the rotation animation corresponding to the third angle to the second angle, the animation is played forward.

[0098] In some embodiments, when the third angle is equal to the second angle, the playback control module 302 is specifically configured to:

[0099] Determine that the animation playback of the axis from the first angle to the second angle ends.

[0100] In some embodiments, the receiving module 301 is specifically configured to receive the first angle and the second angle sent by the sensor based on the MQTT protocol.

[0101] Based on the same technical concept, an embodiment of the present application also provides an electronic device, the principle of solving the problem of the electronic device is similar to that of the above-mentioned animation playback method and device. Therefore, the implementation of the electronic device can refer to the implementation of the animation playback method, and the repeated parts will not be repeated.

[0102] like Figure 4 As shown, it is a schematic diagram of an electronic device provided in an embodiment of the present application, including a memory 401, a processor 402 and a display 403, wherein:

[0103] Memory 401, used for storing computer programs;

[0104] The processor 402 is configured to execute a computer program to perform the following steps:

[0105] For each axis of the robot arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis;

[0106] After determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercept the rotation animation corresponding to the zero angle to the first angle and play the animation;

[0107] After the animation stops playing, the third angle corresponding to the axis in the current rotation animation in the three-dimensional model is determined;

[0108] If the third angle is greater than the second angle, the rotation animation corresponding to the zero angle to the third angle is intercepted and the animation is played;

[0109] Return to the step of determining the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle;

[0110] The display 403 is used to display the rotation animation.

[0111] The present application provides an animation playback method, device and electronic device. The method receives, for each axis of a mechanical arm in a physical model, a first angle corresponding to the previous moment of the axis and a second angle corresponding to the current moment sent by a sensor corresponding to the axis; after determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercept the rotation animation corresponding to the zero angle to the first angle and play the animation; after the animation stops playing, determine the third angle corresponding to the axis in the three-dimensional model in the current rotation animation; if the third angle is greater than the second angle, intercept the rotation animation corresponding to the zero angle to the third angle and play the animation; return to the step of determining the third angle corresponding to the axis in the three-dimensional model in the current rotation animation after the animation stops playing, until the third angle and the second angle are the same. In an embodiment of the present application, when it is determined that the rotation direction of the axis is reverse, after the animation stops playing, based on the second angle corresponding to the axis in the physical model and the third angle corresponding to the axis in the three-dimensional model in the rotation animation, determine the rotation direction of the axis and play the animation, so that when the animation is played, the angle of the axis in the three-dimensional model stops precisely at the second angle, thereby achieving that the rotation of the three-dimensional model accurately follows the rotation of the physical model.

[0112] The present application is described above with reference to the block diagrams and / or flow charts showing the methods, devices (systems) and / or computer program products according to the embodiments of the present application. It should be understood that a block of the block diagram and / or flow chart diagram and a combination of blocks of the block diagram and / or flow chart diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable data processing device to produce a machine, so that the instructions executed by the computer processor and / or other programmable data processing device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.

[0113] Accordingly, the present application may also be implemented with hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium, which has a computer-usable or computer-readable program code implemented in the medium, for use by an instruction execution system or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that may contain, store, communicate, transmit, or convey a program for use by an instruction execution system, device, or apparatus, or in conjunction with an instruction execution system, device, or apparatus.

[0114] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. An animation playing method, characterized in that: The method comprises: For each axis of the robot arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis; After determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle and playing the animation; After the animation stops playing, determining a third angle corresponding to the axis in the current rotation animation in the three-dimensional model; If the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle and playing the animation; Return to the step of determining the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle.

2. The method according to claim 1, characterized in that When the third angle is smaller than the second angle, the method further includes: According to the rotation animation corresponding to the third angle to the second angle, the animation is played forward.

3. The method according to claim 1, characterized in that When the third angle is equal to the second angle, the method further includes: Determine that the animation playback of the axis from the first angle to the second angle ends.

4. The method according to any one of claims 1 to 3, characterized in that: The receiving, which is sent by a sensor corresponding to the axis, a first angle corresponding to a previous moment and a second angle corresponding to a current moment of the axis, comprises: Based on the MQTT protocol, the first angle and the second angle sent by the sensor are received.

5. The method according to any one of claims 1 to 3, characterized in that: Before receiving, for each axis of the mechanical arm in the physical model, a first angle corresponding to the previous moment and a second angle corresponding to the current moment of the axis sent by a sensor corresponding to the axis, the method further includes: For each axis of the robotic arm in the three-dimensional model, based on the zero position and positive direction of each axis of the robotic arm in the physical model, a rotation animation corresponding to each angle is drawn by modeling software.

6. An animation playback device, characterized in that: The device comprises: A receiving module, for each axis of the mechanical arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis; A playback control module is used to determine that the rotation direction of the axis is reverse based on the first angle and the second angle, intercept the rotation animation corresponding to the zero angle to the first angle, and play the animation; after the animation stops playing, determine the third angle corresponding to the axis in the current rotation animation in the three-dimensional model; if the third angle is greater than the second angle, intercept the rotation animation corresponding to the zero angle to the third angle, and play the animation; return to the step of determining the third angle corresponding to the axis in the current rotation animation in the three-dimensional model after the animation stops playing, until the third angle is the same as the second angle.

7. The device according to claim 6, characterized in that When the third angle is smaller than the second angle, the playback control module is specifically configured to: According to the rotation animation corresponding to the third angle to the second angle, the animation is played forward.

8. The device according to claim 6, characterized in that When the third angle is equal to the second angle, the playback control module is specifically configured to: Determine that the animation playback of the axis from the first angle to the second angle ends.

9. The device according to any one of claims 6 to 8, characterized in that: The receiving module is specifically configured to receive the first angle and the second angle sent by the sensor based on the MQTT protocol.

10. An electronic device, characterized in that: The device comprises a memory, a processor and a display, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to perform the following steps: For each axis of the robot arm in the physical model, receiving a first angle corresponding to the axis at a previous moment and a second angle corresponding to the axis at a current moment sent by a sensor corresponding to the axis; After determining that the rotation direction of the axis is reverse according to the first angle and the second angle, intercepting the rotation animation corresponding to the zero angle to the first angle and playing the animation; After the animation stops playing, determining a third angle corresponding to the axis in the current rotation animation in the three-dimensional model; If the third angle is greater than the second angle, intercepting the rotation animation corresponding to the zero angle to the third angle and playing the animation; Return to the step of determining, after the animation stops playing, a third angle corresponding to the axis in the current rotation animation in the three-dimensional model, until the third angle is the same as the second angle; The display is used to display the rotation animation.