Electronic cam editor developed based on Qt interface

The electronic cam editor developed based on the Qt interface enables real-time visualization and rapid editing of multi-dimensional curves, solving the problems of insufficient visualization, low editing efficiency, and poor data synchronization in existing technologies, and improving the efficiency and reliability of electronic cam curve design.

CN120909481AInactive Publication Date: 2025-11-07ZHONGKE TIMES (SHENZHEN) COMPUTER SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511024145.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2025-11-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies for electronic cam curve design suffer from insufficient visualization, low curve editing efficiency, narrow algorithm adaptability, and weak data synchronization, resulting in long debugging cycles and a high susceptibility to errors, making it difficult to meet the needs of complex working conditions.

Method used

An electronic cam editor based on the Qt interface is used to achieve real-time visualization, rapid editing and chart synchronization of multi-dimensional curves through interface interaction module, topology management module, curve calculation module, extreme value analysis module, curve caching module and linkage rendering module. It supports more than 20 professional motion curve algorithms and is compatible with industrial bus protocols.

Benefits of technology

It enables real-time linked display of multi-dimensional curves, rapid curve editing, and synchronous export of charts, significantly improving debugging efficiency, reducing the risk of mechanical shock, and simplifying data connection between cross-brand equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909481A_ABST
    Figure CN120909481A_ABST
Patent Text Reader

Abstract

The invention provides an electronic cam editor developed based on a Qt interface. Comprising an interface interaction module used for converting pixel coordinates into main axis and slave axis engineering coordinates in real time; the topology management module is used for maintaining a reference point set and updating the curve segment topology according to an adjacent relation when receiving a reference point insertion, deletion or movement instruction; the curve calculation module is used for calling a corresponding algorithm in a preset curve algorithm library to generate a curve segment coefficient and outputting a curve sampling sequence according to the reference point and the curve type identifier output by the topology management module; the extreme value analysis module is used for performing first-order, second-order and third-order derivation on the curve sampling sequence; the curve cache module is used for receiving the curve sampling sequence and the extreme value data and writing the curve sampling sequence and the extreme value data into curve cache; and the linkage rendering module is used for synchronously rendering the position and speed related multi-dimensional curve in the Qt interface and refreshing and displaying. According to the method, real-time linkage display of the multi-dimensional curve, rapid inert curve editing and synchronous export of the chart table can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of industrial automation software, and in particular to an electronic cam editor based on Qt interface development. BACKGROUND

[0002] In the industrial automation scenarios such as packaging machinery, textile equipment, electronic assembly line and robot, the complex phase displacement relationship between the main shaft and the slave shaft is often realized through the electronic cam function to meet the requirements of high speed, low impact and low vibration. The quality of the electronic cam curve directly affects the equipment beat, processing precision and mechanical life, so the researchers need to finely design and debug the position-velocity-acceleration-jerk four-dimensional motion curve in the host computer or the controller.

[0003] The existing technology usually adopts two types of means to configure the electronic cam curve: one is to rely on the numerical editing interface of the embedded controller, and the engineers input discrete points or interpolation parameters through the key, and then detect the curve effect by means of an oscilloscope or a temporarily installed encoder; the second is to use the PC configuration tool provided by the controller manufacturer, which mainly supports two-dimensional position curve, and only supports separate numerical filling or offline list import for high-order curves such as speed and acceleration, and lacks multi-dimensional linkage display and real-time simulation function. The insertion, deletion or movement of the reference point in the above two types of schemes usually needs to repeatedly switch the text box and manually trigger the whole curve recalculation; when the curve order changes or the algorithm switches, a large number of parameters need to be filled in again, which is tedious and prone to errors.

[0004] The existing technology still has the following problems:

[0005] Insufficient visualization: traditional numerical form or single-dimensional curve interface cannot simultaneously present four curves of position, speed, acceleration and jerk, and engineers are difficult to timely find hidden dangers such as discontinuity or over-peak value among curves.

[0006] Low curve editing efficiency: insertion, deletion or fine adjustment of reference points need to manually correct the algorithm parameters of adjacent segments and recalculate the whole segment, which is long in debugging period and prone to interface lag under high sampling resolution.

[0007] Narrow algorithm adaptation range: the existing tools usually only have a small number of trigonometric functions or low-order polynomial algorithms, do not support flexible switching of more than twenty professional motion curves in the same curve, and are difficult to meet complex working conditions.

[0008] Weak data synchronization: the chart and the parameter table usually belong to different interfaces or need to be manually refreshed, which is prone to inconsistent data display and increases the risk of debugging.

[0009] Lack of open export format: most factory tools output private binary files, which cannot be quickly connected with heterogeneous motion control systems, limiting the reuse of electronic cam curves across brands. SUMMARY

[0010] Therefore, the electronic cam editor based on Qt interface development is provided in the embodiments of the present application to solve the problems of insufficient real-time visualization of multi-dimensional curves, low curve editing efficiency, and poor data synchronization and export compatibility in the prior art.

[0011] The electronic cam editor based on Qt interface development provided in the embodiments of the present application comprises: an interface interaction module, configured to receive a mouse or keyboard event in a Qt graphical interface and convert a pixel coordinate into a main shaft and a slave shaft engineering coordinate in real time; a topology management module, configured to, when receiving a reference point insertion, deletion or movement instruction of the interface interaction module, maintain a reference point set and update a curve segment topology according to an adjacent relationship; a curve calculation module, configured to, according to a reference point and a curve type identifier output by the topology management module, call a corresponding algorithm in a preset curve algorithm library to generate a curve segment coefficient and output a curve sampling sequence; an extreme value analysis module, configured to perform first-order, second-order and third-order derivation on the curve sampling sequence and record position and speed related extreme value data; a curve cache module, configured to receive the curve sampling sequence and the extreme value data and write them into a curve cache, and generate a local redrawing instruction; a linkage rendering module, configured to render a multi-dimensional curve related to position and speed in the Qt interface according to the local redrawing instruction and refresh a display; and a curve export module, configured to encapsulate the latest curve sampling sequence in the curve cache module into electronic cam table data conforming to an electronic cam configuration format of a target motion control system and output the electronic cam table data, so as to be called by the motion control system to implement electronic cam motion planning.

[0012] The above at least one technical solution adopted in the embodiments of the present application can achieve the following beneficial effects:

[0013] The interface interaction module is used for receiving mouse or keyboard events in the Qt graphical interface and converting pixel coordinates into main shaft and slave shaft engineering coordinates in real time; the topology management module is used for maintaining a reference point set and updating curve segment topology according to a neighboring relationship when receiving a reference point insertion, deletion or movement instruction of the interface interaction module; the curve calculation module is used for calling a corresponding algorithm in a preset curve algorithm library to generate a curve segment coefficient and output a curve sampling sequence according to the reference point and a curve type identifier output by the topology management module; the extreme value analysis module is used for performing first-order, second-order and third-order derivation on the curve sampling sequence and recording position and speed related extreme value data; the curve cache module is used for receiving the curve sampling sequence and the extreme value data and writing into a curve cache, and simultaneously generating a local redrawing instruction; the linkage rendering module is used for synchronously rendering multi-dimensional curves related to position and speed in the Qt interface according to the local redrawing instruction and refreshing display; and the curve export module is used for encapsulating the latest curve sampling sequence in the curve cache module into electronic cam table data conforming to a configuration format of an electronic cam of a target motion control system and outputting the electronic cam table data for calling by the motion control system to realize electronic cam motion planning. The application can realize real-time linkage display of multi-dimensional curves, rapid inertial curve editing and synchronous export of charts and tables. BRIEF DESCRIPTION OF DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort.

