Data processing methods, devices, equipment, and media based on servo drivers
By generating a timestamp for the transmission frequency of servo drive data and controlling it with a timer, the misalignment caused by the servo drive transmitting data too quickly and the performance problems of the remote monitoring system were solved, achieving stable data reception and display, and improving the stability and performance of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2026-03-10
AI Technical Summary
The existing servo drive sends data too quickly, causing data misalignment during data reception and storage. Furthermore, the remote monitoring system experiences page lag and memory leaks during data refresh, leading to page crashes.
By generating a transmission timestamp based on the data transmission frequency of the servo driver and storing the transmission timestamp and rendering data, data misalignment is avoided. Furthermore, a timer is used to control the data refresh frequency to reduce memory usage, thereby achieving stable data reception and display.
It achieves stable reception and display of servo drive data, avoids data misalignment problems, improves the performance and stability of the remote monitoring system, and reduces the risk of page lag and crashes.
Smart Images

Figure CN119011669B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of data processing technology, and in particular to a data processing method, apparatus, device and medium based on a servo driver. Background Technology
[0002] A servo driver is a controller used to control servo motors. It is part of a servo system and is widely used in automated equipment such as industrial robots and CNC machining centers. A servo driver typically consists of a main control board and a power board. The main control board is a low-voltage board, responsible for motor control algorithms and communication functions. The power board is a high-voltage board, responsible for power supply and converting the control signals from the main control board into high-voltage signals to drive the servo motor.
[0003] Currently, many servo drive manufacturers in the industry offer products that support remote monitoring (such as remote service platforms and remote monitoring systems). After connecting the servo drive to an industrial router, the data is sent to a database, and then the data in the database is retrieved to realize remote monitoring and management of the servo drive. This can improve production efficiency and equipment utilization, perform fault diagnosis, alarm notification, and can also prevent accidents to a certain extent.
[0004] The remote monitoring system is now being expanded to include various parameters of the servo drive, which need to be displayed as waveforms. Due to the high precision requirements of some waveforms, the servo drive needs to send data at a relatively high frequency, but this can easily lead to data misalignment during data reception. After receiving the data, it is also necessary to refresh and render the data in real time. Due to the performance limitations of the web client and the large amount of data, the remote monitoring system may experience problems such as reduced refresh rate, page lag, and page crashes caused by memory leaks after it starts running. Summary of the Invention
[0005] This invention provides a data processing method, apparatus, device, and medium based on a servo driver, aiming to solve the problem of data misalignment during data reception and storage caused by the excessively fast data transmission of the servo driver.
[0006] In a first aspect, embodiments of the present invention provide a data processing method based on a servo driver, comprising:
[0007] The data sent by the servo driver is processed to obtain the rendering data;
[0008] Generate a transmission timestamp based on the frequency of data transmission by the servo driver;
[0009] The sending timestamp and the rendering data are stored.
[0010] Secondly, embodiments of the present invention also provide a data processing apparatus based on a servo driver, comprising:
[0011] The processing unit is used to process the data sent by the servo driver to obtain rendering data;
[0012] A generation unit is used to generate a transmission timestamp based on the frequency at which the servo driver transmits data.
[0013] A storage unit is used to store the sending timestamp and the rendering data.
[0014] Thirdly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.
[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method.
[0016] This invention provides a data processing method, apparatus, device, and medium based on a servo driver. The method includes: processing data sent by the servo driver to obtain rendering data; generating a transmission timestamp based on the frequency of data transmission by the servo driver; and storing the transmission timestamp and the rendering data. The technical solution of this invention generates the transmission timestamp based on the frequency of data transmission by the servo driver and stores the transmission timestamp and rendering data, rather than storing data based on a timestamp generated from the system time. This avoids data misalignment during data reception and storage caused by the servo driver transmitting data too quickly. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a data processing method based on a servo driver according to an embodiment of the present invention.
[0019] Figure 2 This is a schematic diagram of a sub-process of a data processing method based on a servo driver, provided in an embodiment of the present invention.
[0020] Figure 3 This is a schematic diagram of a sub-process of a data processing method based on a servo driver, provided in an embodiment of the present invention.
[0021] Figure 4 A flowchart illustrating a data processing method based on a servo driver, provided for another embodiment of the present invention;
[0022] Figure 5 A schematic diagram of a sub-process of a data processing method based on a servo driver, provided for another embodiment of the present invention;
[0023] Figure 6 A simplified flowchart illustrating the processing and storage of data sent by a servo driver, provided in an embodiment of the present invention;
[0024] Figure 7 A simplified flowchart of the process for updating waveform data periodically based on a timer and rendering data to refresh the waveform graph, provided in an embodiment of the present invention;
[0025] Figure 8 A schematic block diagram of a data processing device based on a servo driver provided in an embodiment of the present invention;
[0026] Figure 9 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0029] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0030] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0031] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0032] Please see Figure 1 , Figure 1 This is a schematic flowchart of a data processing method based on a servo driver according to an embodiment of the present invention. The data processing method based on a servo driver will be described in detail below. Figure 1 As shown, the method includes the following steps S110-S130.
[0033] S110: Process the data sent by the servo driver to obtain rendering data.
[0034] In this embodiment of the invention, the data processing method based on a servo driver is applied to a servo driver data visualization platform. The servo driver data visualization platform includes a front-end and a back-end. The back-end refers to the part of the servo driver data visualization platform responsible for handling business logic, data storage, and processing. The front-end plots waveforms of various parameters of the servo driver and displays them. It should be noted that in this embodiment, because the acquisition of data from the servo driver, waveform plotting, and updating require maintaining a long-term connection with the servo driver, high real-time performance is required, and performance consumption should be minimized. Therefore, a WebSocket network connection is used to acquire data. That is, a WebSocket network connection is established between the back-end and the servo driver to receive data sent by the servo driver and store the data sent by the servo driver in a database corresponding to the servo driver data visualization platform. It should also be noted that in this embodiment, the Vue framework is used as the framework for the servo driver data visualization platform.
[0035] Furthermore, such as Figure 2 As shown, step S110 may specifically include steps S111-S113:
[0036] S111. Convert the data sent by the servo driver into JSON format data;
[0037] S112. Classify the JSON format data in key-value pair format to obtain classified data;
[0038] S113. Calculate the data length of the data block in the classification data, and divide the classification data according to the data length to obtain the parameter data and the function code.
[0039] In this embodiment of the invention, the data sent by the servo driver is processed to obtain rendering data. Specifically, the data sent by the servo driver is first converted into JSON format data; then, the JSON format data is classified in the form of key-value pairs to obtain classified data. It should be noted that in this embodiment, the servo driver transmission protocol transmits data in the form of "transmission header" + "function code" + "data block" + "16-bit data information check code" + "transmission tail", for example, "0f010102030412345678901234560d". The spaces are used to separate the different regions of the protocol. The actual transmitted data does not contain spaces. After classification, "function code: data block" is obtained, that is, the classified data is "function code: data block". It can be understood that the function code is a parameter identifier of the servo driver. Different servo drivers are distinguished by the device's IP address. Therefore, the function codes of the same function of different servo drivers will be consistent, while the function codes of different servo drivers will be inconsistent. After classifying the JSON format data, the data length of the data block in the classified data is calculated. The classified data is then segmented according to the data length to obtain the parameter data and the function code; that is, the parameter data is the data block. It should also be noted that in this embodiment, when plotting waveforms of various parameters of the servo driver, the servo driver is required to send the current device status information once at a preset time interval. However, due to performance limitations and latency on the web end, data cannot be received at the preset time frequency. Furthermore, due to the high data transmission frequency, data packet merging occurs, resulting in a data volume far exceeding the preset time when data is actually received. Therefore, it is necessary to classify and segment the received data sent by the servo driver. The preset time is 3ms. Understandably, in other embodiments, the preset time can be set according to actual needs.
[0040] S120. Generate a transmission timestamp based on the frequency of data transmission by the servo driver.
[0041] In this embodiment of the invention, after segmenting the classified data according to the data length to obtain the parameter data and the function code, a transmission timestamp is generated based on the frequency of data transmission by the servo driver. The transmission timestamp corresponds to the parameter data. It should be noted that in this embodiment, the transmission timestamp is generated based on the frequency of data transmission by the servo driver, rather than based on the system time, to avoid data misalignment during data reception and storage caused by the servo driver transmitting data too quickly. It should also be noted that, in this embodiment, the transmission timestamp is generated based on the frequency of data transmission by the servo driver. Specifically, taking 3ms as an example, if the servo driver transmits data for the first time at 3ms, the generated transmission timestamp is 3ms; if the servo driver transmits data for the second time at 6ms, the generated transmission timestamp is 6ms.
[0042] S130. Store the sending timestamp and the rendering data.
[0043] In this embodiment of the invention, after generating a transmission timestamp based on the frequency of data transmission by the servo driver, the transmission timestamp and the rendering data are stored. In this embodiment, the transmission timestamp, the parameter data, and the function code are stored in a receiving array for subsequent waveform plotting. It should be noted that in this embodiment, the parameter data is determined by the front-end of the servo driver data visualization platform. After the client selects the parameter to be observed in the front-end UI, a request is sent to the back-end of the servo driver data visualization platform, and the back-end retrieves the corresponding parameter data from the database.
[0044] Furthermore, such as Figure 3 As shown, step S130 may specifically include steps S131-S133:
[0045] S131. Determine whether the sending timestamp has accumulated to the preset timestamp. If the sending timestamp has accumulated to the preset timestamp, then execute step S132; otherwise, execute step S133.
[0046] S132. Convert the sending timestamp to generate a processing timestamp, and store the processing timestamp and the rendering data;
[0047] S133. Store the sending timestamp and the rendering data.
[0048] In this embodiment of the invention, the preset timestamp is 1000ms. When the cumulative sending timestamp reaches 1000ms, a timestamp conversion is performed, that is, 1000ms is converted into the processing timestamp 1s, and 1s and the rendering data are stored. If the sending timestamp is less than 1000ms, for example, 800ms, then 800ms and the rendering data are stored. It should be noted that in this embodiment, when the acquired waveform exceeds 10s, the timestamp will reach more than 10000ms. Since the acquired waveform is often used to detect whether the servo driver is normal, at least half a minute of data needs to be collected for observation. In this case, using milliseconds as the unit of timestamp would be detrimental to subsequent observation. Understandably, data is received once every 3ms, and 333 sets of data will be received within 1 second. When more than 333 sets of data are received, it can be determined that the sending timestamp exceeds 1s. When there is the 334th set of data, the sending timestamp will exceed 1000ms. At this time, subsequent timestamps will be converted in unit before storage.
[0049] Figure 4 A flowchart illustrating a data processing method based on a servo driver according to another embodiment of the present invention is shown below. Figure 4 As shown, in this embodiment, the method includes steps S110-S140. That is, in this embodiment, the method further includes step S140 after step S130 in the above embodiment.
[0050] S140. Update the waveform data periodically according to the timer settings and the stored rendering data to refresh the waveform.
[0051] In this embodiment of the invention, after storing the sending timestamp and the rendering data into the receiving array, the waveform data is periodically updated according to the timer setting and the stored rendering data to refresh the waveform. Specifically, as follows: Figure 5 As shown, step S140 may specifically include steps S141-S143:
[0052] S141. Transfer the rendering data stored in the receiving array to the original array;
[0053] S142. Copy the rendering data in the original array to a temporary array;
[0054] S143. If the update time set by the timer is reached, data is obtained from the temporary data to update the waveform data and refresh the waveform.
[0055] In this embodiment of the invention, the rendering data stored in the receiving array is transferred to the original array to obtain the array length of the original array; if the array length does not exceed the preset copy length, all the rendering data in the original array is copied to the temporary array; if the array length exceeds the preset copy length, the latest rendering data of the preset copy length in the original array is copied to the temporary array; when the update time set by the timer is reached, it is determined whether the execution count of the timer has reached the execution count threshold; if the execution count of the timer has not reached the execution count threshold, data is obtained from the temporary data to update the waveform data to refresh the waveform; if the execution count of the timer has reached the execution count threshold, the timer is destroyed to release memory, a new timer is created, and the step of obtaining data from the temporary data to update the waveform data to refresh the waveform is returned. Understandably, in this embodiment, the temporary array is created after the first waveform is drawn.
[0056] It should be noted that in this embodiment, the reason for setting a timer and destroying it to release memory when the number of executions reaches a threshold is that the data sent by the servo driver is processed and displayed as a line graph, achieving the effect of an oscilloscope. For graphical display of data, the ECharts plugin can be used, for example, to convert data into a corresponding image. By importing the data into the plugin's provided method, the data is rendered periodically, achieving real-time updates. However, since the ECharts plugin cannot handle data rendering with a millisecond period (because the servo driver can send a maximum of 12 sets of parameter data, approximately 1000 / 3*12 = 4000 sets of data are added per second in a 3ms period), the ECharts plugin continuously occupies memory when updating data. Furthermore, due to the web page's caching mechanism, the replaced data cannot directly release the occupied memory; the waveform corresponding to the ECharts plugin must be destroyed to release it. However, destroying the waveform results in a brief white screen, which is undesirable both visually and in actual use. When memory usage is high, the page will experience noticeable lag, potentially leading to a page crash. In this embodiment, by controlling the timer's working threshold, limiting the data length, and reclaiming the memory occupied by the plugin, the maximum refresh rate of the waveform can be achieved to 33Hz, which is the maximum frame rate that the human eye can capture, as shown in the CFF formula: CFF = 24 + 0.4 luminance, where (L) is an abbreviation for luminance, representing ambient brightness in cd / m². 2Using candela per square meter as the unit, the frame rate observable to the human eye can be calculated to be 24-30 Hz. When updating the waveform data after each data acquisition, logical judgments and processing are performed on the timer and data length, while simultaneously releasing some memory occupied by the waveform rendered by the plugin. This allows for long-term, high-frequency data refresh, achieving the effect of real-time remote observation of precise data from the servo drive. In other embodiments, the VUE framework and ECharts plugin can also be replaced with other languages, such as frameworks and plugins written in C.
[0057] It should also be noted that in this embodiment, the timer is set after the first sending timestamp and the rendering data are stored in the receiving array. The timer interval is set to 150ms, meaning 50 sets of data are updated each time. Since the data received every 3ms will be plotted as a point in the waveform, updating it every time data is received would not only be unobservable to the naked eye but also waste performance. Therefore, the refresh rate needs to be reduced. In actual testing, a 150ms interval can achieve a smooth waveform plotting effect. The timer is triggered once when it is set for the initial waveform plotting. At this time, the rendering data processed and stored for the first time is used for waveform plotting. All received rendering data is stored in the original array, meaning the data in the original array is used for the first waveform plotting. After the timer is successfully triggered, the variable recording the number of timer triggers is incremented by 1. In this embodiment, the variable recording the number of timer triggers is the execution count, and the execution count threshold is 50 times. Understandably, since timers continuously occupy memory after each scheduled trigger, destroying the timer after a certain number of executions releases the memory it occupies. Creating a new timer then allocates only a fixed amount of memory to it, and once the timer's memory usage is reached, it is released and cleared, thus reusing the previously occupied memory and reducing the performance load on the browser. It is also understandable that the timer interval can be set according to actual needs to correspond to different refresh rates of the waveform.
[0058] Please see Figure 6 , Figure 6 This is a simplified flowchart of the process for processing and storing data sent by a servo driver, provided in an embodiment of the present invention. Figure 6 In the process, the server driver establishes a WebSocket connection with the backend; receives data sent by the server driver; converts the data into JSON format; classifies the data in key-value pairs; calculates the data length, performs data segmentation, and generates a sending timestamp; determines whether the sending timestamp has accumulated to 1000ms; if it has accumulated to 1000ms, converts the milliseconds to seconds and then generates a processing timestamp; if it has not accumulated to 1000ms, it stores the segmented data and the sending timestamp.
[0059] Please see Figure 7 , Figure 7 This is a simplified flowchart of a process for updating waveform data periodically based on a timer and rendering data to refresh the waveform, provided in an embodiment of the present invention. Figure 7 In the process, a timer is set to continuously update the waveform; the first time rendering data is received, it is stored and rendered; a temporary array is created for subsequent continuous updates of rendering data; the original array receives newly transmitted rendering data; the rendering data in the original array is copied to the temporary array; it is checked whether the length of the original array exceeds the preset copy length; if the length of the original array does not exceed the preset copy length, the original array is completely copied; if the length of the original array exceeds the preset copy length, the latest rendering data within the preset copy length is retained; it waits for the timer to trigger an update rendering; after the timer executes, it checks whether the number of executions has reached the execution count threshold; if the number of executions reaches the execution count threshold, the timer is destroyed, memory is released, and a new timer is created to continue executing the timer function. Understandably, if the number of executions does not reach the execution count threshold, the timer function also continues to execute to update the waveform data and refresh the waveform.
[0060] In summary, this embodiment can stably receive and process large amounts of data transmitted by the servo drive and render them into waveforms for display, thereby achieving precise data visualization of the servo drive and enabling remote monitoring of the servo drive.
[0061] Figure 8 This is a schematic block diagram of a data processing device 200 based on a servo driver provided in an embodiment of the present invention. Figure 8 As shown, corresponding to the above-described servo driver-based data processing method, the present invention also provides a servo driver-based data processing apparatus 200. This servo driver-based data processing apparatus 200 includes a unit for executing the above-described servo driver-based data processing method, and the apparatus can be configured in a computer device. Specifically, please refer to... Figure 8 The servo driver-based data processing device 200 includes a processing unit 201, a generation unit 202, and a storage unit 203.
[0062] The processing unit 201 is used to process the data sent by the servo driver to obtain rendering data; the generation unit 202 is used to generate a sending timestamp according to the frequency of the data sent by the servo driver; and the storage unit 203 is used to store the sending timestamp and the rendering data.
[0063] In some embodiments, such as this one, the processing unit 201 includes a conversion unit, a classification unit, and a calculation and segmentation unit.
[0064] The conversion unit is used to convert the data sent by the servo driver into JSON format data; the classification unit is used to classify the JSON format data in the form of key-value pairs to obtain classified data; the calculation and segmentation unit is used to calculate the data length of the data block in the classified data, and segment the classified data according to the data length to obtain the parameter data and the function code.
[0065] In some embodiments, such as this one, the storage unit 203 includes a first determination unit, a first storage subunit, and a second storage subunit.
[0066] The first determining unit is used to determine whether the sending timestamp has accumulated to a preset timestamp; the first storage subunit is used to convert the sending timestamp to generate a processing timestamp if the sending timestamp has accumulated to the preset timestamp, and store the processing timestamp and the rendering data; the second storage subunit is used to store the sending timestamp and the rendering data if the sending timestamp has not accumulated to the preset timestamp.
[0067] In some embodiments, such as this one, the servo driver-based data processing device 200 further includes an update unit.
[0068] The update unit is used to update the waveform data periodically according to the timer settings and the stored rendering data to refresh the waveform.
[0069] In some embodiments, such as this one, the update unit includes a transmission unit, a copy unit, and an update subunit.
[0070] The transmission unit is used to transmit the rendering data stored in the receiving array to the original array; the copy unit is used to copy the rendering data in the original array to a temporary array; and the update subunit is used to update the waveform data by retrieving data from the temporary data to refresh the waveform if the update time set by the timer is reached.
[0071] In some embodiments, such as this one, the copying unit includes an acquisition unit, a first copying subunit, and a second copying subunit.
[0072] The acquisition unit is used to acquire the array length of the original array; the first copy subunit is used to copy all the rendering data in the original array to the temporary array if the array length does not exceed the preset copy length; the second copy subunit is used to copy the latest rendering data of the preset copy length in the original array to the temporary array if the array length exceeds the preset copy length.
[0073] In some embodiments, such as this one, a second judgment unit and a destruction and reconstruction unit are included before the step of obtaining data from the temporary data to update the waveform data to refresh the waveform.
[0074] The second judgment unit is used to determine whether the number of times the timer is executed has reached the execution count threshold; the destruction and reconstruction unit is used to destroy the timer to release memory and recreate the timer if the number of times the timer is executed reaches the execution count threshold.
[0075] The aforementioned data processing device based on a servo driver can be implemented as a computer program, which can, for example... Figure 9 It runs on the computer device shown.
[0076] Please see Figure 9 , Figure 9 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. The computer device 300 is a device with data processing capabilities based on a servo driver.
[0077] See Figure 9 The computer device 300 includes a processor 302, a memory, and a network interface 305 connected via a system bus 301. The memory may include a non-volatile storage medium 303 and internal memory 304.
[0078] The non-volatile storage medium 303 can store an operating system 3031 and a computer program 3032. When the computer program 3032 is executed, it causes the processor 302 to perform a data processing method based on a servo driver.
[0079] The processor 302 provides computing and control capabilities to support the operation of the entire computer device 300.
[0080] The internal memory 304 provides an environment for the execution of the computer program 3032 in the non-volatile storage medium 303. When the computer program 3032 is executed by the processor 302, the processor 302 can execute a data processing method based on a servo driver.
[0081] This network interface 305 is used for network communication with other devices. Those skilled in the art will understand that... Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device 300 to which the present invention is applied. The specific computer device 300 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0082] The processor 302 is used to run a computer program 3032 stored in a memory to implement any embodiment of the above-described data processing method based on a servo driver.
[0083] It should be understood that, in this embodiment of the invention, the processor 302 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0084] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0085] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program. When executed by a processor, the computer program causes the processor to perform any embodiment of the above-described servo driver-based data processing method.
[0086] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0087] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0088] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0089] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0090] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0091] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0092] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Since these modifications and variations fall within the scope of the claims and their equivalents, this invention also intends to include these modifications and variations.
[0093] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A data processing method based on a servo driver, characterized by, The application comprises the following steps: processing data sent by a servo driver to obtain rendering data; generating a sending timestamp according to the frequency of data sent by the servo driver; storing the sending timestamp and the rendering data; the rendering data comprises parameter data and function codes, and the processing of data sent by the servo driver to obtain rendering data comprises the following steps: converting data sent by the servo driver into JSON format data; classifying the JSON format data in the form of key-value pairs to obtain classified data; calculating the data length of the data block in the classified data, and segmenting the classified data according to the data length to obtain the parameter data and the function codes; the storing of the sending timestamp and the rendering data comprises the following steps: judging whether the sending timestamp is accumulated to a preset timestamp; if the sending timestamp is accumulated to the preset timestamp, converting the sending timestamp to generate a processing timestamp, and storing the processing timestamp and the rendering data; if the sending timestamp is not accumulated to the preset timestamp, storing the sending timestamp and the rendering data.
2. The method of claim 1, wherein, after the storing of the sending timestamp and the rendering data, the application further comprises the following steps: updating waveform graph data according to the setting of a timer and the stored rendering data to refresh a waveform graph.
3. The method of claim 2, wherein, the updating of waveform graph data according to the setting of a timer and the stored rendering data to refresh a waveform graph comprises the following steps: transferring the rendering data stored in a receiving array to an original array; copying the rendering data in the original array to a temporary array; if the update time set by the timer is reached, updating the waveform graph data from the temporary array to refresh the waveform graph.
4. The method of claim 3, wherein, the copying of the rendering data in the original array to a temporary array comprises the following steps: obtaining the array length of the original array; if the array length does not exceed a preset copy length, copying all the rendering data in the original array to the temporary array; if the array length exceeds the preset copy length, copying the latest rendering data of the preset copy length in the original array to the temporary array.
5. The method of claim 3, wherein, before the updating of the waveform graph data from the temporary array to refresh the waveform graph, the application further comprises the following steps: judging whether the execution times of the timer reach an execution times threshold; if the execution times of the timer reach the execution times threshold, destroying the timer to release memory, and re-creating a new timer.
6. A data processing apparatus based on a servo driver, characterized by The application comprises the following steps: a processing unit for processing data sent by a servo driver to obtain rendering data; a generating unit for generating a sending timestamp according to the frequency of data sent by the servo driver; a storage unit for storing the sending timestamp and the rendering data; the rendering data comprises parameter data and function codes, and the processing unit comprises a conversion unit, a classification unit and a calculation and segmentation unit; the conversion unit is used for converting data sent by the servo driver into JSON format data; The classification unit is configured to classify the JSON format data in the form of key-value pairs to obtain classified data; The computing and dividing unit is configured to compute data lengths of the data blocks in the classified data, and divide the classified data according to the data lengths to obtain the parameter data and the function code; The storage unit comprises a first judging unit, a first storage sub-unit and a second storage sub-unit; The first judging unit is configured to judge whether the sending timestamp is accumulated to a preset timestamp; The first storage sub-unit is configured to, if the sending timestamp is accumulated to the preset timestamp, convert the sending timestamp to generate a processing timestamp, and store the processing timestamp and the rendering data; The second storage sub-unit is configured to, if the sending timestamp is not accumulated to the preset timestamp, store the sending timestamp and the rendering data.
7. A computer device, comprising: The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1-5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program can implement the method according to any one of claims 1-5 when being executed by a processor.
Citation Information
Patent Citations
Data rendering processing method and device, computer equipment and storage medium
CN117244237A
Decoder equipment delivering metadata to auxiliary equipment in order to control it
US20210160565A1