Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a method for controlling a position of a DR device, including the steps of:
carrying out load difference correction on an active motion device and a follow motion device in DR equipment to obtain characteristic coefficients;
Receiving starting motion information of the active motion device, and acquiring position information of the active motion device at fixed time according to the starting motion information;
The position information is subjected to sectional processing to obtain motion parameters, and the motion parameters are subjected to linear processing based on the characteristic coefficients to obtain processed motion parameters;
And sending a motion instruction to the follow-up motion device based on the processed motion parameters.
The method has the advantages that the position information of the active movement device is acquired at fixed time according to the initial movement information, the position information is subjected to sectional processing to obtain movement parameters, the movement parameters are subjected to linear processing based on the characteristic coefficients to obtain processed movement parameters, a movement instruction is sent to the follow-up movement device based on the processed movement parameters, only one device of the DR equipment moves, the other device can accurately follow the movement, automatic positioning centering of a bulb tube and a flat plate in the DR equipment is completed, focus or interested parts can be shot rapidly, operation difficulty is reduced, and shooting efficiency is effectively improved.
Further, the correcting the load difference of the active motion device and the following motion device in the DR device, and obtaining the characteristic coefficient includes:
The same driving signals are respectively sent to an active motion device and a following motion device in DR equipment;
Receiving first movement completion information corresponding to the active movement device and second movement completion information corresponding to the following movement device, wherein the first movement completion information comprises movement time of the active movement device, and the second movement completion information comprises movement time of the following movement device;
And calculating a characteristic coefficient according to the movement time of the active movement device and the movement time of the following movement device.
As can be seen from the above description, the use of the same driving signal ensures that the motors of the two devices have the same torque, and if the loads of the two devices are different, the time required to reach the same position is different, in this way, the load difference between the two devices can be accurately corrected before automatic following, ensuring the accuracy of the following position.
Further, the calculating the characteristic coefficient according to the movement time of the active movement device and the movement time of the following movement device includes:
k=t1/t2;
Wherein k represents the characteristic coefficient, t1 represents the movement time of the active movement device, and t2 represents the movement time of the following movement device.
From the above description, the characteristic coefficient is calculated according to the movement time of the active movement device and the movement time of the following movement device, so that the correction of the two devices can be completed simply and reliably by using the characteristic coefficient.
Further, the step of acquiring the position information of the active movement device according to the starting movement information at fixed time includes:
acquiring the position information of the active motion device according to the starting motion information at preset time intervals, and storing the position information into a position buffer area;
The step of carrying out segmentation processing on the position information to obtain motion parameters comprises the following steps:
Sequentially acquiring a plurality of position information from the position buffer area according to a preset time unit;
Randomly extracting a preset number of target position information from the plurality of position information;
sequentially calculating the speed and the acceleration corresponding to each piece of target position information by using a speed calculation formula and an acceleration calculation formula;
And determining the speed and the acceleration corresponding to each piece of target position information as motion parameters corresponding to each piece of target position information.
As can be seen from the above description, when the active movement device starts to move, the position information of the active movement device is recorded according to the preset time interval, so that the movement parameters corresponding to each section of movement of the active movement device are calculated later, and the following movement of the following movement device is realized.
Further, the linear processing is performed on the motion parameters based on the characteristic coefficients, and the obtaining the processed motion parameters includes:
the characteristic coefficients are sequentially used for carrying out linear processing on the acceleration corresponding to each piece of target position information, and the processed acceleration is obtained;
and obtaining the processed motion parameters according to the processed acceleration and the processed speed.
As can be seen from the above description, the acceleration corresponding to each target position information is processed linearly by using the characteristic coefficients in sequence, and can be converted into the motion parameters required by the following motion device accurately, so as to realize the position following with small error.
Further, the step of sequentially using the characteristic coefficients to perform linear processing on the acceleration corresponding to each piece of target position information, where obtaining the processed acceleration includes:
a1=k*a2;
in the formula, a2 represents acceleration corresponding to the target position information, a1 represents the processed acceleration, and k represents the characteristic coefficient.
From the above description, the speed and the acceleration of the following motion device are determined by using the characteristic coefficients according to the above formula, and no matter where the active motion device is located, the rapid automatic centering can be realized, thereby improving the automation degree and the efficiency of the position control.
Further, the sending a motion instruction to the follow-up motion device based on the processed motion parameter includes:
and sequentially sending a motion instruction to the follow-up motion device according to each processed motion parameter.
From the above description, the motion instructions are sequentially sent to ensure the real-time performance of control and improve the efficiency of position control.
Further, the sending a motion command to the following motion device based on the processed motion parameter further includes:
and judging whether the active movement device stops moving, if not, returning to execute the step of sequentially acquiring a plurality of position information from the position buffer area according to a preset time unit, and if so, controlling the following movement device by using a position type PID control algorithm according to the relation between the position information in the position buffer area and the preset time unit.
From the above description, it can be seen that the use of a position type PID control algorithm can make the position of the final follow-up movement device more accurate.
Further, the controlling the following motion device by using a position type PID control algorithm according to the relationship between the position information in the position buffer area and the preset time unit includes:
acquiring position information which does not meet the preset time unit from the position buffer area;
And controlling the follow-up motion device by using a position type PID control algorithm according to the position information which does not meet the preset time unit.
As can be seen from the above description, the position following is performed by taking the preset time unit as a unit, so that the setting of the preset time unit can be performed by matching with the calculation power of the CPU, the calculation resource of the processor is utilized to the greatest extent, the real-time performance of the position control is ensured, the position information which does not meet the preset time unit can be directly used for the position control by using the position type PID control algorithm, and the accuracy of the position control is effectively improved.
Referring to fig. 2, another embodiment of the present invention provides a position control terminal of a DR device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements each step in the position control method of the DR device when executing the computer program.
The above-mentioned method and terminal for controlling the position of a DR device according to the present invention can be applied to suspending the DR device, and the following description will be given by way of specific embodiments:
Example 1
Referring to fig. 1 and 3, a method for controlling a position of a DR device according to the present embodiment includes the steps of:
S1, carrying out load difference correction on an active motion device and a follow motion device in DR equipment to obtain characteristic coefficients, wherein the characteristic coefficients are shown in FIG. 3 and specifically comprise:
S11, respectively transmitting the same driving signals to an active motion device and a following motion device in DR equipment;
The suspension DR equipment is provided with two upright posts, wherein one upright post is provided with a flat plate, namely a flat plate upright post, the other upright post is provided with a bulb tube in a suspended manner, namely a bulb tube upright post, and the movement of the flat plate upright post and the bulb tube upright post is controlled by two motors respectively;
In an alternative embodiment, the active motion device is a flat plate column and the follow motion device is a bulb column.
In another alternative embodiment, the active motion device is a bulb column and the follow motion device is a slab column.
S12, receiving first movement completion information corresponding to the active movement device and second movement completion information corresponding to the following movement device, wherein the first movement completion information comprises movement time of the active movement device, and the second movement completion information comprises movement time of the following movement device;
S13, calculating characteristic coefficients according to the movement time of the active movement device and the movement time of the following movement device, and specifically:
k=t1/t2;
Wherein k represents the characteristic coefficient, t1 represents the movement time of the active movement device, and t2 represents the movement time of the following movement device.
In an alternative embodiment, the characteristic coefficients may be saved to an internal flash memory of the MCU (micro control unit Microcontroller Unit) for real-time invocation.
S2, receiving starting motion information of the active motion device, and acquiring position information of the active motion device at fixed time according to the starting motion information;
Specifically, as shown in fig. 3, position information of the active motion device is obtained according to the starting motion information at preset time intervals, and the position information is stored in a position buffer area;
in an alternative embodiment, a position detection unit, such as a potentiometer or encoder, may be used to detect the position of the active motion device in real time, sending start motion information as the active motion device moves.
In an alternative embodiment, the preset time interval is 20ms.
In an alternative embodiment, a 20ms timer may be initialized to obtain the position information of the active motion device every 20ms after receiving the start motion information, and the position information may be stored in the position buffer FifoPosition.
S3, carrying out segmentation processing on the position information to obtain motion parameters, and carrying out linear processing on the motion parameters based on the characteristic coefficients to obtain processed motion parameters, wherein the motion parameters specifically comprise:
s31, sequentially acquiring a plurality of position information from the position buffer area according to a preset time unit;
In an alternative embodiment, the preset time unit is 200ms, taking account of the computing power of the CPU, the driving frequency of the driving signal and other things of the CPU to be processed, taking 200ms as a unit theoretically enables the following motion device to react as quickly as possible, has higher real-time performance, can possibly be faster if the CPU with higher main frequency is used, and can directly embed an independent addition variable Event200ms in a timer of 20 ms.
S32, randomly extracting target position information with preset number from the plurality of position information, so that randomness of the extracted target position information is ensured;
In an alternative embodiment, the predetermined number is 7;
For example, if the position information is recorded once in 20ms, there are 10 pieces of position information within 200ms, and 7 pieces of target position information are randomly extracted from the 10 pieces of position information, and the 1 st, 2 nd, 3 rd, 5 th, 6 th, 8 th and 10 th pieces of target position information are assumed.
S33, calculating the speed and the acceleration corresponding to each piece of target position information sequentially by using a speed calculation formula and an acceleration calculation formula;
For example, continuing the above example, the speed and acceleration corresponding to the 1 st, 2 nd, 3 rd, 5 th, 6 th, 8 th, and 10 th target position information are sequentially calculated using the speed calculation formula and the acceleration calculation formula, assuming that for the 1 st target position information, the distance difference Δl between the 1 st target position information and the 2 nd target position information is calculated according to the sampling interval of 20ms, then the speed v=Δl/20ms corresponding to the 1 st target position information, and then the acceleration a2=Δv/20ms corresponding to the 1 st target position information is calculated according to the difference Δv between the speed corresponding to the 1 st target position information and the speed corresponding to the 2 nd target position information, and so on.
In an alternative embodiment, the speed corresponding to each target position information may be stored in ActiveMovement [ i ]. A structure array, the acceleration may be stored in ActiveMovement [ i ]. V, and then both may be stored in a preset array, such as FollowMovementShadow array.
S34, determining the speed and the acceleration corresponding to each piece of target position information as motion parameters corresponding to each piece of target position information.
S35, sequentially using the characteristic coefficients to conduct linear processing on the acceleration corresponding to each piece of target position information, and obtaining processed acceleration, specifically:
a1=k*a2;
in the formula, a2 represents acceleration corresponding to the target position information, a1 represents the processed acceleration, and k represents the characteristic coefficient.
S36, obtaining the processed motion parameters according to the processed acceleration and the processed speed.
And S4, sending a motion instruction to the follow-up motion device based on the processed motion parameters.
Specifically, a motion instruction is sequentially sent to the following motion device according to each processed motion parameter, and the following motion device can perform following motion after receiving the motion instruction.
S5, judging whether the active movement device stops moving, if not, returning to the step S31, and if so, executing the step S51.
S51, controlling the following motion device by using a position type PID control algorithm according to the relation between the position information in the position buffer area and a preset time unit, as shown in FIG. 3, specifically including:
S511, acquiring position information which does not meet the preset time unit from the position buffer area;
And S512, controlling the follow-up movement device by using a position type PID control algorithm according to the position information which does not meet the preset time unit.
Example two
Referring to fig. 2, a position control terminal of a DR device of the present embodiment includes a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor implements each step in the position control method of the DR device in the first embodiment when executing the computer program.
In summary, the method and the terminal for controlling the position of the DR equipment provided by the invention are used for carrying out load difference correction on an active motion device and a follow-up motion device in the DR equipment to obtain a characteristic coefficient, receiving start motion information of the active motion device and acquiring position information of the active motion device at fixed time according to the start motion information, carrying out segmentation processing on the position information to obtain motion parameters, carrying out linear processing on the motion parameters based on the characteristic coefficient to obtain processed motion parameters, and sending a motion instruction to the follow-up motion device based on the processed motion parameters, wherein the other device can accurately follow motion as long as one device of the DR equipment moves, so that automatic positioning centering of a bulb tube and a flat plate in the DR equipment is completed, the focus or a part of interest can be rapidly shot, the operation difficulty is reduced, and the shooting efficiency is effectively improved.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.