[0015] Figure 1 It is the overall structure schematic diagram of the electronic cam editor developed based on Qt interface provided by the embodiments of the present application. DETAILED DESCRIPTION

[0016] In the following description, specific details such as specific system structures, techniques, etc. are presented in order to thoroughly understand the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits and methods are omitted to avoid unnecessary details that hinder the description of the present application.

[0017] The present application provides an electronic cam editor developed based on Qt interface, aiming at solving the problem of visual programming of electronic cam curve design in the field of industrial automation. Traditional cam curve debugging relies on oscilloscope observation and repeated parameter modification, resulting in low debugging efficiency. By realizing graphical electronic cam editing, intuitive curve design and real-time simulation functions are provided.

[0018] The main functions of the editor software of the application include: based on Qt framework development, providing an electronic cam curve visual editing platform for motion control system. Supporting the linkage editing of position, velocity, acceleration and jerk four-dimensional curves, providing 20+ kinds of professional motion curve algorithms (including POLYNOM5, SPLINE, BESCHLTRAPEZ, etc.).

[0019] The technical features of the editor software of the application include: the electronic cam editor uses QCustomPolt component under Qt framework, when the user edits the curve, the system can calculate and call hardware accelerated rendering curve in real time, realizes what you see is what you get. Multi-dimensional curve linkage, intelligent topological constraint, high-precision algorithm engine. Compatible with industrial bus protocol, supporting various motion control algorithms. Flexible curve editing architecture.

[0020] The editor software of the application is a graphical tool specially designed for electronic cam curve design and visual debugging. The software relies on Qt framework to build graphical user interface, combines real-time data curve drawing and point editing function, and provides electronic cam curve configuration and management means for automation control system. Its goal is to provide an intuitive, efficient and interactive electronic cam editor platform for industrial automation, robot control and other fields, simplify the debugging process and improve system development efficiency.

[0021] The structure and function of the electronic cam editor developed based on Qt interface provided by the embodiments of the application will be described below in combination with the drawings and specific embodiments. Figure 1 The overall structure of the electronic cam editor developed based on Qt interface provided by the embodiments of the application is shown in FIG. 1, which specifically can include the following contents: Figure 1

[0022] The interface interaction module 101 is used for receiving mouse or keyboard events in the Qt graphical interface, and converting pixel coordinates into main shaft and slave shaft engineering coordinates in real time;

[0023] The topological management module 102 is used for maintaining the reference point set according to the adjacent relationship and updating the curve segment topology when receiving the reference point insertion, deletion or movement instruction of the interface interaction module;

[0024] The curve calculation module 103 is used for calling corresponding algorithms in the preset curve algorithm library to generate curve segment coefficients and output curve sampling sequence according to the reference points and curve type identification output by the topological management module;

[0025] The extreme value analysis module 104 is used for first-order, second-order and third-order derivation of the curve sampling sequence, and records the extreme value data related to position and velocity;

[0026] ​The curve caching module 105 is configured to receive the curve sampling sequence and the extreme value data and write them into the curve cache, and generate a local redrawing instruction;

[0027] The linkage rendering module 106 is configured to render the multi-dimensional curve related to the position and the speed in the Qt interface according to the local redrawing instruction and refresh the display;

[0028] The curve exporting module 107 is configured to encapsulate the latest curve sampling sequence in the curve caching module into electronic cam table data conforming to the electronic cam configuration format of a target motion control system, and output the electronic cam table data for the motion control system to call and implement electronic cam motion planning.

[0029] In some embodiments, a mouse or keyboard event is received in a Qt graphical interface, and pixel coordinates are converted into main shaft and slave shaft engineering coordinates in real time, including:

[0030] The mouse click, double-click, drag and keyboard input events are received to obtain pixel coordinates corresponding to the events;

[0031] A coordinate transformation function of a drawing control is called, and the pixel coordinates are mapped to curve coordinates in combination with a scaling ratio and a translation amount of a current curve graph;

[0032] The curve coordinates are converted into main shaft engineering coordinates and slave shaft engineering coordinates in sequence according to preset main shaft and slave shaft scale factors;

[0033] A reference point insertion instruction, a reference point moving instruction or a reference point deletion instruction containing the main shaft engineering coordinates and the slave shaft engineering coordinates are generated according to the event type;

[0034] The instruction is sent to the topology management module through a signal-slot mechanism to trigger curve segment topology update.

[0035] Specifically, in one application scenario, the electronic cam editor runs on an industrial host computer installed with a Windows 10-64-bit operating system, and builds a user graphical interface based on a Qt 5.15.2 framework. For ease of description, the editor is taken as an example of a packaging machine with a main shaft stroke of 360.0° and a slave shaft stroke of 100.000 mm to illustrate in detail the implementation process of “receiving a mouse or keyboard event in a Qt graphical interface, and converting pixel coordinates into main shaft and slave shaft engineering coordinates in real time”.

[0036] I. Event capture

[0037] The editor installs a uniform event filter on a custom drawing control. The filter continuously listens to four types of events: mouse click, double-click, drag and keyboard input.

[0038] When the left button is double-clicked in the blank area of the curve, the filter records the pixel coordinates (xPixel, yPixel) of the double-click position and marks the event type as "INSERT";

[0039] When the left button is pressed and dragged on an existing reference point, the pixel coordinate increments ΔxPixel, ΔyPixel are read in real time and the event type is marked as "MOVE";

[0040] When the right button is double-clicked on an existing reference point, the pixel coordinates are recorded and the event type is marked as "DELETE";

[0041] When the keyboard direction keys are triggered, the direction and step distance are recorded, and the event type is marked as "KEY-MOVE".

[0042] II. Curve coordinate mapping

[0043] The drawing control maintains the current curve plot scaling factor scaleFactor and translation amount transOffset. After receiving the above pixel coordinates, the coordinate transformation function provided by the control is first called to convert (xPixel, yPixel) according to the formula:

[0044] xCurve = (xPixel - transOffsetX) / scaleFactorX

[0045] yCurve = (yPixel - transOffsetY) / scaleFactorY

[0046] to get the curve coordinates (xCurve, yCurve). The curve coordinates are scaled with the horizontal axis as the main axis angle and the vertical axis as the slave axis displacement, which conforms to the current viewport state of the curve plot.

[0047] III. Engineering coordinate conversion

[0048] The editor pre-sets the main axis scaling factor kMaster = 1.000° / unit and the slave axis scaling factor kSlave = 0.100mm / unit in the engineering parameter panel. When the curve coordinates are obtained, the following formulas are used:

[0049] masterPos = xCurve × kMaster

[0050] slavePos = yCurve × kSlave

[0051] The master axis engineering coordinate masterPos and the slave axis engineering coordinate slavePos are obtained by conversion in sequence. For the direction key event, the step distance value corresponding to kMaster or kSlave is added or subtracted on the basis of the original engineering coordinate to obtain the new masterPos and slavePos.

[0052] Four, instruction generation

[0053] The editor constructs a uniform data structure CamCmd according to the event type, and the data structure includes the field {cmdType, masterPos, slavePos, timeStamp}:

[0054] The INSERT instruction writes "INS" in cmdType, carries masterPos and slavePos to indicate the engineering coordinates of the insertion point;

[0055] The MOVE instruction writes "MOV" in cmdType, carries the latest masterPos and slavePos;

[0056] The DELETE instruction writes "DEL" in cmdType, and only needs to carry masterPos for positioning the reference point to be deleted;

[0057] The KEY-MOVE instruction has the same format as the MOVE instruction.

[0058] All CamCmds are marked with a high-precision timestamp timeStamp, which is used for subsequent replay or undo operations.

[0059] Five, signal slot sending

