Any-angle rotation switching method, system and equipment for 90-degree side milling head and medium
By setting precise angle values and mode variables in the 90-degree side milling head, combined with a backlash compensation mechanism, high-precision rotation control is achieved, solving the angle deviation problem caused by the backlash of the traditional 90-degree side milling head, and improving the accuracy and efficiency of CNC machining.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-17
AI Technical Summary
Traditional 90-degree side milling heads have backlash during rotation, which causes angular deviation and affects CNC machining accuracy, especially on side milling heads with poor workmanship.
By setting precise angle values and mode variables, and employing the principle of proximity, always rotating in the positive direction, and always rotating in the negative direction, combined with a gap compensation mechanism, the rotation amount is dynamically corrected to achieve high-precision angle control.
It significantly improves rotary positioning accuracy and CNC machining efficiency, adapts to different types of 90-degree side milling heads, and reduces the impact of mechanical backlash.
Smart Images

Figure CN121680482A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of milling head angle control technology, and in particular to a method, system, device and medium for arbitrary angle rotation switching of a 90-degree side milling head. Background Technology
[0002] In the development of electrical control, industries have increasingly demanded high-precision, multi-process integrated machining, such as in aerospace and automotive manufacturing, where traditional machine tools struggle to directly machine parts like housings and mold cavities. The 90-degree side milling head, by forming a 90-degree angle between the tool's rotation center line and the spindle axis, enables multi-directional machining, making it particularly suitable for machining vertical surfaces, inclined surfaces, and deep holes in complex workpieces. Furthermore, the 90-degree side milling head reduces the number of workpiece clamping operations, improving machining efficiency. Simultaneously, its modular interfaces (such as BT and HSK tool holders) ensure compatibility with various machine tools, making it widely used in the machining of complex parts in industries such as mold making, precision instruments, and medical devices, thus becoming an important extension accessory for modern CNC machine tools.
[0003] Current technology employs only a single method of automatic rotation of the 90-degree side milling head based on proximity. This method results in two rotation modes during operation: forward and reverse. The rotation mechanism is driven by a spindle motor, which rotates the spindle. The spindle is connected to the tool holder structure of the 90-degree side milling head, and there is a backlash between the tool holder structure and the 90-degree side milling head body. The size of this backlash varies depending on the precision of the 90-degree side milling head. A 90-degree side milling head with better workmanship has a smaller backlash, and the backlash caused by switching between forward and reverse rotation has minimal impact on the final rotation angle, not affecting CNC machining. Conversely, a 90-degree side milling head with poorer workmanship has a larger or unstable backlash, and the traditional proximity-based rotation method cannot guarantee that this type of 90-degree side milling head will rotate to the correct position.
[0004] The existing technical solutions mentioned above have the following defects: 1. In the traditional control method, the backlash will be amplified during repeated movements. That is, after the 90-degree side milling head has performed a positive automatic rotation in one step, it will then perform a negative automatic rotation. At this time, the backlash is amplified, which will eventually cause the rotation angle to deviate from the actual command angle, making it impossible to perform normal CNC machining. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the purpose of this application is to provide a method, system, device, and medium for arbitrary angle rotation switching of a 90-degree side milling head. By controlling the 90-degree side milling head to always rotate around one direction during automatic rotation, backlash can be effectively avoided, i.e., it can always rotate in the positive or negative direction during automatic rotation. Furthermore, a 90-degree side milling head with good workmanship can still use the nearest principle for rotation, which can reduce the time for rotation angle and improve CNC machining efficiency.
[0006] This was achieved using the following technical solutions: In a first aspect, this application provides a method for arbitrary angle rotation switching of a 90-degree side milling head, comprising: Set the precise angle value for the rotation angle, assign the corresponding mode variable to each rotation mode, and determine the commanded rotation angle; The precise angle value is a unit division; if the rotation method is based on the nearest rotation principle, the mode variable is 0; if the rotation method is always positive rotation, the mode variable is 1; if the rotation method is always negative rotation, the mode variable is -1; if the commanded rotation angle is null, the current rotation angle is compared with the commanded rotation angle. If the current rotation angle is the same as the commanded rotation angle, the rotation ends; otherwise, the rotation is a multiple of the unit division; if the commanded rotation angle is greater than a positive full angle or less than a negative full angle, an alarm is triggered. The commanded rotation angle is processed according to the multiple of the precise angle value, and combined with the current rotation angle, the mode variable is determined, and the amount to be rotated is calculated; Rotate to the theoretical angle according to the amount to be rotated, and combine with the commanded rotation angle to determine the gap angle and calculate the compensation angle of the current rotation mode; The amount of rotation to be adjusted according to the compensation angle is adjusted until the commanded rotation angle is reached.
[0007] By adopting the above technical solution, by setting a precise angle value for each unit division, and allocating mode variables according to the nearest rotation (mode 0), constant forward rotation (mode 1), and constant reverse rotation (mode -1), the validity of the command angle is first verified (compared to the current angle when there is no value, and an alarm is triggered if there is an over-rotation angle), and then the amount to be rotated is calculated in combination with the current angle; after the rotation is executed, the gap compensation angle is introduced to dynamically correct the amount to be rotated, and iteratively approximates until the command angle is accurately reached; by integrating adaptive control of multiple rotation strategies and real-time gap compensation mechanism, the positioning accuracy is significantly improved and the impact of mechanical backlash is reduced.
[0008] This application further specifies the following steps for: processing the commanded rotation angle based on a multiple of the precise angle value, and determining the mode variable in conjunction with the current rotation angle; the specific steps for calculating the amount to be rotated include: The commanded rotation angle is multiplied by a factor based on the precise angle value to obtain the commanded rotation amount. If the commanded rotation amount is 0, then the current rotation angle is zeroed out, and a recompensation value is determined. The recompensation value includes a positive recompensation value and a negative recompensation value. Based on the directed difference between the commanded rotation amount and the current rotation angle, the rotation mode is determined and assigned a mode variable; If the directed difference is negative, then the commanded rotation amount is in the negative position of the current rotation angle, and the mode variable is determined to be -1; If the directed difference is positive, then the commanded rotation amount is in the positive direction of the current rotation angle, and the mode variable is determined to be 1; If the directed difference is positive but the value is greater than the flat angle, then the commanded rotation amount is in the positive direction of the current rotation angle, and the mode variable is determined to be -1; The required rotation amount is determined by calculating the commanded rotation amount and the recompensation value based on the mode variables. The mechanical rotation angle value is multiplied by a factor based on the precise angle value to obtain the mechanical rotation amount; if the mechanical rotation amount is a full circle, then the mechanical rotation amount is reset to zero. If the mode variable is 0, that is, the rotation is based on the nearest principle, then the amount to be rotated is the sum of the commanded rotation amount and the recompensation value; If the mode variable is 1, i.e., forward rotation, then when the commanded rotation amount is greater than or equal to the mechanical rotation amount, the rotation amount to be rotated is the sum of the commanded rotation amount and the recompensation value, and then the difference between the sum and the mechanical rotation amount. When the commanded rotation amount is less than the mechanical rotation amount, the amount to be rotated is the difference between the circle angle and the mechanical rotation amount, and then the sum is calculated with the commanded rotation amount and the compensation value. If the mode variable is -1, i.e., negative rotation, then when the commanded rotation amount is greater than or equal to the mechanical rotation amount, the amount to be rotated is the difference between the mechanical rotation amount and the commanded rotation amount, and then the difference between the mechanical rotation amount and the compensation value. When the commanded rotation amount is less than the mechanical rotation amount, the amount to be rotated is the sum of the commanded rotation amount and the recompensation value; then the difference is calculated between the sum and the difference between the sum and the mechanical rotation amount and the circumference.
[0009] By adopting the above technical solution, the command rotation amount is converted into a unit division multiple through precise angle values. When the command rotation amount is zero, a zeroing operation is performed and positive / negative recompensation values are generated. The rotation mode is dynamically set based on the directed difference between the command rotation amount and the current angle (mode = -1 when the directed difference is negative, mode = 1 when it is positive, and intelligently switches to mode = -1 if the positive value is greater than the flat angle to optimize the path). Combining the mode variable, command rotation amount, recompensation value, and mechanical rotation amount (after circumferential angle zeroing), the rotation amount to be rotated is calculated through multi-condition branching (including composite calculations of three scenarios: proximity principle, positive rotation, and negative rotation). Finally, high-precision angle control with integrated path optimization algorithm and dynamic gap compensation is achieved. Through intelligent direction decision and real-time compensation mechanism, the influence of mechanical backlash is significantly reduced, and the rotation positioning accuracy and system response efficiency are improved.
[0010] This application further specifies the following steps for determining the gap angle and calculating the compensation angle for the current rotation mode based on the rotation amount to be rotated to the theoretical angle and the commanded rotation angle: The system moves N times according to a preset distance based on the rotation method, and records the distance without gaps. Then, the system rotates in the opposite direction and records the distance with gaps. The absolute difference between the gapless distance and the gapped distance is calculated to obtain the linear value of the reverse gap. The angle of the backlash linear value is converted according to the C-axis diameter to obtain the backlash angle, and the recompensation value of the current rotation mode is corrected to obtain the corrected compensation value. Rotate the current rotation angle according to the amount to be rotated to obtain the theoretical angle θcd. Combine the commanded rotation angle θt and the correction compensation value θgap to calculate the compensation angle θcs: θcs=(θt-θcd)+Sign×θgap; Sign is the sign function.
[0011] By adopting the above technical solution, the distances with and without gap are recorded through N forward and reverse operations with preset movement distances. The linear value of the backlash is calculated and converted into a gap angle by combining it with the C-axis diameter, and then the compensation value is corrected and recompensated. Finally, based on the difference between the theoretical angle and the command angle and the sign function Sign, the compensation angle is dynamically calculated using the formula θcs=(θt−θcd)+Sign×θgap to ensure accurate rotation positioning. By accurately quantifying the backlash in combination with actual mechanical characteristics, the compensation value is dynamically corrected to adapt to different rotation directions, effectively reducing error accumulation and improving the accuracy of rotation angle detection and control.
[0012] This application further specifies that the specific steps of correcting the rotation amount according to the compensation angle until the commanded rotation angle is reached include: The rotation mode is monitored. If the direction of the rotation mode is reversed, an initial correction command is generated to initiate gap compensation. The actual rotation angle is read based on the sampling frequency, and the target residual value is calculated by combining it with the commanded rotation angle. The absolute value of the target residual value is compared and judged based on a preset positioning error threshold. If the absolute value of the target residual value is greater than the positioning error threshold, the compensation direction is determined according to the error sign of the target residual value, and a preset proportion of the compensation angle is determined as the additional compensation amount. The compensation direction is compared with the current rotation direction. If they are the same, a target correction angle is generated based on the additional compensation amount, the actual rotation angle, and the target residual value. If the two are different, then the absolute incremental mode is activated, and the rotation is performed in the nearest principle, maintaining the same direction of rotation until the target correction angle reaches the commanded rotation angle.
[0013] By adopting the above technical solution, the rotation direction is monitored in real time and gap compensation is triggered. Combined with the dynamic comparison between the target residual and the preset error threshold, the compensation direction is determined according to the error sign and an additional compensation amount is generated. When the compensation direction is consistent with the current rotation direction, the target angle is iteratively corrected. When the directions conflict, the absolute incremental mode is switched to maintain the same direction of rotation until the target is met. Through adaptive error closed-loop control and direction strategy optimization, oscillation overshoot is effectively avoided, and the rotation positioning accuracy and system stability are significantly improved.
[0014] Secondly, this application also provides an arbitrary angle rotation switching system for a 90-degree side milling head, employing the following technical solution: An arbitrary angle rotation switching system for a 90-degree side milling head, comprising: The controller, whose output is connected to the input of the driver, is used to calculate the command rotation angle, the amount to be rotated, the gap angle and the compensation angle, and to determine the mode variables corresponding to each rotation mode. The driver, with its output end connected to the input end of the spindle motor, is used to drive the motor to run according to the amount to be rotated, the gap angle, and the compensation angle, in conjunction with the mode variable. The main spindle motor, with the main spindle connected to the side milling head, is used to drive the side milling head to rotate to the commanded rotation angle.
[0015] By adopting the above technical solution, the controller calculates the command rotation angle, the amount to be rotated, and the backlash compensation parameters. Combined with the mode variable drive of the spindle motor, the driver dynamically adjusts the rotation amount according to the compensation angle to achieve precise positioning of the side milling head. Through the synergy of closed-loop control and dynamic backlash compensation, and the adaptive multi-mode rotation strategy, mechanical backlash and error accumulation are effectively eliminated, significantly improving the rotation positioning accuracy and system response stability.
[0016] Thirdly, this application also provides an electronic device, comprising: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above scheme.
[0017] Fourthly, this application also provides a storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the arbitrary angle rotation switching method for a 90-degree side milling head as described above.
[0018] In summary, the beneficial technical effects of this application include at least the following: (1) This application enables the 90-degree side milling head to switch arbitrarily between three modes: rotation based on proximity, rotation in the positive direction, and rotation in the negative direction. This adapts to different types of 90-degree side milling heads, improves the utilization rate of low-quality side milling heads, reduces CNC machining costs, and solves the problem of the side milling head occasionally rotating to the wrong position. (2) This application has the function of switching between arbitrary rotation methods to adapt to different types of 90-degree side milling heads, increasing the selection of side milling head types for CNC machine tools and making the selection more diversified. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the arbitrary angle rotation switching method of this application; Figure 2 This is a schematic diagram of the forward rotation process of this application; Figure 3 This is a flowchart illustrating the reverse rotation of this application; Figure 4 This is a physical schematic diagram of the arbitrary angle rotation switching system of this application. Detailed Implementation
[0020] The present application will be further described in detail below with reference to the accompanying drawings.
[0021] Reference Figure 1 This application discloses a method for arbitrary angle rotation switching of a 90-degree side milling head, comprising: S1: Set the precise angle value for the rotation angle, assign the corresponding mode variable to each rotation mode, and determine the commanded rotation angle; S2: Process the commanded rotation angle according to the multiple of the precise angle value, and combine it with the current rotation angle to determine the mode variable and calculate the amount to be rotated; S3: Rotate to the theoretical angle according to the amount to be rotated, and combine with the commanded rotation angle to determine the gap angle and calculate the compensation angle of the current rotation mode; S4: Adjust the amount to be rotated according to the compensation angle until the commanded rotation angle is reached.
[0022] The precise angle value is a unit division. In this embodiment, the unit division is set to 1°, which can be adjusted to 0.5° or 0.1° according to the processing accuracy requirements. If the rotation method is to rotate according to the nearest principle, the mode variable is 0. If the rotation method is to always rotate in the positive direction, the mode variable is 1. If the rotation method is to always rotate in the negative direction, the mode variable is -1.
[0023] If the commanded rotation angle is empty, that is, the original commanded rotation angle input by the user or CNC program is 0, then the current rotation angle is compared with the commanded rotation angle. The current rotation angle is obtained by mechanical coordinate conversion. The mechanical coordinate is the default C-axis mechanical coordinate value in the CNC system. It is the absolute mechanical position coordinate of the C-axis (directly associated with the 90-degree side milling head) fed back in real time by the encoder, and the unit is degrees (°). If the current rotation angle is the same as the commanded rotation angle, the rotation ends; otherwise, the rotation is a multiple of the unit division. If the commanded rotation angle is greater than a positive circumference (360°) or less than a negative circumference (-360°), the CNC system alarm is triggered, and the rotation operation is paused.
[0024] The implementation principle of this embodiment is as follows: by setting a precise angle value for the unit division, and combining the rotation mode variable (nearest 0 / positive 1 / negative -1) to determine the rotation direction, when processing null value commands, the minimum division integer multiple rotation is executed, and an alarm is triggered if the limit is exceeded; the command angle is converted based on the precise angle multiple, the amount to be rotated is calculated by comparing with the current angle, and after rotating to the theoretical angle, a compensation value is dynamically generated by combining with the gap angle. The amount to be rotated is iteratively corrected until the target angle is accurately reached, thereby realizing high-precision closed-loop control and adaptive compensation of mechanical gap.
[0025] Step S2 includes: processing the commanded rotation angle according to the multiple of the precise angle value, and combining it with the current rotation angle to determine the mode variable and calculate the amount to be rotated.
[0026] The commanded rotation angle is multiplied by a factor based on the precise angle value to obtain the commanded rotation amount. Command rotation amount = ROUND [command rotation angle / precise angle value] × precise angle value, where ROUND is a rounding function to ensure that the command rotation amount is an integer multiple of the unit division.
[0027] In one specific implementation, assuming the user inputs an original rotation angle of 90.7° and a minimum division of 1°, then 90.7° / 1° = 90.7, meaning the original angle is equivalent to 90.7 minimum division units; ROUND[90.7] = 91, after rounding, the original angle 90.7° corresponds to 91 minimum division units; if the ROUND result is 91 and the minimum division is 1°, then the command rotation amount = 91 × 1 = 91°; If the minimum division is 0.5, then 90.7° / 0.5 = 181.4, ROUND[181.4] = 181, and the command rotation amount is 181 × 0.5 = 90.5°.
[0028] If the commanded rotation amount is 0, then the current rotation angle is zeroed, that is, the C-axis is controlled to return to the mechanical zero point, and a recompensation value is determined. The recompensation value includes a positive recompensation value and a negative recompensation value. The initial value of the recompensation value is set to 0, and it can be finely adjusted according to the actual machining error. For example, it is set to 0.2 when the deviation is 0.2°. Based on the directed difference between the commanded rotation amount and the current rotation angle, the rotation mode is determined and assigned a mode variable; If the directed difference is negative, then the commanded rotation amount is in the negative position of the current rotation angle, and the mode variable is determined to be -1; If the directed difference is positive, then the commanded rotation amount is in the positive direction of the current rotation angle, and the mode variable is determined to be 1; If the directed difference is positive but the value is greater than the flat angle, then the commanded rotation amount is in the positive direction of the current rotation angle, and the mode variable is determined to be -1; The required rotation amount is determined by calculating the commanded rotation amount and the recompensation value based on the mode variables. The mechanical rotation angle value is multiplied by the precise angle value to obtain the mechanical rotation amount, that is, mechanical rotation amount = ROUND[C-axis mechanical coordinate value / precise angle value] × precise angle value; if the mechanical rotation amount is a full circle (360°), then the mechanical rotation amount is zeroed out.
[0029] If the mode variable is 0, that is, the rotation is based on the nearest principle, then the amount to be rotated is the sum of the commanded rotation amount and the recompensation value. The recompensation value is selected as positive or negative based on the actual deviation direction. Reference Figure 2 If the mode variable is 1, i.e., forward rotation, then when the commanded rotation amount is greater than or equal to the mechanical rotation amount, the amount to be rotated is the sum of the commanded rotation amount and the recompensation value, and then the difference between the sum and the mechanical rotation amount, i.e., the amount to be rotated = (commanded rotation amount + forward recompensation value) - mechanical rotation amount.
[0030] When the commanded rotation amount is less than the mechanical rotation amount, the amount to be rotated is calculated by subtracting the mechanical rotation amount from the circumference, and then summing it with the commanded rotation amount and the recompensation value; the amount to be rotated = 360° - (mechanical rotation amount - commanded rotation amount - positive recompensation value).
[0031] Reference Figure 3If the mode variable is -1, i.e. negative rotation, then when the commanded rotation amount is greater than or equal to the mechanical rotation amount, the amount to be rotated is the difference between the mechanical rotation amount and the commanded rotation amount, and then the difference between the mechanical rotation amount and the recompensation value; that is, the amount to be rotated = (mechanical rotation amount - commanded rotation amount) - negative recompensation value.
[0032] When the commanded rotation amount is less than the mechanical rotation amount, the amount to be rotated is the sum of the commanded rotation amount and the recompensation value; then the difference is calculated between the sum and the difference ...
[0033] Step S3 includes: S31. According to the rotation method (including positive / negative direction), control the C-axis to move N times according to the preset moving distance. In this embodiment, the preset moving distance is 5°, which can be adjusted to 3°~10° according to the side milling head specifications. N=5 times, and the number of times must be ≥3 times to ensure measurement stability.
[0034] S32. Record the distance without gaps, and rotate the movement distance in the opposite direction to record the distance with gaps.
[0035] In one specific implementation, the first movement involves controlling the C-axis to move 5° forward from the current position, and recording the mechanical coordinate values after the movement as the backlash-free distance (there is no backlash effect during forward movement). Second movement: Control the C-axis to move 5° in the opposite direction from the above position, and record the mechanical coordinate values after the movement as the clearance distance (the backlash will be visible during the reverse movement). Repeat the above operation 5 times, and take the average value of 5 groups of distances without gaps and distances with gaps.
[0036] S33. Perform an absolute difference calculation on the average value of the gapless distance and the average value of the gapped distance to obtain the linear value of the reverse gap (unit: °). The clearance angle is obtained by performing an angle conversion on the linear value of the reverse clearance based on the C-axis diameter. Since the C-axis rotation is a circular motion, the linear value of the backlash is the same as the backlash angle (no additional conversion is needed; if the side milling head is driven by gears, the formula is: backlash angle = linear value of backlash × transmission ratio. In this embodiment, the transmission ratio = 1, so the backlash angle = linear value of backlash).
[0037] S34. Correct the recompensation value of the current rotation mode according to the gap angle (e.g., if the gap angle is 0.15°, then adjust the positive recompensation value to 0.15°) to obtain the corrected compensation value θgap; The control side milling head rotates and moves the current rotation angle to the theoretical angle θcd according to the amount to be rotated. The theoretical angle θcd = current rotation angle + amount to be rotated. Combined with the commanded rotation angle θt and the correction compensation value θgap, the compensation angle θcs is calculated: θcs = (θt - θcd) + Sign × θgap; where Sign is a sign function (Sign = 1 for positive rotation and Sign = -1 for negative rotation).
[0038] Step S4 includes: S41. Monitor the rotation mode in real time. If the current rotation direction is opposite to the previous rotation direction (e.g., if the previous rotation was positive, the current rotation should be negative), generate an initial correction instruction and call the correction compensation value θgap to start gap compensation.
[0039] S42. Read the actual rotation angle according to the preset sampling frequency, and calculate the target residual value in combination with the command rotation angle. The target residual value = θt - actual rotation angle.
[0040] S43. The absolute value of the target residual value is compared and judged according to the preset positioning error threshold. In this embodiment, the positioning error threshold is set to 0.05°, and it can be set to 0.01° for high-precision processing. S431. If the absolute value of the target residual value is greater than the positioning error threshold, the compensation direction is determined according to the error sign of the target residual value. If the residual value is positive, positive compensation is performed; if it is negative, negative compensation is performed. A preset proportion of compensation angle is determined as the additional compensation amount. The preset proportion is 100%, that is, the additional compensation amount = the absolute value of the residual value, to ensure that the correction is completed in one go.
[0041] S432. If the absolute value of the target residual is not greater than the positioning error threshold, no additional compensation is required, and the side milling head has met the positioning accuracy requirements.
[0042] S44. Compare the compensation direction with the current rotation direction. If they are the same, generate a target correction angle based on the additional compensation amount and the actual rotation angle. The target correction angle = actual rotation angle + additional compensation amount. Control the side milling head to rotate to the target correction angle.
[0043] If the two are different, the absolute incremental mode is activated, and the rotation is performed in combination with the nearest principle, maintaining the same direction of rotation until the target correction angle reaches the commanded rotation angle, thus completing the precise positioning.
[0044] In this embodiment, the absolute incremental mode is a combination of absolute mode (G0G90G53) and incremental mode (G91) control. G0G90G53 is a combination command for quickly positioning to the absolute position of the machine tool coordinate system. When the three are combined, the command logic is as follows: with the machine tool coordinate system as the reference (G53), the absolute coordinate mode (G90) is used to control the C-axis to rotate to the absolute angle position (command rotation angle) in the command at the fastest speed (G0).
[0045] G91 is the "modal command" corresponding to G90. Its function is to switch the coordinate system to "incremental mode". That is, all coordinate values are no longer based on the machine tool origin, but on the "current position after the last movement". The value in the command represents the "incremental movement relative to the current position" (positive for positive and negative for negative).
[0046] The absolute incremental mode of this application is based on the principle that in correction scenarios with opposite directions, the absolute position close to the target is first quickly located using G0G90G53, and then small-range incremental correction is performed using G91, balancing speed and accuracy.
[0047] It should be noted that G53 (machine coordinate system) only supports G90 (absolute mode) and does not support G91 (incremental mode). Therefore, the combination does not mean that G53 and G91 are used in the same program. Instead, it is a step-by-step control logic that first executes G0G90G53 to complete the coarse positioning, and then switches to G91 to complete the fine correction.
[0048] The system activates a combination of "absolute mode + incremental mode" control and rotates according to the nearest principle, maintaining a consistent rotation direction until the target correction angle matches the commanded rotation angle θt, thus completing precise positioning.
[0049] The implementation principle of this embodiment is as follows: by converting the commanded rotation angle into a commanded rotation amount, and combining the current angle to determine the mode variable (-1, 0, or 1) to clarify the rotation direction (nearest / forward / reverse), the amount to be rotated is calculated; at the same time, based on the preset movement measurement mechanical backlash and converted into an angle compensation value, pre-compensation is achieved in the final rotation movement by combining the theoretical angle, the commanded angle, and the signed correction compensation value (θcs=(θt-θcd)+Sign×θgap); then, the change in rotation direction is monitored in real time to trigger backlash compensation, and by sampling the residual between the actual angle and the commanded angle, the deviation from the error threshold is dynamically judged, and an additional compensation amount is generated based on the consistency of the error sign and the rotation direction (direct compensation when in the same direction, and the absolute incremental mode for nearest rotation when in the opposite direction), forming a closed-loop control of "direction judgment-backlash pre-compensation-dynamic residual correction" to ensure rotation positioning accuracy.
[0050] Reference Figure 4This application discloses an arbitrary angle rotation switching system for a 90-degree side milling head, applied to the aforementioned arbitrary angle rotation switching method, comprising: The controller adopts a FANUC CNC system controller (such as FANUC 0i-MF). The output terminal is connected to the input terminal of the driver via an RS485 bus. The controller is used to execute macro programs, calculate the instruction rotation angle θt, the amount to be rotated, the gap angle and the compensation angle θcs, determine the mode variables corresponding to each rotation mode based on the accuracy of the 90-degree side milling head, and send rotation control commands to the driver.
[0051] The driver, which is a servo driver (such as the FANUC αi series), has its output end connected to the input end of the spindle motor via a power line. It is used to convert the control signal into a motor drive signal based on the rotation amount, the gap angle, and the compensation angle sent by the controller, combined with the mode variable, so as to drive the spindle motor to rotate in a preset direction and angle.
[0052] The spindle motor is a servo spindle motor (rated speed 3000 rpm). The spindle is connected to the tool holder structure of the 90-degree side milling head through a coupling. The spindle motor receives the drive signal from the driver and drives the 90-degree side milling head to rotate to the commanded rotation angle. At the same time, the actual rotation angle is fed back to the controller through the encoder to form a position closed-loop control.
[0053] The implementation principle of this embodiment is as follows: the controller calculates the command rotation angle, the amount to be rotated, and dynamic compensation parameters (including backlash correction) based on the unit division, and determines the rotation strategy by combining the mode variables (0 / 1 / -1). The driver drives the spindle motor to run according to the amount to be rotated and the compensation amount, and finally drives the side milling head to accurately position to the command angle through the spindle. Through closed-loop control and multi-mode compensation coordination, it adapts to the requirements of different rotation directions, effectively eliminates mechanical backlash errors, and significantly improves positioning accuracy and system stability.
[0054] Example 1: When controlling a 90-degree side milling head (such as the angle head in a five-axis CNC machine tool) for rotary machining, if a 90-degree side milling head with poor workmanship accuracy (backlash of about 0.3°) is used, it is necessary to control the side milling head to rotate from the current angle of 60° to the commanded angle of 150°. The precise angle value (such as the 150 degrees required by the user command) is mapped to the commanded rotation amount through a multiplier conversion algorithm. If the commanded rotation amount is 0, a zeroing operation is triggered and a positive or negative recompensation value is determined based on the mechanical characteristics. Subsequently, the rotation direction mode variable is determined by calculating the directional difference (such as the difference between the current rotation angle and the commanded rotation amount), and the amount to be rotated is obtained by combining the commanded rotation amount with the recompensation value.
[0055] Set the unit division to 1°, and the mode variable to 1 (always rotate in the forward direction); the command rotation angle is 150°, with no empty values and within the range of -360° to 360°, so no alarm is needed.
[0056] Command rotation amount = ROUND[150 / 1] × 1 = 150°; Mechanical rotation amount = ROUND[60 / 1] × 1 = 60° (current angle 60°, mechanical coordinate = 60°); The commanded rotation amount is not equal to 0, so there is no need to reset it to zero; the positive recompensation value is 0 (initial value). The commanded rotation amount is greater than or equal to the mechanical rotation amount. The amount to be rotated is (150+0)-60=90°.
[0057] Before the actual rotation, the distance without gap and the distance with gap after the reverse rotation are recorded by moving N times. The absolute difference is calculated to obtain the linear value of the reverse gap. The gap angle is then converted according to the C-axis diameter and corrected and compensated to generate a more accurate compensation angle θcs (θcs=(θt-θcd)+Sign×θgap, where θt is the target command angle, θcd is the theoretical rotation angle, and Sign is the sign function). The C-axis was moved 5° forward (preset distance) 5 times, with an average distance of 65° without gap; it was moved 5° backward 5 times, with an average distance of 59.7° with gap. The backlash linear value = (65°-5°)-59.7°=60°-59.7°=0.3°, which is the average idle travel angle caused by mechanical backlash when the C-axis rotates; If the 90-degree side milling head is directly driven by the C-axis (without an additional gear reduction mechanism, transmission ratio = 1), the linear value of the backlash is equal to the value of the backlash angle, that is, the backlash angle θgap = linear value of the backlash = 0.3°; The theoretical position of the side milling head after rotating by the amount to be rotated is θcd = current rotation angle + amount to be rotated. For example, if the current angle is 60° and the amount to be rotated is 90°, then θcd = 60° + 90° = 150°. When rotating in the forward direction, Sign=1; θcs = (150° - 150°) + 1 × 0.3° = 0.3°. This compensation angle will be used in the subsequent rotation process to offset the positioning deviation caused by the backlash. During rotation, the system monitors whether the rotation direction is opposite to the target direction. If it is, gap compensation is initiated (in this embodiment, the rotation direction is always positive, so there is no need to trigger initial gap compensation). Simultaneously, the actual rotation angle is read at a preset sampling frequency, and the residual value between it and the command angle is calculated. If the absolute value of the residual exceeds the positioning error threshold, the compensation direction is determined according to the error sign, and an additional compensation amount is generated in combination with a preset ratio. In this embodiment, the sampling frequency is 10Hz, the actual rotation angle is read, and the residual value gradually decreases. When the actual angle is 149.8°, the residual value = 150 - 149.8 = 0.2° > 0.05°, the compensation direction is positive, and the additional compensation amount = 0.2°.
[0058] If the compensation direction is the same as the current rotation direction, then the additional compensation amount is added to the target correction angle; In this embodiment, the compensation direction is the same as the current rotation direction, the target correction angle is 149.8 + 0.2 = 150°, the control side milling head is rotated to 150° to complete the positioning, and the positioning deviation is ≤0.05°.
[0059] If the directions are different, switch to absolute incremental mode and rotate according to the nearest principle to keep the directions consistent until the correction angle matches the command angle, thereby solving the positioning deviation problem caused by mechanical backlash in the 90-degree installation direction of the side milling head and improving machining accuracy and stability.
[0060] This application discloses an electronic device, comprising: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above scheme.
[0061] This application discloses a storage medium storing at least one instruction, at least one program, code set, or instruction set. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the arbitrary angle rotation switching method for a 90-degree side milling head as described above.
[0062] The embodiments described in this specific implementation are preferred embodiments of this application and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. An arbitrary angle rotary switching method for a 90 degree side mill head, characterized by, The application relates to a method for rotating a mechanical device, which comprises the following steps: setting an accurate angle value of a rotating angle, assigning a mode variable corresponding to each rotating mode, and judging a command rotating angle; processing the command rotating angle according to the accurate angle value, determining the mode variable in combination with a current rotating angle, and calculating a rotating amount; rotating to a theoretical angle according to the rotating amount, determining a gap angle in combination with the command rotating angle, and calculating a compensation angle of a current rotating mode; and correcting the rotating amount according to the compensation angle until the command rotating angle is reached. The accurate angle value is a unit degree; if the rotating mode is a nearest principle rotating mode, the mode variable is 0; if the rotating mode is always a positive rotating mode, the mode variable is 1; if the rotating mode is always a negative rotating mode, the mode variable is -1; if the command rotating angle is a null value, the current rotating angle and the command rotating angle are judged; if the current rotating angle is the same as the command rotating angle, the rotating is ended; otherwise, an integral multiple of the unit degree is rotated; if the command rotating angle is greater than a positive circle angle or smaller than a negative circle angle, an alarm is triggered. The specific steps of processing the command rotating angle according to the accurate angle value, determining the mode variable in combination with the current rotating angle, and calculating the rotating amount comprise the following steps: performing multiple conversion on the command rotating angle according to the accurate angle value to obtain a command rotating amount; if the command rotating amount is 0, performing a zero operation on the current rotating angle and determining a re-compensation value, wherein the re-compensation value comprises a positive re-compensation value and a negative re-compensation value; determining the rotating mode according to a directed difference value between the command rotating amount and the current rotating angle and assigning the mode variable; if the directed difference value is negative, the command rotating amount is in a negative position of the current rotating angle, and the mode variable is determined as -1; if the directed difference value is positive, the command rotating amount is in a positive position of the current rotating angle, and the mode variable is determined as 1; if the directed difference value is positive but the value is greater than a flat angle, the command rotating amount is in a positive position of the current rotating angle, and the mode variable is determined as -1; and performing operation on the command rotating amount and the re-compensation value according to the mode variable to determine the rotating amount. The specific steps of processing the command rotating angle according to the accurate angle value, determining the mode variable in combination with the current rotating angle, and calculating the rotating amount comprise the following steps: performing multiple conversion on the command rotating angle according to the accurate angle value to obtain a command rotating amount; if the command rotating amount is 0, performing a zero operation on the current rotating angle and determining a re-compensation value, wherein the re-compensation value comprises a positive re-compensation value and a negative re-compensation value; determining the rotating mode according to a directed difference value between the command rotating amount and the current rotating angle and assigning the mode variable; if the directed difference value is negative, the command rotating amount is in a negative position of the current rotating angle, and the mode variable is determined as -1; if the directed difference value is positive, the command rotating amount is in a positive position of the current rotating angle, and the mode variable is determined as 1; if the directed difference value is positive but the value is greater than a flat angle, the command rotating amount is in a positive position of the current rotating angle, and the mode variable is determined as -1; and performing operation on the command rotating amount and the re-compensation value according to the mode variable to determine the rotating amount. The specific steps of processing the command rotating angle according to the accurate angle value, determining the mode variable in combination with the current rotating angle, and calculating the rotating amount comprise the following steps: performing multiple conversion on the command rotating angle according to the accurate angle value to obtain a command rotating amount; if the command rotating amount is 0, performing a zero operation on the current rotating angle and determining a re-compensation value, wherein the re-compensation value comprises a positive re-compensation value and a negative re-compensation value; determining the rotating mode according to a directed difference value between the command rotating amount and the current rotating angle and assigning the mode variable; if the directed difference value is negative, the command rotating amount is in a negative position of the current rotating angle, and the mode variable is determined as -1; if the directed difference value is positive, the command rotating amount is in a positive position of the current rotating angle, and the mode variable is determined as 1; if the directed difference value is positive but the value is greater than a flat angle, the command rotating amount is in a positive position of the current rotating angle, and the mode variable is determined as -1; and performing operation on the command rotating amount and the re-compensation value according to the mode variable to determine the rotating amount.
2. The arbitrary angle rotary switching method for a 90 degree side mill head according to claim 1, characterized by, 3. The arbitrary angle rotary switching method for a 90 degree side mill head according to claim 1, characterized by, 4. The arbitrary angle rotary switching method for a 90 degree side mill head according to claim 3, wherein If the mode variable is -1, i.e. negative rotation, when the instruction rotation amount is greater than or equal to the mechanical rotation amount, the to-be-rotated amount is the difference between the mechanical rotation amount and the instruction rotation amount, and then the difference between the to-be-rotated amount and the re-compensation value is calculated; When the instruction rotation amount is less than the mechanical rotation amount, the to-be-rotated amount is the sum of the instruction rotation amount and the re-compensation value, and then the difference between the to-be-rotated amount and the mechanical rotation amount and the angle of a circle are calculated.
5. The arbitrary angle rotary switching method for a 90 degree side mill head according to claim 1, wherein The specific steps of determining the gap angle according to the to-be-rotated amount and rotating to a theoretical angle, and combining the instruction rotation angle to determine the compensation angle of the current rotation mode include: According to the rotation mode, N times of movement are performed according to a preset movement distance, the gap-free distance is recorded, and the movement distance is reversed to record the gap distance; The absolute difference between the gap-free distance and the gap distance is calculated to obtain the reverse gap linear value; According to the diameter of the C shaft, the reverse gap linear value is converted into an angle to obtain the gap angle, and the re-compensation value of the current rotation mode is modified to obtain a modified compensation value; According to the to-be-rotated amount, the current rotation angle is rotated to obtain a theoretical angle θcd, and the compensation angle θcs is calculated by combining the instruction rotation angle θt and the modified compensation value θgap: θcs=(θt-θcd)+Sign×θgap; Sign is a sign function.
6. The arbitrary angle rotary switching method for a 90 degree side mill head according to claim 1, wherein The specific steps of modifying the to-be-rotated amount according to the compensation angle until the instruction rotation angle is reached include: The rotation mode is monitored, and if the directions of the rotation modes are opposite, an initial modification instruction is generated to start the gap compensation; According to the sampling frequency, the actual rotation angle is read, and the target residual value is calculated by combining the instruction rotation angle; According to a preset positioning error threshold, the absolute value of the target residual value is compared and judged; If the absolute value of the target residual value is greater than the positioning error threshold, the compensation direction is determined according to the error sign of the target residual value, and the compensation angle of a preset proportion is determined as an additional compensation amount; The compensation direction and the current rotation direction are compared, if they are the same, the target modification angle is generated according to the additional compensation amount, the actual rotation angle and the target residual value; If they are different, the absolute increment mode is started to rotate according to the nearest principle to maintain the same direction of rotation until the target modification angle reaches the instruction rotation angle.
7. An arbitrary angle rotary switching system for a 90 degree side mill head for use in the method of any one of claims 1 to 6, characterized in that, It includes: A controller, the output end of which is connected with the input end of a driver, for calculating an instruction rotation angle, a to-be-rotated amount, a gap angle and a compensation angle, and determining a mode variable corresponding to each rotation mode; The driver, the output end of which is connected with the input end of a main shaft motor, for driving the motor to operate according to the to-be-rotated amount, the gap angle and the compensation angle in combination with the mode variable; The main shaft motor, the main shaft of which is connected with a side milling head, for driving the side milling head to rotate to the instruction rotation angle.
8. An electronic device, comprising: It includes: One or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in any one of claims 1-6.
9. A storage medium having stored therein at least one instruction, at least one program, a set or collection of codes, or a set or collection of instructions, which are loaded and executed by a processor to implement the arbitrary angle rotation switching method for a 90-degree side milling head as claimed in any one of claims 1 to 6.