A method and apparatus for servoing the position of a welding torch with seamless switching between position and torque modes
Patent Information
- Application Number
- CN202611387149.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-08
- Publication Date
- 2026-10-13
AI Technical Summary
[0010]本发明针对现有伺服焊钳模式切换转矩冲击大、电极易回弹、切换可靠性不足的问题,提供一种可实现双向平稳过渡的伺服焊钳位置与转矩模式无扰切换控制方法及装置
一、切换瞬态冲击得到根本性抑制,真正实现位置模式向转矩模式的无扰交接,本发明通过跟随预写机制使目标转矩通道在切换请求前即持续承载有效转矩值,配合确认拍同周期交接一次性冻结交接转矩与位置保持值,结合过渡期冻结机制锁存位置指令以维持接触保持力,从指令连续、力不泄放两个维度同时解决了模式切换的固有阶跃问题。相较于传统直接切换方案,切换窗口内转矩摆幅大幅收窄,电极位置扰动降至微米级,彻底避免了“卸力回弹—二次冲击”的典型瞬态缺陷,切换过程无明显机械振动。
Smart Images

Figure CN122902189A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of resistance spot welding control technology for industrial robots, and in particular to a method and device for seamless switching control of servo welding clamp position and torque mode. Background Technology
[0002] Resistance spot welding is a widely used joining process in industrial automation scenarios such as automobile manufacturing and hardware processing. As the core execution component of a robotic spot welding system, the servo welding gun typically uses a servo motor to drive a movable electrode through a transmission mechanism to perform opening and closing movements. By precisely controlling the electrode's position and applied pressure, high-quality, highly consistent resistance spot welding operations are achieved. In a complete spot welding pressurization process, the system inevitably goes through two working stages: the first is the idle travel and contact search stage where the electrode approaches the workpiece. During this stage, the workpiece has not yet made contact with the electrode, and there is no contact reaction force. A position control mode must be used to plan the entire motion trajectory to ensure that the electrode smoothly approaches the workpiece at a set speed and accurately performs contact detection and safety limits. The second stage is the pressurization and welding stage after the electrode contacts the workpiece. The core of this stage is the precise control of the electrode pressure, and it must adapt to the condition of the workpiece softening and collapsing under power. A torque control mode must be used to directly output pressure commands, achieving precise closed-loop control of multiple pressure stages. Therefore, the bidirectional switching between position control mode and torque control mode is an unavoidable control link in the servo welding gun system. The smoothness of the switching transient directly determines the weld quality, electrode lifespan, and equipment operational reliability.
[0003] Currently, mainstream bus servo systems, such as the CiA402 protocol servo drive based on the EtherCAT bus, typically achieve control mode switching through mode request objects and mode feedback objects. In position mode, motion commands are issued through the target position object, and in torque mode, force value commands are issued through the target torque object. The controller interacts with the drive for process data at a fixed real-time cycle. However, there are three inherent technical challenges in the instantaneous switching between these two types of modes: First, switching between command channels can easily cause a step jump in output torque. In position mode, the output torque is a control byproduct of the position loop, and the torque command channel does not participate in closed-loop control; in torque mode, the torque command channel is a direct control quantity. At the moment of mode takeover, if the initial value of the torque channel is not equal to the current actual output torque of the position loop, the motor output torque will experience a step jump, causing mechanical shock.
[0004] Second, there is an inherent lag window in the mode feedback. After the controller issues a mode switching request, the drive needs to go through a mode handover process, and the update of the mode feedback signal lags behind the request by several beats. Within this window, the internal control state of the drive has changed, but the feedback quantities such as torque and position read by the controller are no longer steady-state effective values and cannot be used as a reliable control basis.
[0005] Third, the release of contact holding force can easily lead to rebound impact. When the electrode presses against the workpiece in position mode, the position following error carries the contact holding force; if the switching sequence is improper, the position command will be updated synchronously with the feedback and will instantly clear the following error, resulting in the release of contact force. The elastic deformation of the workpiece and the clamp can push the electrode back. After the torque mode takes effect, pressure is reapplied, forming a transient process of "force release - rebound - secondary impact", which seriously affects the consistency of welding.
[0006] There are two typical technical approaches in the existing technology to address the above problems. One is the indirect pressurization scheme that avoids torque mode: maintaining position control mode throughout the process, setting the position command to an excess depth beyond the workpiece surface, so that the position loop continuously operates under the torque limit of the driver, and the electrode pressure is indirectly defined by the torque limit value. This scheme has inherent defects: First, the constant force output depends on the continuous saturation of the position loop. If the excess depth cannot cover the softening and collapse of the workpiece during welding, the position loop will exit saturation, and the pressure will drop silently. This cannot be directly sensed by the command and can only be detected afterward. Second, to ensure the saturation margin, the position following error needs to be artificially increased, and the following error protection of the driver needs to be relaxed or even turned off, which reduces the system safety. Third, the pressure build-up and pressure change slope are jointly determined by the system stiffness, approximation speed and servo parameters, and cannot be directly set by process parameters. The pressure switching between sections is approximately a step, which is difficult to meet the requirements of fine welding processes.
[0007] Another type of solution directly adopts torque mode but does not specifically handle the switching transient: after the position trajectory is completed, the current torque is read as the initial value, and then a torque mode switching request is issued and the torque command is refreshed. The switching transient impact is large, which accelerates electrode wear and easily causes welding spatter. The applicant's internal comparative test during the research and development process (see Figure 4 , Figure 5 (These are all internal versions of the applicant, not publicly available prior art) further demonstrate that: even with the addition of contact threshold detection and pre-switching torque preset as repairs, because the core issues of switching timing, feedback reliability, and holding force maintenance are not addressed, the delay in contact detection and actual switching still leads to position loop overshoot, and the torque swing within the switching window can exceed the motor's rated torque, with electrode rebound reaching a fraction of a millimeter. Figure 4 Attempts to continuously read the transition torque feedback and refresh the torque command before the mode feedback update are prone to misjudgment and cancellation of the switching request because the transition feedback is a transient response to the driver mode handover rather than a steady-state effective value. This can trigger repeated mode switching and secondary impacts, leading to the failure of the pressurization process. Figure 5 .
[0008] Furthermore, in the exit switching process from torque mode to position mode, existing technologies mostly use fixed delays or torque dead zones as the cut-off criteria, which cannot accurately determine the mechanical state of the electrode. In torque mode, there is only a force value command and no stop command. The torque dropping to the target value does not mean that the electrode has stopped. During the depressurization process, the force balance point continues to move, and the electrode is always in a follow-up state. If the switch back to position mode is forced before the electrode has come to a complete stop, the position loop needs to brake the moving shaft urgently, which will also generate significant torque impact and position disturbance.
[0009] In summary, existing servo welding gun mode switching technology cannot simultaneously achieve bidirectional, disturbance-free control that ensures continuous torque on the entry side, non-dissipation of holding force, monitored switching process, and precise return to the exit side. This makes it difficult to meet the requirements of high-end spot welding processes for stability, high precision, and high reliability. Summary of the Invention
[0010] This invention addresses the problems of large torque impact during mode switching, easy electrode rebound, and insufficient switching reliability in existing servo welding guns by providing a servo welding gun position and torque mode switching control method and device that can achieve bidirectional smooth transition.
[0011] This invention provides the following technical solution: a servo welding gun position and torque mode seamless switching control method, applied to a controller with a fixed control cycle. The controller is communicatively connected to a servo driver that drives the servo welding gun electrode. The servo driver supports switching between position control mode and torque control mode. In position control mode, the controller controls the electrode to perform a contact search motion approaching the workpiece. The method includes: a torque following pre-writing step: starting from the first time the torque feedback exceeds a preset contact threshold, the current effective torque feedback is written into the target torque channel of the servo driver as a following pre-writing value for each control cycle; when the torque feedback falls below the contact threshold, causing the contact hit state to be interrupted, the target torque channel is cleared to zero within the same control cycle; a contact confirmation and handover step: when the torque feedback exceeds the contact threshold for N consecutive control cycles, it is determined as contact confirmation; within the same control cycle when the torque control mode switching request is issued, all of the following handover actions are performed simultaneously: performing system state joint verification, reading the current torque feedback to generate and freeze the handover torque T_ The system latches the last issued position command as the position hold value P_hold, clears the remaining search motion trajectory, and issues a torque control mode switching request to the servo driver. If any verification item fails, all handover actions are not executed, and the position control mode is maintained. Transition freeze step: From the issuance of the torque control mode switching request until the first detection of actual mode feedback as torque control mode, the position command remains at a constant output of P_hold, and the target torque remains at a constant output of T_hold. The target torque command is not refreshed based on torque feedback, and the mode switching request is not canceled based on the numerical fluctuation of torque feedback during the transition period. Mode activation confirmation step: The torque control mode is determined by M consecutive control cycles of actual mode feedback returned by the servo driver. The switching completion is judged as complete. Only after the first detection of actual mode feedback as torque control mode is the position command allowed to be synchronized to the actual feedback position. After continuous confirmation is completed, the pressurization operation phase in torque control mode is entered. Where N and M are preset positive integers.
[0012] In some embodiments, a contact recording torque is pre-stored. The contact recording torque is the measured torque latched at the sampling moment when the contact threshold is first exceeded, serving as the lower limit of the handover torque and the target value for the decompression stage. The handover torque T_hold is the larger of the actual torque at the time of the switching request and the contact recording torque. If T_hold exceeds the preset torque upper limit, is a non-positive value, or is a non-finite valid value, the mode switch is refused, the follow-up pre-written value is cleared, and the position control mode is maintained. The position holding value P_hold is the position command value issued in the last control cycle before the mode switch request is issued. It is used to maintain the position loop following error and prevent the contact holding force before the switch from being released.
[0013] In some embodiments, the issuance of the pre-written value must simultaneously meet the following conditions: normal system operation, no coordinate errors, current actual mode is position control mode, torque feedback is a valid positive value, and the system is in a preset mode handover control flow. If a detection failure, detection release, system shutdown, coordinate error, or non-handover path scenario occurs, the target torque channel is immediately cleared to zero. When the contact detection is released during the handover execution process, only the detection function module is released, and the pre-written value is uniformly cleared to zero by the control path of handover acceptance or rejection. The target torque channel of the servo driver is set with only one control write entry, and all torque commands are issued through this entry. If the motion trajectory queue is occupied by a non-real-time thread during the contact confirmation cycle, the handover action is postponed to the first control cycle after the real-time thread acquires ownership of the queue, and during the postponement, the pre-written value is continuously updated cycle by cycle.
[0014] In some embodiments, if no corresponding mode feedback is received for M consecutive control cycles after a preset timeout period has elapsed after a mode switching request is issued, or if mode loss or illegal parameter abnormality occurs in torque control mode, the position control mode shall be safely switched back in the following order: first, keep the current torque command unchanged, latch the current actual position and then request to switch back to position control mode, and clear the target torque channel only after the actual mode feedback is position control mode and is continuously confirmed.
[0015] In some embodiments, the torque commands during the pressurization and depressurization processes are based on the command values of the previous control cycle, and are recursively approximated to the target value of the current ramp by a preset step size, without directly recalculating the command based on torque feedback; the stabilization threshold is set according to a preset ratio of the electrode contact search speed, and the number of consecutive cycles M for mode stabilization confirmation is the same as the number of consecutive cycles K for stabilization determination.
[0016] In some embodiments, after contact confirmation, a torque control mode switching request is not immediately issued, and a stop-and-wait phase is entered: upon contact confirmation, the position hold value P_hold is latched first and the remaining search motion trajectory is cleared. The position hold command is a constant output of P_hold, which follows the pre-written value and is continuously updated with torque feedback. After the actual speed is lower than the stop-and-wait threshold for K consecutive control cycles, the handover torque T_hold is frozen and a torque mode switching request is issued. The stop-and-wait phase has a maximum waiting time. After the timeout, the handover torque T_hold is still frozen and a torque mode switching request is issued. The timeout is a fallback exit, where K is a preset positive integer.
[0017] In some embodiments, a stop-and-go back-cut step is further included: when exiting the torque control mode, the back-cut trigger condition is that the torque command value is exactly equal to the preset pressure relief target value and the actual electrode speed is lower than the preset stop-and-go threshold and is maintained for K consecutive control cycles; within the same control cycle in which the condition is met, the current actual position is latched as the position command and a mode switching request to exit the torque control mode is issued, and the torque command remains unchanged during the back-cut waiting period; the target torque channel is cleared only after the actual feedback of the position control mode is confirmed for M consecutive control cycles; where K is a preset positive integer.
[0018] In some embodiments, after the back-cut trigger condition is met, the system does not directly request to switch back to the position control mode. Instead, it first switches to the speed control mode where the speed command is always 0 as a transition window. During the transition window, the position command is locked and the torque command remains unchanged. Once the transition window has been counted for a preset duration, a position control mode switching request is issued, and a watchdog timeout is set. If the window count is abnormally exceeded, a position control mode switching request is forcibly issued as a fallback.
[0019] A servo welding gun position and torque mode seamless switching control device is applied in a robot controller. The controller is communicatively connected to a servo driver that drives the servo welding gun. The servo driver supports switching between position control mode and torque control mode. The device is characterized by comprising: a contact detection module, used to determine the contact state based on torque feedback in each control cycle during the contact search phase of the position control mode: when the torque feedback first exceeds a preset contact threshold, it is determined to be in a contact hit state; when the torque feedback exceeds the contact threshold for N consecutive control cycles, it is determined to be a contact confirmation; and a follow-up pre-writing module, used to write the currently effective torque feedback into the servo driver in each control cycle from the first entry into the contact hit state. The target torque channel of the device is used as the pre-written value for following; when the torque feedback falls below the contact threshold, causing the contact hit state to be interrupted, the target torque channel is cleared to zero within the same control cycle; effective torque feedback refers to the positive torque feedback value within the effective range; the synchronous handover module is used to perform joint system status verification within the same control cycle after contact confirmation, read the current torque feedback to generate and freeze the handover torque T_hold, latch the last issued position command as the position holding value P_hold, and clear the remaining unexecuted contact search motion trajectory in the controller; when all verifications pass, a torque control mode switching request is sent to the servo driver; if any verification item fails, all handovers are completed. All actions are not executed, maintaining the position control mode. The transition period control module, from the issuance of the torque control mode switching request until the first detection of actual mode feedback as torque control mode, maintains the control position command at a constant P_hold output and the control target torque at a constant T_hold output during the transition period. It prohibits refreshing the target torque command based on torque feedback during the transition period and prohibits cancelling the mode switching request based on fluctuations in the torque feedback value during the transition period. The mode confirmation module uses M consecutive control cycles of actual mode feedback returned by the servo driver as the torque control mode as the basis for determining the switching completion. It only allows switching after the first detection of actual mode feedback as torque control mode. The position command is updated to the current actual feedback position value; after continuous confirmation, the pressurization operation phase of torque control mode is entered; the stop-and-go switch module is used to exit torque control mode. The switch-off trigger condition is that the torque command value is equal to the preset depressurization target value and the actual electrode speed is lower than the preset stop-and-go threshold and is maintained for K consecutive control cycles; within the same control cycle where the condition is met, the current actual position is latched as the position command and a mode switching request to exit torque control mode is issued. The torque command remains unchanged during the control switch-off waiting period; the target torque channel is cleared only after the actual feedback of position control mode is confirmed for M consecutive control cycles; where N, M, and K are all preset positive integers.
[0020] In some embodiments, the system further includes at least one of a stop-and-hold module and a zero-speed transition window module. The stop-and-hold module is configured not to immediately issue a torque control mode switching request after contact confirmation, but to freeze the position command and make the follow-up pre-written value continuously follow the torque feedback update. After the actual speed of the electrode is lower than the preset stop-and-hold threshold and is maintained for a preset number of cycles, the transfer torque T_hold is frozen and a torque control mode switching request is issued. A maximum waiting time is set, and the transfer torque T_hold is frozen again and a torque control mode switching request is issued after the timeout. The zero-speed transition window module is configured not to directly request to switch back to the position control mode after the back-cutting trigger condition of the stop-and-hold module is met, but to first switch to the speed control mode where the speed command is always 0 as a transition window. The position command is kept locked and the torque command remains unchanged within the transition window. When the transition window count reaches the preset time, a position control mode switching request is issued, and a watchdog timeout is set. When the window count abnormally exceeds the limit, a position control mode switching request is forcibly issued as a fallback.
[0021] Compared with the prior art, the advantages of the present invention are as follows: First, the transient impact during switching is fundamentally suppressed, truly achieving a seamless handover from position mode to torque mode. This invention, through a follow-up pre-writing mechanism, ensures that the target torque channel continuously carries an effective torque value before the switching request. Combined with a confirmation-timed handover, the handover torque and position holding values are frozen in one go. A transitional freezing mechanism latches the position command to maintain contact holding force. This simultaneously solves the inherent step problem of mode switching from two dimensions: continuous command and no force release. Compared to traditional direct switching schemes, the torque swing within the switching window is significantly narrowed, and electrode position disturbances are reduced to the micrometer level, completely avoiding the typical transient defect of "force relief rebound—secondary impact." The switching process is free of significant mechanical vibration.
[0022] Second, this invention addresses the challenge of managing delayed mode feedback windows, significantly improving switching reliability and success rate. Addressing the industry-wide common issues of delayed mode feedback and unreliable feedback during the transition period in servo drives, this invention implements a control strategy of "position command latching, torque command freezing, and cancellation requests not based on transition state feedback" during the transition phase. It uses continuous multi-cycle actual mode feedback as the sole criterion for determining switching completion. This avoids the risk of uncontrollable blind switching mode states and completely eliminates the problems of repeated mode switching and process failures caused by misreading transition feedback. Mode switching is completed in one go, resulting in strong operational stability.
[0023] Third, the bidirectional switching is completely uninterrupted, and the return process after exiting the torque mode is smooth and controllable. When exiting the torque mode, this invention adopts a dual-condition triggering action of "precise torque command arrival + mechanical electrode stabilization" to replace the fixed delay and torque dead zone indirect determination method in the prior art. This ensures that the electrode is in a mechanically stationary state when the position ring takes over, avoiding the sudden braking transient caused by speed return. Furthermore, the zero-speed transition window transition mechanism can decompose the two-layer handover of "torque ring - position ring" into two single-layer handovers, further reducing the inherent step of mode alternation, and the return position disturbance is extremely low. With the implementation method of entering the stabilization waiting and exiting the zero-speed transition window, there is no torque zero-crossing impact during the bidirectional switching process.
[0024] Fourth, it is adapted to industrial hard real-time control scenarios and has a complete fault safety mechanism. All control logic of this invention can be executed within a fixed short-cycle real-time thread without the need to introduce sleep, resource locks or dynamic memory operations, which fully meets the hard real-time requirements of industrial robot control systems. At the same time, the entire path adopts the safety design concept of failure to move. If the handover verification fails, the switching will be refused. In abnormal scenarios such as switching timeout and mode loss, the order of "first maintain torque, then safely switch back, and clear to zero after confirmation" is followed. All abnormal states fall into the safety side of maintaining effective output, effectively avoiding the risk of equipment and workpiece damage caused by incorrect force application.
[0025] V. Effectively improves spot welding process quality and equipment service life. The entire mode switching process is free from impact and mechanical vibration, ensuring stable contact between the electrode and workpiece. This significantly reduces spot welding spatter, improves weld consistency and mechanical property stability, and avoids abnormal wear caused by repeated impacts on the electrode, effectively extending electrode life and reducing production and maintenance costs. Furthermore, the ramp pressurization process in torque mode offers strong controllability, precisely matching multi-stage process pressure requirements and adapting to the spot welding needs of different workpieces and materials. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a structural block diagram of the servo welding gun position and torque mode disturbance-free switching control system according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the state transition of the torque switching state machine according to an embodiment of the present invention, which shows the enhanced control logic for entering the stabilization waiting and exiting the zero-speed transition window; Figure 3This is a time-by-time timing table for the handover process from CSP mode to CST mode as described in the embodiments of the present invention; Figure 4 The transient measured waveform diagram of the early version of CSP→CST direct switching in Comparative Example 1; Figure 5 The waveform diagram of the real device used to demonstrate the mode switching caused by reading feedback during the transition period in the improved scheme of Comparative Example 2 is shown. Figure 6 This is a real-machine measured waveform diagram of the CSP→CST non-interference handover window in the basic mechanism embodiment of the present invention (without enabling the entry into the stabilization waiting state); Figure 7 This is a real-machine measured waveform diagram of the CST→CSP depressurization and stabilization return switch window in the embodiment of the basic mechanism of this invention (without enabling the exit zero-speed transition window); Figure 8 A panoramic waveform diagram of the complete pressurization cycle for entering the stabilization waiting period and exiting the zero-speed transition window, as configured in this embodiment of the invention; Figure 9 This is a waveform comparison of the transient switching under the same operating conditions before and after the start of the stop-and-wait function on the entry side of the present invention. Figure 10 This is a waveform comparison of the transient return-to-cut under the same operating conditions before and after the zero-speed transition window is enabled on the exit side of this invention. Detailed Implementation
[0028] The present application will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0029] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. This application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] It should be noted that all aspects of the embodiments described below are within the scope of protection of the appended claims. It should be understood that the aspects described herein can be implemented in many different forms, and any specific structure and / or function described herein is merely exemplary. Based on this application, those skilled in the art should understand that any aspect described herein can be implemented independently of other aspects, or in combination with one or more other aspects in various ways. For example, any number of aspects set forth herein can be used to implement an apparatus or practice method; alternatively, other structures and / or functions can be employed to implement the apparatus or practice method outside of one or more aspects set forth herein.
[0031] It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The illustrations only show the components related to this application and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the shape, quantity and proportion of each component may vary, and the component layout may be more complex.
[0032] Furthermore, specific details are provided in the following description to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that these examples can be implemented without these specific details.
[0033] The technical solutions provided by the various embodiments of this application are described below with reference to the accompanying drawings.
[0034] Please see Figure 1-4 As shown in this implementation scheme: the seamless switching from servo welding gun position mode to torque mode is implemented as follows: This embodiment presents a spot welding system based on a six-axis industrial robot and a seventh-axis servo welding gun. The servo welding gun adopts a C-type gun structure, driven by a servo motor via a synchronous belt reducer to a 10mm lead ball screw. The motor-side pulley has 32 teeth, and the screw-side pulley has 50 teeth, with a reduction ratio of 0.64. Each motor revolution corresponds to a 6.4mm electrode travel. The motor encoder resolution is 131072 counts / rev, and the position resolution is 20480 counts / mm. The system uses EtherCAT real-time industrial bus communication, the servo driver follows the CiA402 protocol, and the controller's real-time control cycle is 2ms. The driver mode display mechanism is configured to follow the actual control mode, and the measured mode feedback lags behind the mode request by 3 beats (6ms).
[0035] This embodiment presets the following key parameters: contact confirmation sample number N=5, mode stabilization confirmation timeout M=2, switching timeout duration 500 times (1s), contact search speed 1mm / s, stabilization threshold 0.1mm / s (1 / 10 of the contact search speed), and pressure ramp step size 1. Rated torque / cycle.
[0036] The switching process in this embodiment is performed according to the following steps: A1. Torque Follow-up Pre-write Stage: In Cyclic Synchronous Position Mode (CSP), the controller controls the electrodes to perform workpiece contact search motion, synchronously activating the contact detection function. From the control cycle in which the torque feedback first exceeds the preset contact threshold, the real-time thread writes the current effective torque feedback into the target torque channel (0x6071) of the servo driver as the follow-up pre-write value cycle by cycle. The issuance of the follow-up pre-write value requires the following to be met simultaneously: normal system operation, no coordinate errors, the current actual mode is position control mode, the torque feedback is a valid positive value, and the system is in a mode handover control flow. If the torque feedback falls below the contact threshold, detection fails, the system stops, or a coordinate error occurs, the target torque channel is cleared to zero within the same control cycle. The necessity of the above follow-up pre-write lies in the fact that the handover torque and mode switching request first appear in the same frame of process data, and the specific frame of process data that the driver uses when processing the switching request is determined by its internal implementation, which is not specified in the bus protocol or driver manual. If an earlier frame is used, the zero value left over from the free travel segment will be read. Following the pre-write ensures that the target torque channel is valid throughout the entire hit window before the request, making any shot safe.
[0037] A2. Contact confirmation and synchronous handover: When the torque feedback of 5 consecutive control cycles exceeds the contact threshold, it is determined as contact confirmation; the measured torque latched in the first sampling cycle that exceeds the threshold is used as the contact recorded torque for subsequent handover lower limit and pressure relief target.
[0038] Within the same control cycle of contact confirmation and torque mode switching request, all handover actions are executed simultaneously: First, eight system status joint verifications are performed, including system operating status verification, coordinate error verification, mode feedback reading validity verification, torque feedback reading validity verification, current actual mode verification, confirmation of positive torque value verification, parameter validity verification, and torque upper limit verification; if any verification item fails, all handover actions are not executed, the pre-written value is cleared, and the position control mode is maintained.
[0039] After all verifications pass, the current torque feedback is read, and the larger value between it and the contact recorded torque is generated and frozen as the handover torque T_hold. If T_hold exceeds the preset torque upper limit, is a non-positive value, or is not a finite effective value, the mode switch is rejected. At the same time, the last position command issued before the current control cycle is latched as the position holding value P_hold to maintain the position loop following error and maintain the contact holding force. Then, the remaining search motion trajectory is cleared, the motion queue is reset, and the addition of new segments is blocked. Finally, the torque control mode (CST) switching request and the frozen handover torque T_hold are synchronously issued in the same frame of process data.
[0040] A3. Transition Period Freeze Control: From the issuance of the torque mode switching request until the first detection of the actual mode feedback as torque control mode during the transition period, the position command is kept constant at P_hold, and the synchronous operation of the position command following the feedback position is prohibited to avoid releasing the contact holding force; the target torque is kept constant at T_hold, and the torque feedback refresh command is not read; and the numerical fluctuation of the torque feedback during the transition period does not constitute a basis for canceling the mode switching request.
[0041] A4. Mode Activation Confirmation: The controller only allows the position command to be synchronized to the actual feedback position after the actual mode feedback is detected as torque control mode for the first time. When the actual mode feedback is torque control mode for two consecutive control cycles, the switch is considered complete, and the controller enters the pressurization operation phase under torque control mode. During pressurization, the torque command is based on the command value of the previous control cycle and is recursively approximated to the target value of the current slope by a preset step size. The command is not directly recalculated based on the torque feedback to avoid feedback noise entering the control link.
[0042] In this embodiment, actual measurements were performed on a real device at 2ms frame-by-frame: the actual residual torque valley value within the switching window was -99. Torque swing 210 The electrode position disturbance is only 0.020mm, the mode switching is completed in one go without secondary impact, and the pressure of all four process stages meets the standards.
[0043] Implementation of stop-and-go switching from torque mode to position mode in servo welding clamps: The hardware environment and basic parameters in this embodiment are the same as those for the seamless switching from servo welding gun position mode to torque mode. For scenarios where the torque mode is exited after welding is completed, a seamless reversal is implemented. The specific process is as follows: B1. Pressure Relief Ramp Execution: Upon receiving the pressure relief command, the controller sets the torque ramp target value to the pre-stored contact record torque. The torque command decreases incrementally in a preset step size until the torque command value is exactly equal to the pressure relief target value.
[0044] B2. Stabilization Judgment and Back-cut Trigger: During the execution of the pressure relief ramp, the electrode continuously follows the force balance point. In actual machine testing, the electrode position retreated by 0.48mm within 600ms of the pressure relief ramp, and the running speed fluctuated between 0.5 and 2.7mm / s. It did not reach the convergence state, and the back-cut action was not triggered during this stage.
[0045] When the torque command is exactly equal to the depressurization target value, and the actual electrode speed is less than 0.1 mm / s and is maintained for two consecutive control cycles, the cutback condition is determined to be met. Within the same control cycle where the condition is met, the current actual position is latched as the position command, and a position control mode switching request is sent to the servo driver synchronously.
[0046] B3. Reversal Confirmation and Torque Zeroing: During the reversal waiting period, the torque command remains unchanged at its current value; only when the actual mode feedback for two consecutive control cycles is position control mode will the target torque channel be zeroed, completing the entire reversal process.
[0047] This embodiment was tested on a real machine: the disturbance of the electrode position before and after switching the beat was only 0.014mm, and the residual torque peak was the inherent response of the internal mode switching of the driver. Since the shaft was stationary and the position command was continuous, no mechanical impact was generated.
[0048] Enhanced bumpless handover implementation with stop-and-hold and zero-speed transition window: This embodiment, based on the above-described disturbanceless handover and stop-and-go handover implementations, adds an enhanced mechanism for stop-and-go waiting on the entry side and a zero-speed transition window on the exit side to further suppress handover transients. The specific implementation method is as follows: C1. Entering the side-stop waiting mechanism: After contact confirmation, the torque mode switching request is not issued immediately, and the stop waiting stage is entered: When contact is confirmed, the position holding value P_hold is first latched and the remaining search motion trajectory is cleared. The position holding command is a constant output of P_hold, which follows the prewritten value and continuously follows the torque feedback update; at the same time, a waiting timer of up to 150ms is started.
[0049] When the actual speed is below the stopping threshold and the conditions are met for two consecutive control cycles, the handover torque T_hold is frozen and a torque mode switching request is issued. The subsequent handover, transition period, and confirmation process are the same as the aforementioned seamless handover. If the stopping conditions are not met after the timeout, the timeout is used as a fallback, and the handover torque T_hold is frozen again and a torque mode switching request is issued.
[0050] Comparison with actual machine under the same working conditions: the baseline solution without stabilization waiting was confirmed to have a residual speed of approximately 0.9mm / s, and the negative pendulum reached -97. After activating the 150ms stop-and-hold period, the residual speed before switching drops to approximately 0.08 mm / s, and the minimum torque value is +69. Throughout the process, the electrode back-kick speed decreased from -2.3 mm / s to -0.4 mm / s, and the position disturbance decreased from 90 μm to 10~22 μm.
[0051] C2. Zero-speed transition window mechanism on the exit side: After the back-cut trigger condition is met, the position control mode is not directly requested to be switched back. Instead, the periodic synchronous speed mode (CSV) with the speed command always being 0 is first switched in as a transition window. The window duration is set to 50 beats (100ms). The position command is locked and the torque command remains unchanged within the transition window. When the window is full, a position control mode switching request is sent to the servo driver. An additional watchdog timeout is set as a fallback.
[0052] Comparison with actual machines under the same operating conditions: the torque fluctuation range of the direct switching scheme without a springboard is -98. ~+201 After enabling the 100ms zero-speed transition window, the torque range within the transition window is +65. ~+98 The entire process never crosses zero, effectively eliminating the step impact caused by the superposition of torque loop exit and position loop cold start.
[0053] Using the complete production configuration of this embodiment, the pattern sequence of a single spot welding pressurization cycle is CSP→CST→CSV→CSP, the actual torque does not cross zero throughout the process, the electrode position curve is gradually smooth, and there is no impact displacement.
[0054] Implementation of safety controls under abnormal operating conditions: This embodiment implements a safety control strategy of failure-based refusal to operate for various abnormal scenarios during the handover process, specifically including: D1. Handover verification failure scenario: If any item in the joint verification fails, do not issue a mode switching request, immediately clear the follow-up pre-written value and the target torque channel, maintain the position control mode and report the error. On-site, this mechanism can be used to intercept reverse output accidents such as incorrect torque direction configuration.
[0055] D2. Switching Timeout Scenario: After issuing a mode switching request, if no corresponding mode feedback is received for two consecutive beats within 1 second, the current torque command is kept unchanged, the current actual position is latched, and then a request is made to switch back to the position control mode. The target torque channel is cleared only after the position mode feedback confirms the change continuously, so as to avoid instantaneous power loss under pressure.
[0056] D3. Abnormal Scenario in Operation Mode: During the operation of torque control mode, if abnormalities such as mode loss or illegal parameters occur, the position control mode will be safely switched back in the order of "hold torque command - latch position - request switchback - clear after confirmation", without actively removing the contact pressure throughout the process.
[0057] D4. Queue ownership contention scenario: If the motion trajectory queue is occupied by a non-real-time command thread during the contact confirmation cycle, the handover action is postponed to the first control cycle after the real-time thread acquires queue ownership; during the postponement period, the pre-written value is continuously updated cycle by cycle without interrupting the numerical maintenance of the torque channel.
[0058] D5. Detection midway release scenario: If the contact detection is released during the handover execution, only the detection function module is released. The final clearing of the pre-written value and the target torque channel is uniformly executed by the control path of handover acceptance or rejection. The clearing action and the detection release action are decoupled to avoid torque step jump caused by accidental clearing midway.
[0059] In this embodiment, the target torque channel of the servo driver has only one control write entry point. All torque commands are issued through a unified direction adaptation layer, eliminating control logic confusion caused by bypass writes. All abnormal paths fall into the safe side that maintains valid commands and the current state, meeting the reliability requirements of a hard real-time system.
[0060] The same or similar parts between the various embodiments in this specification can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments.
[0061] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
[0062] Therefore, the scope of protection of this application shall be determined by the scope of the claims.
Claims
1. A servo welding gun position and torque mode seamless switching control method, applied to a controller with a fixed control cycle, wherein the controller is communicatively connected to a servo driver that drives the servo welding gun electrode, and the servo driver supports switching between position control mode and torque control mode; In position control mode, the controller controls the electrode to perform a contact search motion approaching the workpiece; characterized in that, The method includes: Torque follow-up pre-writing steps: Starting from the first time the torque feedback crosses the preset contact threshold, the current effective torque feedback is written into the target torque channel of the servo driver as the follow-up pre-writing value in each control cycle; when the torque feedback falls back below the contact threshold, causing the contact hit state to be interrupted, the target torque channel is cleared to zero in the same control cycle. Contact confirmation and handover steps: Contact confirmation is determined when the torque feedback of N consecutive control cycles exceeds the contact threshold; within the same control cycle that issues the torque control mode switching request, all of the following handover actions are performed simultaneously: perform system state joint verification, read the current torque feedback to generate and freeze the handover torque T_hold, latch the last issued position command as the position holding value P_hold, clear the remaining search motion trajectory, and issue a torque control mode switching request to the servo driver; if any verification item fails, all handover actions are not performed, and the position control mode is maintained; Transition freeze steps: From the issuance of the torque control mode switching request until the first detection of the actual mode feedback as torque control mode during the transition period, the position command remains at a constant output of P_hold, the target torque remains at a constant output of T_hold, the target torque command is not refreshed based on the torque feedback, and the mode switching request is not canceled based on the numerical fluctuation of the torque feedback during the transition period. Mode activation confirmation steps: The torque control mode is determined by M consecutive control cycles of actual mode feedback returned by the servo drive; the position command is allowed to be synchronized to the actual feedback position only after the actual mode feedback is detected as torque control mode for the first time; after continuous confirmation, the pressurization operation stage in torque control mode is entered; where N and M are both preset positive integers.
2. The servo welding gun position and torque mode seamless switching control method according to claim 1, characterized in that, The system pre-stores the contact recording torque, which is the measured torque latched at the sampling moment when the contact threshold is first exceeded. This torque serves as the lower limit of the handover torque and the target value for the decompression stage. The handover torque T_hold is the larger of the actual torque at the time of the switching request and the contact recording torque. If T_hold exceeds the preset torque upper limit, is a non-positive value, or is not a finite effective value, the mode switch is rejected, the pre-written follow value is cleared, and the position control mode is maintained. The position holding value P_hold is the position command value issued in the last control cycle before the mode switch request is issued. It is used to maintain the position loop following error and prevent the contact holding force before the switch from being released.
3. The servo welding gun position and torque mode seamless switching control method according to claim 1, characterized in that, The following conditions must be met simultaneously before the pre-written values are issued: the system is running normally, there are no coordinate errors, the current actual mode is position control mode, the torque feedback is a valid positive value, and it is in the preset mode handover control process; If a detection failure, detection cancellation, system shutdown, coordinate error, or non-handover path scenario occurs, the target torque channel is immediately cleared to zero. When releasing the contact detection during the handover process, only the detection function module is released, and the control path of handover acceptance or rejection is uniformly cleared to zero along with the pre-written value. The target torque channel of the servo driver has only one control write entry, and all torque commands are issued through this entry. If the motion trajectory queue is occupied by a non-real-time thread during the contact confirmation cycle, the handover action is postponed to the first control cycle after the real-time thread acquires ownership of the queue. During the postponement, the pre-written value is continuously updated cycle by cycle.
4. The servo welding gun position and torque mode seamless switching control method according to claim 1, characterized in that, If no corresponding mode feedback is received for M consecutive control cycles after the preset timeout period has elapsed after the mode switching request is issued, or if mode loss or illegal parameter abnormality occurs in torque control mode, the position control mode will be safely switched back in the following order: First, keep the current torque command unchanged, latch the current actual position, and then request to switch back to position control mode. After the actual mode feedback is that it is position control mode and is continuously confirmed, the target torque channel will be cleared.
5. The servo welding gun position and torque mode seamless switching control method according to claim 1, characterized in that, The torque commands during the pressurization and depressurization processes are based on the command values of the previous control cycle, and are recursively applied to approach the target value of the current slope by a preset step size, without directly recalculating the commands based on torque feedback; the stopping threshold is set according to a preset ratio of the electrode contact search speed, and the number of consecutive cycles M for mode stability confirmation is the same as the number of consecutive cycles K for stopping determination.
6. The servo welding gun position and torque mode seamless switching control method according to claim 1, characterized in that, After contact confirmation, a torque control mode switching request is not immediately issued; instead, a stabilization waiting phase is initiated: Upon contact confirmation, the position hold value P_hold is latched and the remaining search motion trajectory is cleared. The position command is maintained at a constant output of P_hold, continuously updated following the pre-written value and torque feedback. Once the actual speed is below the stabilization threshold for K consecutive control cycles, the handover torque T_hold is frozen and a torque mode switching request is issued. The stabilization waiting phase has a maximum waiting time. If the timeout occurs, the handover torque T_hold is still frozen and a torque mode switching request is issued. The timeout is a fallback exit condition, where K is a preset positive integer.
7. The servo welding gun position and torque mode seamless switching control method according to claim 1, characterized in that, It also includes a stop and turnback step: when exiting the torque control mode, the turnback trigger condition is that the torque command value is exactly equal to the preset pressure relief target value and the actual speed of the electrode is lower than the preset stop threshold and is continuously maintained for K control cycles. Within the same control cycle where the conditions are met, the current actual position is latched as a position command and a mode switching request to exit the torque control mode is issued. During the back-cut waiting period, the torque command remains unchanged. The target torque channel is cleared only after the actual feedback of the position control mode is confirmed for M consecutive control cycles. Here, K is a preset positive integer.
8. The servo welding gun position and torque mode seamless switching control method according to claim 7, characterized in that, After the back-cut trigger condition is met, the system does not directly request to switch back to the position control mode. Instead, it first switches to the speed control mode where the speed command is always 0 as a transition window. During the transition window, the position command is locked and the torque command remains unchanged. Once the transition window has been counted for a preset duration, a position control mode switching request is issued, and a watchdog timer is set. If the window count is abnormally exceeded, a position control mode switching request is forcibly issued as a fallback.
9. A servo welding gun position and torque mode seamless switching control device, applied in a robot controller, wherein the controller is communicatively connected to a servo driver that drives the servo welding gun, and the servo driver supports switching between position control mode and torque control mode; characterized in that, The device includes: The contact detection module is used to determine the contact status based on the torque feedback of each control cycle during the contact search phase of the position control mode: when the torque feedback exceeds the preset contact threshold for the first time, it is determined to enter the contact hit state; when the torque feedback exceeds the contact threshold for N consecutive control cycles, it is determined to confirm the contact. The follow-up pre-write module is used to write the current effective torque feedback into the target torque channel of the servo driver as the follow-up pre-write value every control cycle, starting from the first entry into the contact hit state; when the torque feedback falls below the contact threshold and causes the contact hit state to be interrupted, the target torque channel is cleared to zero in the same control cycle; the effective torque feedback refers to the positive torque feedback value within the effective range. The synchronous handover module is used to perform joint system status verification within the same control cycle after contact confirmation, read the current torque feedback to generate and freeze the handover torque T_hold, latch the last issued position command as the position hold value P_hold, and clear the remaining unexecuted contact search motion trajectory in the controller; when all verifications pass, a torque control mode switching request is sent to the servo driver; if any verification item fails, all handover actions are not executed, and the position control mode is maintained. The transition period control module is used to maintain the control position command at a constant P_hold output and the control target torque at a constant T_hold output during the transition period from the issuance of the torque control mode switching request until the first detection of the actual mode feedback as torque control mode. It prohibits refreshing the target torque command based on the torque feedback during the transition period and prohibits canceling the mode switching request based on the numerical fluctuation of the torque feedback during the transition period. The mode confirmation module is used to determine the torque control mode based on the actual mode feedback returned by the servo driver for M consecutive control cycles. It also controls the position command to be updated to the current actual feedback position value only after the actual mode feedback is detected for the first time. After continuous confirmation, the pressurization operation phase in torque control mode is entered. The stop-and-go back-cut module is used to exit the torque control mode. The back-cut trigger condition is that the torque command value is equal to the preset pressure relief target value and the actual electrode speed is lower than the preset stop-and-go threshold for K consecutive control cycles. Within the same control cycle where the condition is met, the current actual position is latched as the position command and a mode switching request to exit the torque control mode is issued. The torque command remains unchanged during the control back-cut waiting period. The target torque channel is cleared only after the actual feedback of the position control mode is confirmed for M consecutive control cycles. N, M, and K are all preset positive integers.
10. The servo welding clamp position and torque mode seamless switching control device according to claim 9, characterized in that, It also includes at least one of a stop-and-hold module and a zero-speed transition window module. The stop-and-hold module is used to not immediately issue a torque control mode switching request after contact confirmation. Instead, it freezes the position command and makes the follow-up pre-written value continuously follow the torque feedback update. After the actual speed of the electrode is lower than the preset stop-and-hold threshold and is maintained for a preset number of cycles, it freezes the handover torque T_hold and issues a torque control mode switching request. It also sets a maximum waiting time. After the timeout, it freezes the handover torque T_hold again and issues a torque control mode switching request. The zero-speed transition window module is used to not directly request to switch back to the position control mode after the back-cutting trigger condition of the stop-and-hold module is met. Instead, it switches to a speed control mode where the speed command is always 0 as a transition window. Within the transition window, the position command is locked and the torque command remains unchanged. When the transition window count reaches the preset time, it issues a position control mode switching request. It also sets a watchdog timeout. If the window count abnormally exceeds the limit, it forcibly issues a position control mode switching request as a fallback.