[0060] After the interface interaction module generates CamCmd, it immediately sends a signal sigCamCmd(CamCmd) to the topology management module through the Qt signal slot mechanism. This signal uses queue-based asynchronous transmission between threads to ensure that the interface main thread will not be stuck due to topology updates. The topology management module parses the cmdType field in the slot function, and sequentially performs reference point insertion, deletion or movement operations, and distributes recalculation events to the curve calculation module after the operation is completed.

[0061] In actual use, when the engineer double-clicks on the curve to insert a new point, the system can complete the complete link of pixel coordinates→curve coordinates→engineering coordinates→CamCmd construction→signal sending within 10ms; if the engineer holds an existing reference point and drags it, only the mouse event refresh cycle is limited, and the interface can realize stable 60Hz real-time coordinate update and curve redrawing, meeting the high-speed curve editing requirements.

[0062] In some embodiments, upon receiving the reference point insertion, deletion or movement instruction of the interface interaction module, the reference point set is maintained according to the adjacent relationship and the curve segment topology is updated, including:

[0063] The instruction is received and the master axis coordinate of the target reference point is determined, and the adjacent reference points before and after the target reference point are sequentially retrieved based on the master axis coordinate;

[0064] When the reference point is inserted, the target reference point is written into the object pool and inserted between the adjacent reference points, and the corresponding curve segment is split into two segments;

[0065] When the reference point is deleted, the target reference point is released from the object pool and removed from the reference point set, and the two curve segments before and after the target reference point are merged into one segment;

[0066] When the reference point is moved, the target reference point coordinate is updated under the condition that the master axis coordinate difference between the target reference point and the adjacent reference point is not less than the preset minimum distance;

[0067] After the curve segment splitting or merging occurs, the preset curve algorithm is called to re-solve the curve segment coefficients according to the length and curve type identifier of the affected curve segment, and a curve segment recalculation event is sent to the curve calculation module.

[0068] Specifically, the following takes the editing process in an actual application scenario as an example to explain the whole process of the topology management module maintaining the reference point set according to the adjacent relationship and updating the curve segment topology after receiving the reference point insertion, deletion or movement instruction of the interface interaction module, which can specifically include the following contents:

[0069] I. Data structure initialization

[0070] The editor constructs a reference point set based on a double-linked list when starting, and the linked list node stores fields such as master axis coordinate, slave axis coordinate and curve type identifier. In order to avoid frequent memory allocation, the system pre-allocates a continuous memory as an object pool, and uses an empty linked list to manage unallocated nodes. Allocation and release are completed by pointer movement without calling the operating system interface. The total capacity of the object pool is determined by the maximum number of reference points set by the user, which is typically 1024 nodes.

[0071] II. Instruction analysis and adjacent retrieval

[0072] When the topology management module receives CamCmd, it first analyzes the cmdType field to determine the operation type, and performs an ordered binary search in the linked list according to masterPos to find the insertion interval or the node to be operated of the target master axis coordinate. If the size of the linked list is large, the system will automatically enable skip list acceleration to maintain logarithmic retrieval efficiency.

[0073] III. Reference point insertion

[0074] If cmdType is INS, the system takes a free node from the object pool and writes masterPos and slavePos into it, then updates its prev and next pointers so that it is located between the previous and next reference points. After the insertion is completed, the original curve segment is marked as "to be split", and a new curve segment is generated on the left and right of the old reference point, and the curve segment type is inherited from the original segment. After the insertion operation, a "split" event is pushed to the "curve segment change queue".

[0075] Four, reference point deletion

[0076] If cmdType is DEL, the system locates the target node and directly connects its prev and next pointers to form a new adjacent relationship, and returns the deleted node to the object pool free list. The deletion operation causes the previous and next curve segments to be merged into a single segment; the system marks "to be merged" in the curve segment attribute and pushes a "merge" event.

[0077] Five, reference point movement

[0078] If cmdType is MOV or KEY-MOVE, the system calculates the difference in the principal axis coordinates of the previous and next adjacent nodes before updating the node coordinates. When the difference is less than the minimum distance threshold, the system immediately rejects the movement request and pops up a prompt "reference point is too dense" on the interface. If the difference meets the constraints, the new masterPos and slavePos are directly written. Since the relative order of the nodes in the linked list may change, the system adjusts the position of the node in the linked list according to masterPos to maintain the monotonic increase of the principal axis coordinates.

[0079] Six, curve segment recalculation trigger

[0080] When the split or merge event reaches the head of the curve segment change queue, the system dequeues and calculates the total length len and curve type identifier type of the affected curve segment. If len exceeds the applicable interval of the original algorithm, the system selects a new algorithm with higher order or better transition segment smoothing performance through the algorithm library mapping table, for example, the original is a fifth-order polynomial POLYNOM5 and is upgraded to a seventh-order polynomial POLYNOM7 after merging. Then the system encapsulates {segmentID, len, type} as CalcEvent and sends it to the curve calculation module. After receiving CalcEvent, the curve calculation module only performs parameter solving and sampling discrete operations on the corresponding curve segment, without touching other unaffected segments, achieving lazy local recalculation.

[0081] Seven, thread safety and rollback

[0082] The topology management module and the curve calculation module run in background work threads. To ensure thread safety, the benchmark point list and the curve segment array are protected by read-write locks: the insertion, deletion, and movement operations occupy the write lock, and the calculation operation occupies the read lock. If the user continuously issues a rollback instruction within a short time after an editing action, the system reads the backup node state in the editing history stack, rolls back the list and the curve segment array to the specified version, triggers the recalculation event again, and ensures that the topology and the curve are always consistent.

[0083] By using object pool reuse, skip list accelerated retrieval, minimum distance constraint, and lazy local recalculation, the embodiment can control the average processing time of a single insertion or deletion operation to be within 2ms in common industrial packaging machinery applications with two hundred to three hundred benchmark points, and can maintain a real-time rendering frame rate of 60fps. In the extreme scenario of one thousand benchmark points, the editing response can be maintained below 15ms, significantly improving the curve debugging efficiency and reducing the risk of memory jitter.

[0084] In some embodiments, according to the benchmark points and the curve type identifier output by the topology management module, a corresponding algorithm is called in the preset curve algorithm library to generate curve segment coefficients and output a curve sampling sequence, including:

[0085] Obtain the benchmark point set and the corresponding curve type identifier returned by the topology management module;

[0086] Find a curve solving algorithm that matches the curve type identifier in the curve algorithm library, and reselect an algorithm whose order satisfies the continuity requirement when there is curve segment merging or splitting;

[0087] Construct a parameter solving matrix according to the benchmark point set, and use numerical inverse or iterative method to solve to obtain the target curve segment coefficients;

[0088] Discretize the target curve segment coefficients according to the preset sampling resolution to generate a curve sampling sequence covering the entire main shaft range;

[0089] Output the generated curve sampling sequence to the curve cache module, and send a curve update event to the extreme value analysis module.

[0090] Specifically, in the embodiment, the curve calculation module runs in a background calculation thread and relies on a double-buffered memory structure and a thread-safe queue to receive CalcEvent events pushed by the topology management module. Each Calc Event contains the starting benchmark point, the ending benchmark point, and the curve type identifier type of the affected curve segment. After receiving the event, the curve calculation module performs the following operations in sequence:

[0091] I. Benchmark point and curve type analysis

[0092] The curve calculation module first reads the first and last reference point IDs in CalcEvent, sequentially extracts the main shaft coordinates and the axis coordinates of all reference points in the curve segment through linked list traversal, and generates an ordered reference point set P = {P0, P1,..., Pn}. Then, the type field is analyzed to determine the type of curve algorithm required for the current curve segment, such as POLYNOM5, SPLINE, or BESCHLTRAPEZ, etc. When the CalcEvent is marked as a "split" or "merge" event, the module reselects an algorithm with higher or lower order based on the total length of the curve segment len compared to the applicable interval of the algorithm library, to ensure curvature continuity and interpolation stability. This adaptive algorithm selection mechanism can avoid overfitting or underfitting problems caused by too short or too long curve segments.

