The present invention relates to distance-of-travel measuring equipment for a numerical controller.
A numerical controller has a function called a skip function. With this function, when a code, for example, G31 (a distance measuring function code), is followed by a move command, for instance, X1000, the numerical controller moves a movable machine part in the X-axis direction through a linear interpolation, which is a process for finding a value of a function between two known values under the assumption that three points lie on a straight line, as in the case of G01; and when a skip signal is input from an outside source in the execution of the command, the numerical controller proceeds to the next block or suspends its operation, leaving the commanded distance of travel 1000 unfinished. This function can be utilized when the amount of travel is indefinite, and so it is suitable for use in measuring a tool length in combination with a touch sensor.
FIGS. 3(A) and (B) are explanatory views of a tool length measuring system employing the skip function and the touch sensor in combination.
In general, the tool length L indicates the length from a reference point 0 of a tool 1 attached to a chuck 2 to the tip of the tool 1. Next, let the actual position of the reference point 0 and the distance to the sensing face of a touch sensor 3, disposed at a position P.sub.1, be represented by P.sub.0 ' and X.sub.0, respectively, as depicted in FIG. 3(A). Assuming that when the actual position of the reference point 0 reaches a point P.sub.x ', as a result of travel of the tool 1 in the X-axis direction through the skip function, as shown in FIG. 3(B), the tip of the tool 1 abuts against the sensing face of the touch sensor 3 and at the same time a skip signal is generated by the touch sensor 3, stopping the travel of the tool 1. The actual amount of travel P' of the tool can be obtained by subtracting P.sub.0 ' from P.sub.x ', and the tool length L can be determined by subtracting P' from x.sub.0.
Conventional numerical control equipment obtains the abovementioned amount of travel P' by subtracting the current position P.sub.0 in the equipment immediately before the execution of the skip function, from the current position P.sub.x in the equipment at the instant of the application of the skip signal. However, in the case where the machine was stopped prior to the execution of the skip function, P.sub.0 will be equal to P.sub.0 ', and P.sub.x will become greater than P.sub.x ' by a value corresponding to a time lag of servo, or if the feed was accelerated and decelerated, by the corresponding value. Thus, the prior art has encountered the problem that the tool length could not accurately be measured.
The present invention succeeds in solving this problem by the employment of an arrangement including: a feed rate Fm; an acceleration/deceleration time constant TC; a servo time constant TS; and a time lag TR of a skip signal receiving system, which are all prestored in a memory. The distance P.sub.n from the machine position immediately prior to the execution of the abovesaid code, to the machine position at the instant of application of the skip signal is automatically computed. The computation uses the following expression which is based on the current position P.sub.x in the numerical controller at the time of the application of the skip signal, the feed rate Fm, the acceleration/deceleration time constant TC, the servo time constant TS, and the time lag TR. EQU P.sub.n =P-Fm(TC+TS+TR)/60.times.1000 (1)
where P=P.sub.x -P.sub.0, the feed rate Fm is given in mm/min and the acceleration/deceleration time constant, the servo time constant and the time lag of the skip signal receiving system are given in msec.
With such an arrangement, a measurement error resulting from acceleration/deceleration, a time lag of servo, or the like, can automatically be corrected, therefore enabling the amount of travel to be obtained with relatively high accuracy.
However, there is an error which cannot yet be eliminated even by such an arrangement. It is caused by a delay in detecting the skip signal. Conventionally, whether the skip signal has been input or not is detected by monitoring the output of the skip signal receiving circuit through software with a time period of 2 ms, therefore the rise of the skip signal cannot be detected with an accuracy of less than 2 ms. The delay in detecting the skip signal varies each time and cannot be included in the abovementioned expression (1), and the solution to this problem has been greatly desired. The detection delay could be reduced by shortening the skip signal monitoring period, but this would present the problem of increased load on software.