This application claims priority to Chinese Patent Application No. 201710992569.4, filed Oct. 23, 2017, which is hereby incorporated by reference herein as if set forth in its entirety.
The present disclosure relates to motion control technology, and particularly to a method, a device, and a terminal device for servo movement control.
A servo is an angle actuator, which is suitable for a control system that requires the angle to keep changing and can be maintained, and has been widely used in high-end remote control toys and remote control robots. The servo will respond accordingly in response to a motion instruction. During the process of actual motion, there will be a case that a new motion instruction is received before the previous motion instruction has been responded. In this case, the servo will usually be switched to the new motion instruction immediately for responding. However, when switching from the previous motion instruction to the new motion instruction, the new motion instruction and the previous motion instruction will not be switched smoothly. In a specific application, the servo has an acceleration process from 0 to an ideal speed after receiving a first motion instruction.
In summary, the servo movement control method in the prior art has a problem that the motion instructions cannot be switched smoothly.
To describe the technical schemes in the embodiments of the present disclosure more clearly, the following briefly introduces the drawings required for describing the embodiments or the prior art. Apparently, the drawings in the following description merely show some examples of the present disclosure. For those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
In the following descriptions, for purposes of explanation instead of limitation, specific details such as particular system architecture and technique are set forth in order to provide a thorough understanding of embodiments of the present disclosure. However, it will be apparent to those skilled in the art that the present disclosure may be implemented in other embodiments that are less specific of these details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present disclosure with unnecessary detail.
The present disclosure provides a method, a device, and a terminal device for servo movement control. When the second motion instruction is received, the servo is controlled to move from the ideal position when receiving the second motion instruction to the second ideal end position according to the second motion instruction, so that the servo is switched from the first motion instruction to the second motion instruction smoothly while the implementation is simple, which effectively resolve the problem of the existing servo movement control method that the motion instructions cannot be switched smoothly.
In order to explain the technical solutions described in the present disclosure, the following provides a description through specific embodiments.
S101: controlling an output shaft of the servo to rotate according to a first motion instruction, where the first motion instruction is configured to control the output shaft of the servo to rotate from an actual position when receiving the first motion instruction to a first ideal end position according to a first ideal motion curve.
In an embodiment, when receiving the first motion instruction, the output shaft of the servo will be controlled to move (i.e., rotate) to the first ideal end position from the actual position at which the first motion instruction is received (i.e., the position where the output shaft of the servo is located in the meantime of receiving the first motion instruction), according to the first motion instruction, where the period of the output shaft of the servo to rotate from the actual position at which the first motion instruction is received to the first ideal end position is the first preset time period. The output shaft of the servo will be controlled
In an embodiment, the first motion instruction is specifically configured to control the output shaft of the servo to rotate from the actual position at which the first motion instruction is received to the first ideal end position, in which the movement (i.e., rotation) time thereof is the first preset time period.
S102: detecting whether a second motion instruction is received within a first preset time period, and re-planning a second ideal motion curve to a second ideal end position from a corresponding ideal position on the first ideal motion curve when receiving the second motion instruction.
In an embodiment, if it is detected that the second motion instruction is received within the first preset time period, it indicates that the second motion instruction has been received by the servo before the first motion instruction has been responded, and the servo needs to be switched to respond to the second motion instruction.
In an embodiment, the second motion instruction is specifically configured to control the output shaft of the servo to move (i.e., rotate) from the first ideal end position to the second ideal end position, in which the movement (i.e., rotation) time thereof is the second preset time period, and the starling time of the second preset time period is within the first preset time period.
S103: controlling the output shaft of the servo to rotate from an actual position when receiving the second motion instruction to the second ideal end position according to the second ideal motion curve.
In an embodiment, if the second motion instruction is received within the first preset time period, the output shaft of ate servo will be controlled to move (i.e., rotate) to the second ideal end position from the ideal position when the second motion instruction is received (i.e., the ideal position for the output shaft of the servo to locate in the meantime of receiving the second motion instruction), according to the second motion instruction, where the period of the output shaft of the servo to rotate from the ideal position when the second motion instruction is received to the second ideal end position is the second preset time period. The starting time of the second preset time period is within the first preset time period.
In an embodiment, before step S103, the method further includes the following step.
S104: generating the first ideal motion curve based on the actual position when receiving the first motion instruction, the first ideal end position, and the first preset time period.
In an embodiment, when receiving the first motion instruction, the servo is capable of generating the ideal motion curve corresponding to the first motion instruction, and an ideal position corresponding to each time point of the ideal motion curve can be obtained by the ideal motion curve.
In an embodiment, before step S104, the method further includes the following step.
S105: obtaining the ideal position based on the first ideal motion curve.
In an embodiment, each time point of the movement of the output shaft of the servo in the ideal motion curve of the output shaft of the servo has a linear relationship with the ideal position of the output shaft of the servo.
In an embodiment, the above-mentioned method further includes:
Step S106: controlling the output shaft of the servo to rotate according to the third motion instruction, if a third motion instruction is received without the first preset time period, where the third motion instruction is configured to control the output shaft of the servo to rotate from the actual position when the third motion instruction is received to a third ideal end position.
If the third motion instruction is received without the first preset time period, it indicates that the response to the first motion instruction has been completed. At this time, there is no necessary to stop responding to the first motion instruction, and it is switched to respond to the third motion instruction to move according to the third motion instruction. That is, the output shaft of the servo is controlled to rotate from the actual position when receiving the third motion instruction to the third ideal end position.
In the servo movement control method provided by this embodiment, when the second motion instruction is received, the output shaft of the servo is controlled to rotate from the ideal position when receiving the second motion instruction to the second ideal end position according to the second motion instruction, so that the servo is switched from the first motion instruction to the second motion instruction smoothly while the implementation is simple, which effectively resolve the problem of the existing servo movement control method that the motion instructions cannot be switched smoothly.
a first motion unit 101 configured to control an output shaft of the servo to rotate according to a first motion instruction, where the first motion instruction is configured to control the output shaft of the servo to rotate from an actual position when receiving the first motion instruction to a first ideal end position according to a first ideal motion curve;
a detection unit 102 configured to detect whether a second motion instruction is received within a first preset time period, and re-plan a second ideal motion curve to a second ideal end position from a corresponding ideal position on the first ideal motion curve when receiving the second motion instruction; and
a second motion unit 103 configured to control the output shaft of the servo to rotate from an actual position when receiving the second motion instruction to the second ideal end position according to the second ideal motion curve.
In one embodiment, the servo movement control device 100 further includes:
an ideal position obtaining unit configured to obtain the ideal position based on the first ideal motion curve.
In one embodiment, the servo movement control device 100 further includes:
a curve generating unit configured to generate the first ideal motion curve based on the actual position when receiving the first motion instruction, the first ideal end position, and the first preset time period.
It should be noted that, the servo movement control device provided by this embodiment is based on the same concept as the method embodiment shown in
Exemplarily, the computer program 52 may be divided into one or more modules/units, and the one or more modules/units are stored in the storage 51 and executed by the processor 50 to realize the present disclosure. The one or more modules/units may be a series of computer program instruction sections capable of performing a specific function, and the instruction sections are for describing the execution process of the computer program 52 in the terminal device 5. For example, computer program 52 can be divided into a first motion unit, a detection unit, and a second motion unit. The specific functions of each unit are as follows.
The first motion unit is configured to control the output shaft of the servo to rotate according to a first motion instruction, wherein the first motion instruction is configured to control the output shaft of the servo is rotate from an actual position when receiving the first motion instruction to a first ideal end position.
The detection unit is configured to detect whether a second motion instruction is received within a first preset time period, Wherein the second motion instruction is configured to control the output shaft of the servo to rotate from all ideal position when receiving the second motion instruction to a second ideal end position.
The second motion unit is configured to control the output shaft of the servo to rotate according to the second motion instruction, in response to receiving the second motion instruction within die first preset time period.
The terminal device 5 may be a computing device such as a desktop computer, a notebook computer, a tablet computer, and a cloud server. The terminal device 5 may include, but is not limited to, a proses or 50 and a storage 51. It can be understood by those skilled in the art that
The processor 50 may be a central processing unit (CPU), or be other general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or be other programmable logic device, a discrete gate, a transistor logic device, and a discrete hardware component. The general purpose processor may be a microprocessor, or the processor may also be any conventional processor.
The storage 51 may be an internal storage unit of the terminal device 5, for example, a hard disk or a memory of the terminal device 5. The storage 51 may also be an external storage device of the terminal device 5, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, flash card, and the like, which is equipped on the terminal device 5. Furthermore, the storage 51 may further include both an internal storage unit and an external storage device, of the terminal device 5. The storage 51 is configured to store the computer program and other programs and data required by the terminal device 5. The storage 51 may also be used to temporarily store data that has been or will be output.
Those skilled in the art may clearly understand that, for the convenience and simplicity of description, the division of the above-mentioned functional units and modules is merely an example for illustration. In actual applications, the above-mentioned functions may be allocated to be performed by different functional units according to requirements, that is, the internal structure of the device may be divided into different functional units or modules to complete all or part of the above-mentioned functions. The functional units and modules in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional unit. In addition, the specific name of each functional unit and module is merely for the convenience of distinguishing each other and are not intended to limit the scope of protection of the present disclosure. For the specific operation process of the units and modules in the above-mentioned system, reference may be made to the corresponding processes in the above-mentioned method embodiments, and are not described herein.
In the above-mentioned embodiments, the description of each embodiment has its focuses, and the parts which are not described or mentioned in one embodiment may refer to the related descriptions in other embodiments.
Those ordinary skilled in the art may clearly understand that, the exemplificative units and steps described in the embodiments disclosed herein may be implemented through electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented through hardware or software depends on the specific application and design constraints of the technical schemes. Those ordinary skilled in the art may implement the described functions in different manners for each particular application, while such implementation should not be considered as beyond the scope of the present disclosure.
In the embodiments provided by the present disclosure, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the above-mentioned apparatus/terminal device embodiment is merely exemplary. For example, the division of modules or units is merely a logical functional division, and other division manner may be used in actual implementations, that is, multiple units or components may be combined or be integrated into another system, or some of the features may be ignored or not performed. In addition, the shown or discussed mutual coupling may be direct coupling or communication connection, and may also be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms.
The units described as separate components may or may not be physically separated. The components represented as units may or may not be physical units, that is, may be located in one place or be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of this embodiment.
In addition, each functional unit in each of the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional unit.
When the integrated module/unit is implemented in the form of a software functional unit and is sold or used as an independent product, the integrated module/unit may be stored in a non-transitory computer-readable storage medium. Based on this understanding, all or part of the processes in the method for implementing the above-mentioned embodiments of the present disclosure are implemented, and may also be implemented by instructing relevant hardware through a computer program. The computer program may be stored in a non-transitory computer-readable storage medium, which may implement the steps of each of the above-mentioned method embodiments when executed by a processor. In which, the computer program includes computer program codes which may be the form of source codes, object codes, executable files, certain intermediate, and the like. The computer-readable medium may include any primitive or device capable of carrying the computer program codes, a recording medium, a USB flash drive, a portable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), electric carrier signals, telecommunication signals and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to the legislation and patent practice, a computer readable medium does not include electric carrier signals and telecommunication signals.
The above-mentioned embodiments are merely intended for describing but not for limiting the technical schemes of the present disclosure. Although the present disclosure is described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that, the technical schemes in each of the above-mentioned embodiments may still be modified, or some of the technical features may be equivalently replaced, while these modifications or replacements do not make the essence of the corresponding technical schemes depart from the spirit and scope of the technical schemes of each of the embodiments of the present disclosure, and should be included within the scope of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201710992569.4 | Oct 2017 | CN | national |