[0093] II. Parameter solving matrix construction

[0094] The curve algorithm library presets a parameter template for each curve type. Taking the fifth-order polynomial POLYNOM5 as an example, the template defines the coefficient vector A = [a0, a1, a2, a3, a4, a5], and establishes six equations for the first and last reference points and their first and second derivatives. The curve calculation module generates the corresponding equation group matrix M and constant term vector B based on the reference point set P, where the matrix elements are composed of high-order powers of the main shaft coordinates. For trigonometric function or spline interpolation types, the module constructs a matrix containing sine, cosine, or piecewise cubic spline basis functions according to the same idea. If the equation group size is greater than eight by eight, it will automatically switch to the improved Gaussian elimination method to reduce calculation errors; if the equation group contains ill-conditioned eigenvalues, the module enables column main element selection and two-level condition number estimation, and reduces the order if necessary.

[0095] III. Coefficient solving and convergence verification

[0096] The curve calculation module calls the linear algebra inverse library to perform Gaussian-Jordan elimination on the matrix M, and outputs the coefficient vector A. When the selected algorithm requires iteration (such as BESCHLTRAPEZ quadratic fitting), the quasi-Newton iteration method is used with a maximum iteration count of 32 and a convergence threshold of 1x10^-12. After the iteration is completed, the error e = ‖MA-B‖ / ‖B‖ is calculated. If e ≥ 5x10^-6, the module automatically increases the order or replaces it with a spline algorithm with higher smoothness to solve again until the error is less than the threshold.

[0097] IV. Discretization sampling

[0098] To unify the multi-dimensional curve display and the data precision of the controller, the embodiment sets a default sampling resolution of four points per degree of the main shaft. When the interval between reference points is less than one degree, the minimum sampling step is reduced to 0.05 degrees. The curve calculation module uniformly divides the main shaft interval according to the sampling step, performs fast power recursion on the vector A, and generates four-dimensional sampling values of the slave shaft coordinates, speed, acceleration, and jerk. All sampling values are written in the current write buffer BufferW in the double buffer in the form of "main shaft coordinates four-dimensional coordinate array".

[0099] V. Sampling sequence output and event distribution

[0100] After the generation of BufferW, the curve calculation module writes its pointer and length and width information into the exchange interface of the curve cache module, and marks BufferW as a read-only state. Then, the curve calculation module sends a "CurveChanged" event to the extreme value analysis module through an asynchronous signal, and the event carries the curve segment ID and the sampling range. After receiving BufferW, the curve cache module shares data with the rendering thread through pointer exchange without memory copying, thereby ensuring low latency in high-frequency refresh scenarios.

[0101] By using adaptive algorithm selection, ill-conditioned matrix detection, and double-buffered sampling output, the embodiment shortens the curve segment recalculation time while ensuring high-precision curve fitting. In the scenario of one thousand points per degree of the main shaft, the complete solution and sampling generation of a single segment POLYNOM7 curve takes less than 1.5 ms; in the extreme case of simultaneous editing of multiple curve segments, the editor can still maintain a real-time display of sixty frames per second, significantly improving the curve debugging efficiency and reducing the risk of mechanical impact caused by fitting errors.

[0102] In some embodiments, the first, second, and third derivatives of the curve sampling sequence are calculated, and the extreme value data related to position and speed are recorded, including:

[0103] The curve sampling sequence is obtained, and the first, second, and third derivatives are calculated in sequence using a difference algorithm to obtain the speed curve, acceleration curve, and jerk curve, respectively;

[0104] The derivative sign changes of adjacent sampling points in the curve sampling sequence and the speed curve are compared to determine the maximum and minimum values corresponding to the main shaft coordinates;

[0105] The main shaft coordinates, slave shaft coordinates, and extreme value types of the detected extreme values are written into the extreme value table and stored synchronously in the curve cache module for extreme value labeling by the linkage rendering module.

[0106] Specifically, in the present embodiment, the extreme value analysis module runs in a background thread independent of the curve calculation module. Upon receiving the CurveChanged event pushed by the curve calculation module, the module first maps the latest sampling sequence in the curve cache module in read-only mode. The present embodiment takes the spindle one-degree four-point sampling and the curve segment length ninety degrees as an example, performs three-order difference derivation on the position curve S(i) and extracts the extreme value, and the detailed process is described as follows.

[0107] When the extreme value analysis thread acquires the curve sampling sequence, in order to eliminate the amplification effect of quantization jitter on high-order derivatives, the system first performs a three-point moving average smoothing on the position sequence S(i) to reduce the noise amplitude while keeping the phase unchanged. Then the first derivative V(i) is calculated using the central difference method, where Δθ is the spindle sampling step. After completing the velocity curve derivation, the system continues to perform the same central difference on V(i) to obtain the acceleration curve A(i). In order to facilitate the rendering of the label jerk information, the central difference is performed again on A(i) to obtain the third-order derivative J(i).

[0108] After the derivative sequence is obtained, the extreme value analysis module simultaneously scans the derivative signs of adjacent sampling points in the position curve S(i) and the velocity curve V(i). If V(i-1) is positive and V(i) is negative, then the spindle coordinate θ(i) corresponding to S(i) is the maximum point of the position curve; if the signs are opposite, it is the minimum point. Similarly, the velocity extreme value is detected in the velocity curve by the acceleration sign change. In order to reduce the risk of missing detection caused by sampling granularity, when the system finds that the derivative signs of adjacent sampling points are the same and the zero-crossing point falls between the two points, it uses linear interpolation to estimate the accurate extreme value position, and then reads the corresponding slave axis coordinate from the position curve or the velocity curve. Each extreme value is marked as "P_MAX", "P_MIN", "V_MAX" or "V_MIN", and written into the extreme value table E, which includes the spindle coordinate θ, the slave axis coordinate S or V, the extreme value type and the curve segment index.

[0109] After the extreme value table E is written, the extreme value analysis module synchronizes E to the curve cache module through a lock-free pointer exchange. The curve cache module immediately sends a "Extrema Ready" signal to the linkage rendering module upon receiving the new extreme value table. The rendering thread can highlight the extreme points on the four curves according to the spindle coordinate in the next frame refresh, and pop up the extreme value type and value information when the cursor hovers over.

[0110] The embodiment realizes high-precision extraction of position curve and speed curve extreme values at a sampling frequency of 8192 Hz by means of third-order central difference combined with interpolation correction, and the average time consumption of complete derivation and extreme value scanning of a single ninety-degree curve is only 0.3 ms, which can update the extreme value label in real time without affecting the sixty-frame refresh rate. The scheme effectively overcomes the problems of traditional forward difference being easily affected by quantization error and insufficient extreme value positioning precision, ensures reliable labeling of multi-dimensional curves in high-speed editing scenarios, and thus improves the rapid judgment ability of engineers on curve smoothness and safety margin.

[0111] In some embodiments, the curve sampling sequence and extreme value data are received and written into the curve cache, and local redrawing instructions are generated, including:

[0112] The curve sampling sequence is written into the cache mapping table according to the main shaft coordinate order, and the received extreme value data is attached in the corresponding entry;

[0113] The cache mapping table before and after writing is compared for section difference, and the starting value and the ending value of the main shaft coordinate that have changed are determined;

[0114] The rectangular region parameters of local redrawing are calculated according to the starting value and the ending value, and redrawing instructions containing the rectangular region parameters are generated;

[0115] The redrawing instructions are sent to the linkage rendering module through the signal slot mechanism to trigger local curve redrawing.

[0116] Specifically, in the embodiment, the curve cache module runs in a special memory service thread outside the interface main thread. The module provides a "cache mapping table", which takes the main shaft coordinate θ as the ordered index, packs the four-dimensional curve value and extreme value label of each sampling point into a unit node, and stores it in a continuous memory segment. To avoid frequent expansion triggering data relocation, the system allocates the cache area once at the maximum main shaft stroke x sampling density when the editor starts, and maintains double-buffer pointers BufferFront and BufferBack to realize fast data switching.

[0117] First, when the curve calculation module completes sampling and pushes the BufferW pointer to the curve cache module, the curve cache thread first occupies BufferBack through write lock, and then writes the sampling points in BufferW into the cache mapping table in θ increasing order. If the sampling point θ coincides with the index in the mapping table, the node data is directly overwritten; if it is a new θ, a node is inserted at the corresponding position and the subsequent memory segment is moved to ensure the monotonicity of the index.

[0118] Further, the extreme value analysis module sends the pointer of E to the curve cache module together with the curve segment ID after writing the extreme value table E. The curve cache thread traverses E during the write lock holding period, compares the theta field of each extreme value with the mapping table entry, and if a match is successful, writes the extreme value type marker byte in the node header and appends the extreme value dedicated data segment for subsequent rendering highlighting. The write lock is released after the extreme value writing is completed.

[0119] Further, the curve cache thread subsequently performs a head-to-tail synchronization scan on BufferFront and BufferBack. The scan records θStart when the first node data inconsistency is detected, and continues to scan until all fields are consistent again, and records θEnd. If the file tail is still not consistent again, θEnd takes the maximum θ value. To speed up the comparison process, the system adopts 8-byte alignment for the node structure and pre-calculates the checksum of the four-dimensional curve value and the extreme value type as a 16-bit digest, and only needs to compare the digest to quickly find the difference.

[0120] Further, after obtaining θStart and θEnd, the module reads the coordinate axis scaling scaleX, scaleY and the current curve chart translation transX, transY maintained by the interface interaction module, and maps θStart, θEnd to pixel coordinates xStart, xEnd. The system further retrieves the maximum and minimum axis coordinates yMax and yMin in the xStart to xEnd interval in BufferBack, and also maps them to pixel yMaxPx and yMinPx, to determine the local redraw rectangle clipRect = <xStart, xEnd, yMinPx, yMaxPx>.

[0121] Further, the curve cache module constructs a structure RedrawCmd on the stack, with fields including clipRect, θStart, θEnd, and buffer version number version. Then it emits sigRedraw(RedrawCmd) to the linked rendering module through the signal slot mechanism. To avoid rendering blocking the write thread, the signal uses a queue type connection, and the rendering module enables OpenGL clipping test immediately after taking out the cmd in the next frame, and only redraws the curve in clipRect and highlights the extreme value marker.

[0122] Further, the rendering module sends an ack signal to the curve cache module after confirming that it has successfully processed the version number version. After receiving the ack, the curve cache module exchanges the BufferBack and BufferFront pointers through an atomic operation, and releases the write lock, completing the current update cycle.

[0123] By double-buffered writing, digesting differential comparison and pixel-level cropping rectangle redraw, the embodiment significantly reduces the data transfer and rendering load in high-frequency editing scenarios. In the case of a packaging machine with a 360-degree main shaft stroke and 14,400 sampling points, a single local edit usually triggers less than 2-degree θ section redraw, and the actual pixel redraw area is less than 5% of the entire window. The average frame rendering time is reduced from 16 milliseconds in full segment redraw to less than 2 milliseconds, ensuring that the interface remains smooth and flicker-free at a refresh rate of 60 frames per second, while maintaining real-time consistency of extreme value labels and curve data.

[0124] In some embodiments, a data synchronization module is also included for writing corresponding data fields to the tree table model when the curve cache module is updated to maintain consistency between the chart and table data.

[0125] Specifically, the embodiment adds a data synchronization module to the aforementioned curve cache module and linkage rendering module to automatically write to the tree table model after the curve cache module is updated, ensuring that the curve chart and parameter table always remain consistent. This module is integrated into the main thread of the interface and uses the signal-slot mechanism provided by the Qt model-view framework to achieve efficient and low-latency data synchronization.

[0126] The tree table model inherits from the standard item model, with the root node representing the complete electronic cam project, the first layer of child nodes corresponding to each curve segment, and the second layer of child nodes corresponding to the sampling points within the curve segment. Each sampling point node contains column fields {main shaft coordinate θ, slave shaft coordinate S, velocity V, curve type, extreme value label}; curve segment nodes only count summary information such as segment range, curve type, and extreme value count. The model shares the same main shaft sampling resolution with the drawing control when created, ensuring that the number of nodes and cache mapping table entries correspond one-to-one.

[0127] In some examples, the curve cache module sends RedrawCmd to the linkage rendering module while also notifying the data synchronization module through an additional signal sigCacheUpdated(cachePtr, θStart, θEnd). The signal carries the write cache pointer cachePtr and the segment range θStart~θEnd. Upon receiving the signal, the data synchronization module immediately acquires a unique write lock on the model to prevent conflicts with user edits on the table.

[0128] Further, the data synchronization module holds a field mapping table to map the four-dimensional curve values in the cache node and the extreme value markers to the column fields. The module converts the affected node's row indices startRow and endRow in the model according to θStart and θEnd, and then directly reads the continuous node data with cachePtr as the offset and writes it row by row into the model. To avoid interface lag caused by bulk data writing, the module calls the bulk data writing interface in batches of one hundred, immediately sends the dataChanged signal after writing, and returns to the event loop, ensuring that the interface remains responsive.

[0129] In some examples, when writing the extreme value column, if the node extreme value marker is the position maximum value or the speed maximum value, the model records the custom role ExtRole = 1 or 2. The table view determines font bolding or background highlighting according to ExtRole in the delegated drawing stage, so as to quickly locate the key nodes in the list; for ordinary nodes without extreme value markers, ExtRole defaults to 0 and no highlighting is performed.

[0130] Further, after the child nodes are updated, the data synchronization module recursively calculates the statistical fields of the curve segment nodes, including the segment length, the number of position extreme values, and the number of speed extreme values. The module only calls the dataChanged signal for the affected parent node after each recursion is completed, avoiding triggering the entire tree redraw. If all curve segments under the model root node are updated, the module further refreshes the root node summary information through the layout change signal.

[0131] Further, the data synchronization module releases the model write lock immediately after completing the row update and parent node summary, and sends a "parameter table has been synchronized" prompt to the status bar. Since the table view performs differential refresh processing on the dataChanged signal, the row height, column width, and scroll bar position of the interface will not jump, ensuring that the table area being viewed by the user remains stable.

[0132] Through block-by-block writing, column field mapping, and recursive parent node refresh, the embodiment realizes millisecond-level synchronization of curve cache updates to the tree table view. In the case of more than ten thousand main shaft sampling points and more than two thousand extreme value markers, the total time for table synchronization caused by each local edit is less than three milliseconds; when the user quickly drags the reference point or batch imports the point, the user can still see the value changes in the position, speed, and extreme value columns in the table in real time, and the highlight markers do not lose frames or flicker, thereby ensuring the strict consistency of the graphical view and the table view based on the same data source and improving the debugging efficiency.

[0133] In some embodiments, when the curve cache module is updated, the corresponding data fields are written to the tree table model to keep the chart and table data consistent, including:

[0134] When the curve cache module generates a local redraw instruction, it packages the curve sampling sequence and the main axis coordinate range involved in the redraw as an update event;

[0135] The update event is parsed, the target row node in the tree table model is located according to the main axis coordinate order, and the column field that needs to be updated is determined;

[0136] The main axis engineering coordinates, the slave axis engineering coordinates, the curve type identifier and the extreme value mark in the curve sampling sequence are written into the corresponding column field of the target row node in turn;

[0137] The model refresh function is called to send a data change signal, so that the tree table view and the custom drawing control in the interface interaction module are synchronized and refreshed.

[0138] Specifically, the embodiment relies on the message queue mechanism between the curve cache module and the interface main thread to explain in detail the process of "writing corresponding data fields into the tree table model when the curve cache module is updated, so as to keep the chart and table data consistent".

[0139] When the curve cache module completes the differential comparison between the write buffer and the front buffer, it will immediately generate a local redraw instruction. While constructing the instruction, the curve cache module packages the curve sampling sequence involved in this redraw and the corresponding main axis coordinate start and end values as an update event. The update event contains the fields {cachePtr, θStart, θEnd, segmentID, version}, where cachePtr points to the starting address of the latest curve sampling sequence, θStart and θEnd represent the affected main axis coordinate section, segmentID identifies the curve segment, and version is used for version consistency check. The curve cache module pushes the update event into the message queue through the lock-free ring buffer and sends the signal sigTableUpdateReady(version).

[0140] The data synchronization module resides in the interface main thread and receives sigTableUpdateReady(version) using the signal-slot mechanism. In order to avoid conflicts with user manual editing in the tree table, the module first checks the model write lock state after receiving the signal; if the table is in editing mode, the update event is temporarily stored in the delay queue and processed after the write lock is idle. After obtaining the write lock, the module takes out the corresponding update event in the message queue according to version and reads θStart and θEnd. The row nodes in the tree table model are naturally ordered by the main axis coordinates, and the module uses binary search to locate the target starting row of θStart in the model, and then uses sequential scanning to determine the terminating row, so as to accurately lock the row section that needs to be updated.

[0141] Subsequently, the module traverses the curve sample sequence pointed to by the cachePtr, and writes the principal axis engineering coordinates, the slave axis engineering coordinates, the curve type identifier, and the extreme value mark of each sample point in the column order into the model node. For the extreme value mark, if the value is a position maximum or a velocity maximum, the character P_MAX or V_MAX is written in the "extreme value type" column of the node; if it is a minimum, P_MIN or V_MIN is written; and if there is no extreme value, an empty string is written. The curve type identifier is kept consistent with the curve segment model, such as POLYNOM5 or SPLINE. After the writing is completed, the module calls the batch refresh interface dataChanged(startIndex, endIndex) of the model to send a data change signal at one time. Since the tree table view has subscribed to this signal in advance, the interface will automatically refresh the affected row section in the next frame, and the rows and columns that are not affected remain unchanged, thereby avoiding flickering caused by full redraw.

[0142] To reduce the main thread pause time, the module adopts a batch update strategy of writing one hundred rows at a time: when the number of rows in the affected section exceeds one hundred rows, the module performs writing and refreshing in sections, and yields the event loop immediately after each batch writing. If the curve cache continuously triggers multiple update events in a short time, the module will merge the events in the delay queue, and only keep the θStart and θEnd with the largest principal axis coordinate range, so as to avoid high-speed jitter of the table.

[0143] After the update is completed, the data synchronization module releases the model write lock, and sends a "table has been synchronized" prompt to the status bar. In order to keep the cursor tracking in the interface interaction module consistent with the table row highlighting, the module emits sigSyncFinished(version) at the same time when the write lock is released. After receiving it, the cursor tracking subsystem corrects its internal row and column mapping table, so that when the user clicks the curve in the graphical view, the table always jumps to the correct row node.

[0144] By synchronously packaging update events when the curve cache module is updated and accurately positioning the target row node according to the principal axis coordinates by the data synchronization module, this embodiment realizes millisecond-level data consistency between the curve graph and the tree table. The use of batch refresh and delay merging strategies significantly reduces the write lock occupation time of the interface main thread, ensuring that in the case of high-frequency dragging of reference points or batch importing of point positions, the table view does not jitter or flicker, the cursor linkage is accurate, and the extreme value mark is presented in real time, thereby significantly improving the smoothness and reliability of the electronic cam curve debugging interaction.

[0145] In some embodiments, the position and velocity related multi-dimensional curves are synchronously rendered and displayed in the Qt interface according to the partial redraw instruction, including:

[0146] The partial redraw instruction is received and the principal axis coordinate start value and end value to be updated are parsed to determine the corresponding partial curve data;

[0147] In the custom drawing control, a clipping rectangle is constructed according to the main axis coordinate interval to limit the subsequent rendering range;

[0148] A vector drawing pipeline based on a graphics processing unit is called to redraw the curve data in the clipping rectangle, and the position curve, the velocity curve, the acceleration curve and the jerk curve are synchronously updated under the same main axis coordinate system;

[0149] A coordinate axis synchronization function is called to uniformly correct the scaling ratio and the coordinate origin of the curve graphs corresponding to the position curve, the velocity curve, the acceleration curve and the jerk curve respectively, so that the curve graphs remain in a synchronous display state;

[0150] The rendering result is submitted to a display buffer, and the display is updated through an interface refresh function, and a rendering completion signal is sent to an interface interaction module to maintain the consistency of cursor tracking.

[0151] Specifically, in the embodiment, the linkage rendering module is deployed in the interface main thread and enables an open source graphics library OpenGL rendering pipeline to ensure high frame rate output when multiple curves are linked. After receiving the local redrawing instruction issued by the curve cache module, the module completes the synchronous refresh display of the position curve, the velocity curve, the acceleration curve and the jerk curve according to the following process.

[0152] First, the rendering module first parses the main axis coordinate start value θStart and end value θEnd in the redrawing instruction, and extracts the four-dimensional curve data of the corresponding section in the read cache at a time according to the θ index. Since the read cache adopts continuous memory layout in the order of the main axis coordinates, the module can quickly complete batch reading through the calculation of the first address offset and the memory length, avoiding multiple random accesses.

[0153] Further, the module queries the current scaling ratio scaleX, scaleY and the translation amount transX, transY maintained by the interface interaction module, maps θStart and θEnd to pixel coordinates xStart and xEnd, and then combines the minimum subordinate axis coordinate yMin and the maximum subordinate axis coordinate yMax of the four-dimensional curve in the section, maps yMin and yMax to pixel yMinPx and yMaxPx, thereby constructing a local clipping rectangle clipRect = <xStart, xEnd, yMinPx, yMaxPx>. Then, the OpenGL clipping test interface is called to enable clipping and load clipRect, to ensure that the subsequent drawing commands only act on the local area.

[0154] Further, the rendering module pre-establishes a vertex buffer object for each curve, and stores the horizontal and vertical coordinates of the four-dimensional curve in an index buffer. When redrawing, the module only updates the vertex fragments corresponding to clipRect in the buffer, and the update process is completed by mapping the sub-buffer and writing new vertex data, avoiding uploading the entire curve. The vertex shader is responsible for mapping the principal axis coordinate θ to the screen x-axis position, and mapping the four-dimensional value of the secondary axis to the independent y-axis of the four curve graphs. The fragment shader uses a uniform color gradient scheme, and highlights the extreme value marker point. Finally, the vertex array object is submitted once to draw the command, so that the four curves are locally rendered synchronously in the same principal axis coordinate system.

[0155] Further, to keep the scaling and origin alignment of the four curve graphs, after completing the local drawing, the rendering module calls the coordinate axis synchronization function to set the scaleX and transX of the four curve graphs to the current principal axis scaling state of the interface interaction module, and fine-tune the respective vertical axes scaleY and transY to ensure that the position curve, the velocity curve, the acceleration curve, and the jerk curve remain consistent in response when the cursor moves and the scroll wheel scales.

[0156] Further, after rendering is completed, the module performs frame buffer exchange, submits the rendering result to the display buffer, and triggers the interface refresh function repaint() to immediately present the updated local curve graph on the display. Then a signal sigRenderDone(version) is emitted, which is captured by the interface interaction module to update the cursor tracking logic, ensuring that the position indication of the cursor in the curve graph and the table is always consistent.

[0157] By limiting the drawing range with the clipping rectangle, updating the vertex of the sub-buffer, and correcting the uniform coordinate axis, the embodiment realizes the synchronous refresh of the four-dimensional curve while only redrawing the local section of the curve. Actual tests show that, under high-density curves with more than ten thousand sampling points of the principal axis, the average time consumed by local redrawing triggered by a single drag of the reference point is less than two milliseconds, which is significantly better than the sixteen-millisecond benchmark value of full-window redrawing; the interface can stably maintain a refresh rate of sixty frames per second, and the jump delay of the cursor tracking in the graphical view and the table view is less than one frame, thereby greatly improving the interactive fluency and precision visualization experience of electronic cam curve editing.

[0158] In some embodiments, the latest curve sampling sequence in the curve cache module is packaged as electronic cam table data conforming to the configuration format of the target motion control system electronic cam, and output for the motion control system to call to implement electronic cam motion planning, including:

[0159] Reading the curve sampling sequence stored in the curve cache module in the order of the principal axis coordinate;

[0160] When detecting that the period mode identifier is activated, the curve calculation module is called to perform head-tail connection processing on the first and last curve segments, so that the first and last curves maintain first-order derivative continuity at the main shaft position;

[0161] According to the field mapping rule of the target motion control system, the curve sampling sequence is converted into an electronic cam table data frame, the electronic cam table data frame contains a table header field, a sampling point data field and a curve type identifier field, and the main shaft coordinates and the slave shaft coordinates of each sampling point are fixed-point quantization encoded;

[0162] The electronic cam table data frame is subjected to cyclic redundancy check, and a check value is written in the check field;

[0163] The electronic cam table data frame is output to the motion control system through a preset industrial field bus interface or a file export interface.

[0164] Specifically, in the embodiment, the curve export module is integrated in the "engineering management" submenu of the electronic cam editor. When the user clicks the "export electronic cam table" button, the module starts to perform the electronic cam table data packaging and output process. The following takes an example curve of one main shaft per 360 degrees, sampling resolution of one degree and four points as an example to make a detailed description of each step.

[0165] The curve export module first maps the read buffer area of the curve cache module to the address space of the export thread through a read-only pointer mapping method. The curve sampling sequence in the buffer area has been arranged in ascending order of main shaft coordinates θ, and the data structure is {θ, S, V, A, J, CurveID, ExtFlag}. The export thread sequentially traverses the sampling sequence, reads all the sampling point data, and real-time statistics of the first and last main shaft coordinates, the total number of sampling points and the curve type identifier set are used for subsequent table header field filling.

[0166] Further, if it is detected that the "period mode" checkbox has been activated, the export thread immediately calls the "head-tail connection" interface of the curve calculation module. The interface takes the curve coefficients of the first and last segments, calculates the velocity and acceleration at θ=0° and θ=360°, and automatically inserts a transition curve segment, so that the first and last curves are strictly continuous at the first derivative. After the connection result is written back to the buffer area, the export thread re-reads the last several sampling points, and enters the next step after confirming that the error is less than the threshold 1x10^-6.

[0167] In some examples, the target motion control system of the embodiment requires that the electronic cam table data frame adopts a "three-segment" structure: a table header field, a sampling point field and a curve type field. The table header field includes the total number of sampling points, the main shaft resolution, the slave shaft unit, the check reserved bit and other information. The export thread refers to the field mapping document provided by the manufacturer to write the internal data into the corresponding table header field in sequence.

[0168] In the sampling point field, the principal axis coordinate θ needs to be encoded as a sixteen-bit unsigned fixed-point number, with a quantization step of 0.01°; the secondary axis coordinate S needs to be encoded as a thirty-two-bit signed fixed-point number, with a quantization step of 0.001 mm. To this end, the derivation thread converts the floating-point values into integers according to the formula θ_enc = round(θ / 0.01°), S_enc = round(S / 0.001 mm), and writes them in the data frame in little-endian order. The curve type field records the algorithm identifier of the curve segment in the form of an eight-bit enumeration value, such as 0x05 for POLYNOM5 and 0x0A for SPLINE. The derivation thread writes the corresponding curve type enumeration value synchronously when writing the sampling point field, for the controller to switch the kinematic model by segment when parsing.

[0169] After the data frame content is written, the derivation thread calls the CRC16-IBM algorithm to check all bytes (excluding the table header check bit). The algorithm polynomial is 0x8005, and the initial value is 0xFFFF. The sixteen-bit check value obtained by calculation is written into the check field in the table header, thereby ensuring that the motion controller can quickly detect the transmission integrity when receiving.

[0170] The derivation thread performs output operations according to the interface type selected by the user in the "Communication Settings" panel. If the user selects an industrial field bus interface (such as EtherCAT), the module calls the bus stack API to establish a PDO channel between the master and slave stations, and sends the electronic cam table data frame to the specified address in block writing mode; if the user selects the file export interface, the data frame is packaged into a ".cam" text file and stored in the user-specified directory, with a timestamp and version number written in the file header for subsequent version management and tracing.

[0171] Further, after the data output is successful, the derivation thread returns a "successful export" flag and displays the electronic cam table file size, sampling point quantity, and check value in the status bar. If a bus timeout or check failure occurs during the output process, the module will pop up an error dialog box to prompt the user and record the failure reason and data frame summary in the log file for troubleshooting.

[0172] Through the method of the above embodiment, the present embodiment realizes efficient and reliable transmission of the electronic cam curve from the cache to the controller. The start-end connection check ensures the consistency of the curve dynamics in the periodic mode; the fixed-point quantization encoding and field mapping meet the real-time parsing requirements of the controller; the cyclic redundancy check ensures data integrity; and the multi-interface output mechanism improves the universality and adaptation efficiency of the electronic cam table in different brands of control systems, thereby providing a convenient means for subsequent equipment debugging and batch replication.

[0173] The above examples are only used to illustrate the technical solutions of the present application, but not limit the same; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can be modified, or some technical features can be replaced by equivalent ones; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. An electronic cam editor based on Qt interface development, characterized in that, The application relates to a Qt-based electronic cam design system, which comprises the following modules: An interface interaction module for receiving mouse or keyboard events in a Qt graphical interface and converting pixel coordinates into main shaft and slave shaft engineering coordinates in real time; A topology management module for maintaining a reference point set and updating curve segment topology according to a reference point insertion, deletion or movement instruction received by the interface interaction module; A curve calculation module for generating curve segment coefficients and outputting a curve sampling sequence according to a reference point and a curve type identifier output by the topology management module in a preset curve algorithm library; An extreme value analysis module for performing first-order, second-order and third-order derivation on the curve sampling sequence and recording position and speed related extreme value data; A curve cache module for receiving the curve sampling sequence and the extreme value data and writing the data into a curve cache while generating a local redrawing instruction; A linkage rendering module for synchronously rendering multi-dimensional curves related to position and speed in the Qt interface according to the local redrawing instruction and refreshing the display; A curve export module for encapsulating the latest curve sampling sequence in the curve cache module into electronic cam table data conforming to a target motion control system electronic cam configuration format and outputting the data for being called by a motion control system to realize electronic cam motion planning.

2. The Qt interface development based electronic cam editor according to claim 1, characterized in that, The application relates to a Qt-based electronic cam design system, which comprises the following modules: An interface interaction module for receiving mouse or keyboard events in a Qt graphical interface and converting pixel coordinates into main shaft and slave shaft engineering coordinates in real time; A topology management module for maintaining a reference point set and updating curve segment topology according to a reference point insertion, deletion or movement instruction received by the interface interaction module; A curve calculation module for generating curve segment coefficients and outputting a curve sampling sequence according to a reference point and a curve type identifier output by the topology management module in a preset curve algorithm library; An extreme value analysis module for performing first-order, second-order and third-order derivation on the curve sampling sequence and recording position and speed related extreme value data; A curve cache module for receiving the curve sampling sequence and the extreme value data and writing the data into a curve cache while generating a local redrawing instruction; 3. The Qt interface development based electronic cam editor according to claim 1, characterized in that, A linkage rendering module for synchronously rendering multi-dimensional curves related to position and speed in the Qt interface according to the local redrawing instruction and refreshing the display; A curve export module for encapsulating the latest curve sampling sequence in the curve cache module into electronic cam table data conforming to a target motion control system electronic cam configuration format and outputting the data for being called by a motion control system to realize electronic cam motion planning. The application relates to a Qt-based electronic cam design system, which comprises the following modules: An interface interaction module for receiving mouse or keyboard events in a Qt graphical interface and converting pixel coordinates into main shaft and slave shaft engineering coordinates in real time; A topology management module for maintaining a reference point set and updating curve segment topology according to a reference point insertion, deletion or movement instruction received by the interface interaction module; A curve calculation module for generating curve segment coefficients and outputting a curve sampling sequence according to a reference point and a curve type identifier output by the topology management module in a preset curve algorithm library; An extreme value analysis module for performing first-order, second-order and third-order derivation on the curve sampling sequence and recording position and speed related extreme value data; A curve cache module for receiving the curve sampling sequence and the extreme value data and writing the data into a curve cache while generating a local redrawing instruction; A linkage rendering module for synchronously rendering multi-dimensional curves related to position and speed in the Qt interface according to the local redrawing instruction and refreshing the display; A curve export module for encapsulating the latest curve sampling sequence in the curve cache module into electronic cam table data conforming to a target motion control system electronic cam configuration format and outputting the data for being called by a motion control system to realize electronic cam motion planning.

4. The Qt interface development based electronic cam editor according to claim 1, characterized in that, The reference point and the curve type identifier output by the topology management module are used to call corresponding algorithms in a preset curve algorithm library to generate curve segment coefficients and output a curve sampling sequence, including: Obtaining the reference point set returned by the topology management module and the corresponding curve type identifier; Finding a curve solving algorithm matched with the curve type identifier in the curve algorithm library, and reselecting an algorithm whose order meets the continuity requirement when curve segment merging or splitting exists; Constructing a parameter solving matrix according to the reference point set, and obtaining target curve segment coefficients by using numerical inversion or iteration method; Performing discretization processing on the target curve segment coefficients according to a preset sampling resolution, and generating a curve sampling sequence covering the whole main shaft range; Outputting the generated curve sampling sequence to a curve cache module, and synchronously sending a curve update event to an extreme value analysis module.

5. The Qt interface development based electronic cam editor according to claim 1, wherein, The curve sampling sequence is subjected to first-order, second-order and third-order derivation, and position and speed related extreme value data are recorded, including: Obtaining the curve sampling sequence and sequentially calculating first, second and third derivatives by using a difference algorithm to obtain a speed curve, an acceleration curve and a jerk curve respectively; Comparing the derivative sign changes of adjacent sampling points in the curve sampling sequence and the speed curve to determine the maximum and minimum values of the main shaft coordinates; Writing the main shaft coordinates, slave shaft coordinates and extreme value types of the detected extreme values into an extreme value table, and synchronously storing them in the curve cache module for extreme value labeling by a linkage rendering module.

6. The Qt interface development based electronic cam editor according to claim 1, wherein, The curve sampling sequence and the extreme value data are received and written into the curve cache, and a local redrawing instruction is generated, including: Writing the curve sampling sequence into a cache mapping table according to the main shaft coordinate order, and appending the received extreme value data in the corresponding entry; Comparing the cache mapping table before and after writing to determine the starting value and the ending value of the main shaft coordinates that have changed; Calculating the rectangular area parameters of local redrawing according to the starting value and the ending value, and generating a redrawing instruction containing the rectangular area parameters; Sending the redrawing instruction to the linkage rendering module through a signal slot mechanism to trigger local curve redrawing.

7. The Qt interface development based electronic cam editor according to claim 1, wherein, A data synchronization module is further included, configured to write corresponding data fields into the tree table model when the curve cache module is updated, so as to keep the chart and table data consistent.

8. The Qt interface development based electronic cam editor according to claim 7, characterized in that, The data fields are written into the tree table model when the curve cache module is updated, so as to keep the chart and table data consistent, including: Packing the curve sampling sequence and the main shaft coordinate range involved in redrawing into an update event when the curve cache module generates a local redrawing instruction; Analyzing the update event, positioning a target row node in the tree table model according to the main shaft coordinate order, and determining the column fields that need to be updated; Writing the main shaft engineering coordinates, the slave shaft engineering coordinates, the curve type identifier and the extreme value mark in the curve sampling sequence into the column fields corresponding to the target row node in sequence; Calling a model refreshing function to send a data change signal, so that the tree table view and the custom drawing control in the interface interaction module are synchronously refreshed and displayed.

9. The Qt interface development based electronic cam editor according to claim 1, wherein, The position and speed related multi-dimensional curves are synchronously rendered in the Qt interface according to the local redrawing instruction and refreshed and displayed, including: The local redrawing instruction is received and the start and end values of the spindle coordinate to be updated are parsed to determine the corresponding local curve data; A clipping rectangle is constructed in the custom drawing control according to the spindle coordinate interval to limit the subsequent rendering range; A graphics processing unit-based vector drawing pipeline is called to redraw the curve data in the clipping rectangle and synchronously update the position curve, the velocity curve, the acceleration curve and the jerk curve in the same spindle coordinate system; A coordinate axis synchronization function is called to uniformly correct the scaling ratio and the coordinate origin of the curve graphs corresponding to the position curve, the velocity curve, the acceleration curve and the jerk curve respectively, so that the curve graphs remain in a synchronous display state; The rendering result is submitted to a display buffer and updated through an interface refresh function, and a rendering completion signal is sent to an interface interaction module to maintain the consistency of cursor tracking.

10. The Qt interface development based electronic cam editor according to claim 1, characterized in that, The latest curve sampling sequence in the curve cache module is encapsulated into electronic cam table data conforming to the configuration format of the target motion control system electronic cam and output for the motion control system to call to implement electronic cam motion planning, including: Reading the curve sampling sequence stored in the curve cache module in the order of the spindle coordinate; When detecting that the periodic mode identifier is activated, the curve calculation module is called to perform head-tail connection processing on the first and last curve segments to make the first and last curves maintain first-order derivative continuity at the spindle position; According to the field mapping rule of the target motion control system, the curve sampling sequence is converted into an electronic cam table data frame, the electronic cam table data frame includes a table header field, a sampling point data field and a curve type identifier field, and the spindle coordinate and the slave axis coordinate of each sampling point are fixed-point quantization encoded; The electronic cam table data frame is subjected to a cyclic redundancy check and a check value is written in a check field; The electronic cam table data frame is output to the motion control system through a preset industrial field bus interface or a file export interface.