CN108555906B - Robot control method and device and robot - Google Patents

Robot control method and device and robot Download PDF

Info

Publication number
CN108555906B
CN108555906B CN201810314389.5A CN201810314389A CN108555906B CN 108555906 B CN108555906 B CN 108555906B CN 201810314389 A CN201810314389 A CN 201810314389A CN 108555906 B CN108555906 B CN 108555906B
Authority
CN
China
Prior art keywords
timer
motor
processor
robot
pulse value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810314389.5A
Other languages
Chinese (zh)
Other versions
CN108555906A (en
Inventor
梁惺
徐小涵
江世欢
罗阳
查沛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Doyo Jono Industrial Co ltd
Original Assignee
Chongqing Doyo Jono Industrial Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Doyo Jono Industrial Co ltd filed Critical Chongqing Doyo Jono Industrial Co ltd
Priority to CN201810314389.5A priority Critical patent/CN108555906B/en
Publication of CN108555906A publication Critical patent/CN108555906A/en
Application granted granted Critical
Publication of CN108555906B publication Critical patent/CN108555906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1656Programme controls characterised by programming, planning systems for manipulators
    • B25J9/1658Programme controls characterised by programming, planning systems for manipulators characterised by programming language

Abstract

The embodiment of the invention provides a control method and device of a robot and the robot, and relates to the technical field of robots. The robot comprises a main control chip and a motor. The motor is provided with an encoder and is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The method comprises the following steps: the processor determines the rotation direction of the motor based on a direction bit value in the second timer read at the current moment under the interrupt triggering of the first timer; acquiring a current detection pulse value and a last detection pulse value; acquiring the zero crossing point times of the motor in the rotating direction based on the overflow interruption times in the second timer read in the time period from the previous time to the current time; and acquiring the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to acquire the running distance of the robot. Eliminating errors and improving data accuracy.

Description

Robot control method and device and robot
Technical Field
The invention relates to the technical field of robots, in particular to a robot control method and device and a robot.
Background
At present, a large number of small intelligent robot driving motors are applied in the market, a direct current speed reducing motor is selected in the direction of saving cost and reducing the size, and the rotating angle of the motor is required to be known when the running distance is determined. The gearmotor with encoder is therefore the best choice. When a user using the motor tests the motor rotation pulse, the traditional mode is mainly adopted, and when a timer counter in the robot overflows, the pulse counting error or large data fluctuation is caused, so that the instability of the whole motion control system is caused.
Disclosure of Invention
The invention aims to provide a control method and a control device of a robot and the robot, so as to solve the problems. In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
in a first aspect, an embodiment of the present invention provides a robot control method, which is applied to a robot, where the robot includes a main control chip and a motor. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected with the processor through the encoder, the processor is electrically connected with the first timer and the second timer, and the method comprises the following steps: the processor determines the rotation direction of the motor based on the direction bit value in the second timer read at the current moment under the interrupt triggering of the first timer; the processor acquires a current detection pulse value in a counter of the second timer at the current moment and a last detection pulse value in a counter of the second timer at a previous moment before the current moment; the processor obtains the zero crossing point times of the motor in the rotation direction based on the overflow interruption times in the second timer read in the time period from the last time to the current time; and the processor obtains the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot.
In a second aspect, an embodiment of the present invention provides a control apparatus for a robot, where the control apparatus runs on a robot, and the robot includes a main control chip and a motor. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected with the processor through the encoder, the processor is electrically connected with the first timer and the second timer, and the device comprises: the device comprises a determining unit, a first acquiring unit, a second acquiring unit and a calculating unit. And the determining unit is used for determining the rotation direction of the motor based on the direction bit value read in the second timer at the current moment under the interrupt triggering of the first timer. A first obtaining unit, configured to obtain a current detection pulse value in a counter of the second timer at the current time and a last detection pulse value in a counter of the second timer at a previous time before the current time. A second obtaining unit, configured to obtain a zero-crossing point number of the motor in the rotation direction based on an overflow interruption number in the second timer read in a time period between the previous time and the current time. And the calculating unit is used for obtaining the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot.
In a third aspect, an embodiment of the present invention provides a robot, including a main control chip and a motor. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected with the processor through the encoder, and the processor is electrically connected with the first timer and the second timer. The main control chip comprises a memory, and the processor is electrically connected with the memory through a bus. The memory has program code stored therein. The processor is used for reading the program codes from the memory through the bus and running the program codes to execute the method.
The embodiment of the invention provides a robot control method and device and a robot. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected with the processor through the encoder, the processor is electrically connected with the first timer and the second timer, and the method comprises the following steps: the processor determines the rotation direction of the motor based on the direction bit value in the second timer read at the current moment under the interrupt triggering of the first timer; the processor acquires a current detection pulse value in a counter of the second timer at the current moment and a last detection pulse value in a counter of the second timer at a previous moment before the current moment; the processor obtains the zero crossing point times of the motor in the rotation direction based on the overflow interruption times in the second timer read in the time period from the last time to the current time; and the processor obtains the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot. The counting is carried out by adding the zero crossing point times, so that the problems of pulse counting errors or large data fluctuation caused by overflow of a timer counter when the motor runs towards one direction all the time are solved, the errors are eliminated, and the data accuracy is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a flowchart of a control method of a robot according to an embodiment of the present invention;
fig. 2 is a block diagram of a control device of a robot according to an embodiment of the present invention;
fig. 3 is a block diagram of another control device of a robot according to an embodiment of the present invention;
fig. 4 is a block diagram of a robot according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, an embodiment of the present invention provides a robot control method, which is applied to a robot, where the robot includes a main control chip and a motor. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected with the processor through the encoder, the processor is electrically connected with the first timer and the second timer, and the method comprises the following steps: step S100, step S110, step S120, and step S130.
Step S100: the processor determines the rotation direction of the motor based on the direction bit value in the second timer read at the current time under the interrupt triggering of the first timer.
Prior to step S100, the method may further comprise:
the processor controls the first timer and the second timer to both start an overflow interrupt, wherein the first timer is configured in a timing mode, and the second timer is configured in a timer orthogonal coding mode.
The processor is configured in a timer orthogonal coding mode so as to acquire a pulse signal of the motor rotation collected by the encoder and control the first timer and the second timer to start overflow interruption. And the processor reads the corresponding value in the second timer in an interrupt mode according to a preset frequency under the interrupt triggering of the first timer. In this embodiment, the first timer may be used for timing.
Step S100 may include:
the processor reads a direction bit value in a register in the second timer under the triggering of the interrupt of the first timer;
if the processor judges that the direction bit value is a first preset direction value, determining that the rotation direction of the motor is positive rotation;
and if the processor judges that the direction bit value is a second preset direction value, determining that the rotation direction of the motor is reverse.
In this embodiment, the first preset direction value may be 0, and the second preset direction value may be 1.
Step S110: and the processor acquires a current detection pulse value in a counter of the second timer at the current moment and a last detection pulse value in a counter of the second timer at a previous moment before the current moment.
Step S120: the processor obtains the zero-crossing point number of the motor in the rotation direction based on the overflow interruption number read in the second timer in the time period from the last time to the current time.
In the present embodiment, the overflow interruption count is equal to the zero-crossing count.
Taking the example of counting the number of pulses once in 30ms, the timing time of the first timer is 30ms, and the processor reads each value in the second timer every 30ms in the form of interrupt trigger of the first timer. The second timer overflow value is set to 390, for example, if the motor rotates forward all the time and two overflow interruptions are performed within 30ms, the zero-crossing times of the forward direction are performed twice, i.e. the zero-crossing times of the forward direction are 2.
Step S130: and the processor obtains the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot.
When the processor determines that the rotation direction of the motor is the forward rotation, step S130 may include:
and the processor subtracts the last detected pulse value from the current detected pulse value, and adds the product of the number of pulses generated by one rotation of the motor and the zero crossing point times, which is acquired in advance, to obtain the number of pulses generated by forward rotation of the motor in the time period so as to obtain the running distance of the robot.
Namely: the number of pulses generated by forward rotation of the motor in the time period is equal to the current detection pulse value-last detection pulse value + the number of pulses generated by one rotation of the motor multiplied by the zero crossing number.
The number of pulses generated by one rotation of the motor can be determined by the type of the motor. For example, the speed reduction ratio of the selected direct current speed reducing motor is 1:30, and the rotor of the selected motor is provided with a 13-wire strong magnetic code disc, so that the number of pulses required by one rotation of the motor shaft is as follows: and 13 × 30 is 390 pieces. Other models are available in the same way.
When the processor determines that the rotation direction of the motor is reverse, step S130 may include:
and after subtracting the last detected pulse value from the current detected pulse value, the processor subtracts the product of the number of pulses generated by one rotation of the motor and the zero crossing point times, which is acquired in advance, to obtain the number of pulses generated by reverse rotation of the motor in the time period, so as to acquire the running distance of the robot.
Namely: the number of pulses generated by the motor in the reverse rotation within the time period is equal to the current detection pulse value-the last detection pulse value-the number of generated pulses of the motor in one rotation multiplied by the zero crossing point number.
The embodiment of the invention provides a control method of a robot, which is applied to the robot. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected with the processor through the encoder, the processor is electrically connected with the first timer and the second timer, and the method comprises the following steps: the processor determines the rotation direction of the motor based on the direction bit value in the second timer read at the current moment under the interrupt triggering of the first timer; the processor acquires a current detection pulse value in a counter of the second timer at the current moment and a last detection pulse value in a counter of the second timer at a previous moment before the current moment; the processor obtains the zero crossing point times of the motor in the rotation direction based on the overflow interruption times in the second timer read in the time period from the last time to the current time; and the processor obtains the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot. The counting is carried out by adding the zero crossing point times, so that the problems of pulse counting errors or large data fluctuation caused by overflow of a timer counter when the motor runs towards one direction all the time are solved, the errors are eliminated, and the data accuracy is improved.
Referring to fig. 2, an embodiment of the present invention provides a control apparatus 200 for a robot, which operates in the robot, and the robot includes a main control chip and a motor. The motor is provided with an encoder, and the motor is connected with the main control chip through the encoder. The main control chip comprises a processor, a first timer and a second timer. The motor is electrically connected to the processor through the encoder, the processor is electrically connected to the first timer and the second timer, and the apparatus 200 includes: a determination unit 210, a first acquisition unit 220, a second acquisition unit 230, and a calculation unit 240.
A determining unit 210, configured to determine a rotation direction of the motor based on a direction bit value in the second timer read at the current time under the interrupt trigger of the first timer.
The apparatus 200 may further comprise: a configuration unit 201.
A configuration unit 201, configured to control both the first timer and the second timer to start an overflow interrupt, where the first timer is configured in a timing mode, and the second timer is configured in a timer orthogonal coding mode.
The determining unit 210 may include: a reading subunit 211 and a judging subunit 212.
A reading subunit 211, configured to read, under the trigger of the interrupt of the first timer, a direction bit value in one register of the second timer.
A determining subunit 212, configured to determine that the rotation direction of the motor is forward rotation if the direction bit value is determined to be a first preset direction value; and if the direction bit value is judged to be a second preset direction value, determining that the rotation direction of the motor is reverse.
A first obtaining unit 220, configured to obtain a current detected pulse value in a counter of the second timer at the current time and a last detected pulse value in a counter of the second timer at a previous time before the current time.
A second obtaining unit 230, configured to obtain a zero-crossing point number of the motor in the rotation direction based on the number of overflow interrupts in the second timer read in the time period between the last time and the current time.
A calculating unit 240, configured to obtain the number of pulses generated in the time period of the motor based on the current detected pulse value, the last detected pulse value, and the zero-crossing times, so as to obtain a running distance of the robot.
The calculation unit 240 may comprise a first calculation subunit 241.
The first calculating subunit 241 is configured to subtract the last detected pulse value from the current detected pulse value, and add a product of a number of pulses generated by one rotation of the motor and the zero-crossing frequency, which is obtained in advance, to obtain a number of pulses generated by forward rotation of the motor in the time period, so as to obtain the running distance of the robot.
Referring to fig. 3, the calculating unit 240 may further include a second calculating subunit 242.
And a second calculating subunit 242, configured to subtract the last detected pulse value from the current detected pulse value, and then subtract a product of a pre-obtained number of pulses generated by one rotation of the motor and the zero-crossing number, to obtain a number of pulses generated by reverse rotation of the motor in the time period, so as to obtain a running distance of the robot.
The above units may be implemented by software codes, and in this case, the above units may be stored in the memory of the main control chip. The above units may also be implemented by hardware, for example, an integrated circuit chip.
The control device 200 of the robot according to the embodiment of the present invention has the same implementation principle and the same technical effects as those of the foregoing method embodiments, and for the sake of brief description, no mention is made in the device embodiments, and reference may be made to the corresponding contents in the foregoing method embodiments.
Referring to fig. 4, an embodiment of the invention provides a robot 300, which includes a main control chip 310 and a motor 320. The motor 320 is provided with an encoder 321, and the motor 320 is connected with the main control chip 310 through the encoder 321. The main control chip 310 includes a processor 311, a first timer 312, and a second timer 313. The motor 320 is electrically connected to the processor 311 through the encoder 321, and the processor 311 is electrically connected to the first timer 312 and the second timer 313. The main control chip 310 includes a memory 314, and the processor 311 and the memory 314 are electrically connected through a bus. The memory 314 has program code stored therein. The processor 311 is configured to read and execute the program code from the memory 314 through the bus, and perform the above-mentioned method.
The memory 314 may store various software programs and modules, such as program instructions/modules corresponding to the robot control method and apparatus provided in the embodiments of the present application. The processor 106 executes various functional applications and data processing by executing software programs and modules stored in the memory 314, that is, implements the control method of the robot in the embodiment of the present application.
The Memory 314 may include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read Only Memory (PROM), Erasable Read Only Memory (EPROM), electrically Erasable Read Only Memory (EEPROM), and the like.
The processor 311 may be an integrated circuit chip having signal processing capabilities. The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. Which may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be appreciated that the configuration shown in fig. 4 is merely illustrative and that the robot 300 may include more or fewer components than shown in fig. 4, or have a different configuration than shown in fig. 4. The components shown in fig. 4 may be implemented in hardware, software, or a combination thereof.
The robot 300 according to the embodiment of the present invention has the same implementation principle and technical effects as those of the foregoing method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the foregoing method embodiments for the parts of the embodiment without reference.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. The control method of the robot is characterized in that the control method is applied to the robot, the robot comprises a main control chip and a motor, an encoder is arranged on the motor, the motor is connected with the main control chip through the encoder, the main control chip comprises a processor, a first timer and a second timer, the motor is electrically connected with the processor through the encoder, the processor is electrically connected with the first timer and the second timer, and the method comprises the following steps:
the processor determines the rotation direction of the motor based on the direction bit value in the second timer read at the current moment under the interrupt triggering of the first timer; the first timer and the second timer both open overflow interruption;
the processor acquires a current detection pulse value in a counter of the second timer at the current moment and a last detection pulse value in a counter of the second timer at a previous moment before the current moment;
the processor obtains the zero crossing point times of the motor in the rotation direction based on the overflow interruption times in the second timer read in the time period from the last time to the current time;
and the processor obtains the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot.
2. The method according to claim 1, before the processor obtains the rotation direction of the motor based on the direction bit value in the second timer read at the current time under the interrupt trigger of the first timer, the method further comprising:
the processor controls the first timer and the second timer to both start an overflow interrupt, wherein the first timer is configured in a timing mode, and the second timer is configured in a timer orthogonal coding mode.
3. The method of claim 1, wherein the processor determines the rotation direction of the motor based on the direction bit value read in the second timer at the current time under the interrupt trigger of the first timer, comprising:
the processor reads a direction bit value in a register in the second timer under the triggering of the interrupt of the first timer;
if the processor judges that the direction bit value is a first preset direction value, determining that the rotation direction of the motor is positive rotation;
and if the processor judges that the direction bit value is a second preset direction value, determining that the rotation direction of the motor is reverse.
4. The method according to claim 3, wherein when the processor determines that the rotation direction of the motor is the forward rotation, the processor obtains the number of pulses generated in the time period of the motor based on the current detected pulse value, the last detected pulse value and the zero-crossing times to obtain the running distance of the robot, and comprises:
and the processor subtracts the last detected pulse value from the current detected pulse value, and adds the product of the number of pulses generated by one rotation of the motor and the zero crossing point times, which is acquired in advance, to obtain the number of pulses generated by forward rotation of the motor in the time period so as to obtain the running distance of the robot.
5. The method according to claim 3, wherein when the processor determines that the rotation direction of the motor is reverse, the processor obtains the number of pulses generated in the time period of the motor based on the current detected pulse value, the last detected pulse value and the zero-crossing number to obtain the running distance of the robot, comprising:
and after subtracting the last detected pulse value from the current detected pulse value, the processor subtracts the product of the number of pulses generated by one rotation of the motor and the zero crossing point times, which is acquired in advance, to obtain the number of pulses generated by reverse rotation of the motor in the time period, so as to acquire the running distance of the robot.
6. The utility model provides a controlling means of robot, its characterized in that, operates in the robot, the robot includes main control chip and motor, be provided with the encoder on the motor, the motor passes through the encoder with main control chip connects, main control chip includes treater, first timer and second timer, the motor passes through the encoder with the treater electricity is connected, the treater with first timer with the second timer electricity is connected, the device includes:
a determination unit, configured to determine a rotation direction of the motor based on a direction bit value in the second timer read at a current time under the interrupt trigger of the first timer; the first timer and the second timer both open overflow interruption;
a first obtaining unit, configured to obtain a current detection pulse value in a counter of the second timer at the current time and a last detection pulse value in a counter of the second timer at a previous time before the current time;
a second obtaining unit, configured to obtain a zero-crossing point number of the motor in the rotation direction based on an overflow interruption number in the second timer read in a time period between the previous time and the current time;
and the calculating unit is used for obtaining the number of pulses generated in the time period of the motor based on the current detection pulse value, the last detection pulse value and the zero crossing point times so as to obtain the running distance of the robot.
7. The apparatus of claim 6, further comprising:
and the configuration unit is used for controlling the first timer and the second timer to both start overflow interruption, wherein the first timer is configured to be in a timing mode, and the second timer is configured to be in a timer orthogonal coding mode.
8. The apparatus of claim 6, wherein the determining unit comprises:
a reading subunit, configured to read a direction bit value in one register of the second timer under the trigger of the interrupt of the first timer;
the judging subunit is used for determining that the rotation direction of the motor is positive rotation if the direction bit value is judged to be a first preset direction value; and if the direction bit value is judged to be a second preset direction value, determining that the rotation direction of the motor is reverse.
9. The apparatus of claim 8, wherein the computing unit comprises:
and the first calculating subunit is configured to subtract the last detected pulse value from the current detected pulse value, and add a product of a number of pulses generated by one rotation of the motor and the zero-crossing frequency, which is obtained in advance, to obtain a number of pulses generated by forward rotation of the motor in the time period, so as to obtain the running distance of the robot.
10. A robot is characterized by comprising a main control chip and a motor, wherein an encoder is arranged on the motor, the motor is connected with the main control chip through the encoder, the main control chip comprises a processor, a first timer and a second timer, the motor is electrically connected with the processor through the encoder, and the processor is electrically connected with the first timer and the second timer; the main control chip comprises a memory, and the processor is electrically connected with the memory through a bus; the memory has program code stored therein; the processor, which is used to read and run the program code from the memory through the bus, executes the method of any one of claims 1-5.
CN201810314389.5A 2018-04-09 2018-04-09 Robot control method and device and robot Active CN108555906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810314389.5A CN108555906B (en) 2018-04-09 2018-04-09 Robot control method and device and robot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810314389.5A CN108555906B (en) 2018-04-09 2018-04-09 Robot control method and device and robot

Publications (2)

Publication Number Publication Date
CN108555906A CN108555906A (en) 2018-09-21
CN108555906B true CN108555906B (en) 2021-03-23

Family

ID=63534410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810314389.5A Active CN108555906B (en) 2018-04-09 2018-04-09 Robot control method and device and robot

Country Status (1)

Country Link
CN (1) CN108555906B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110834334B (en) * 2019-11-20 2023-11-07 常州捷佳创精密机械有限公司 Control method and device of manipulator and treatment tank equipment
CN113686363B (en) * 2021-08-25 2023-11-07 武汉珞珈伊云光电技术有限公司 Encoder-based measurement method, system, electronic device and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5943676B2 (en) * 2012-03-30 2016-07-05 株式会社デンソーウェーブ Robot control system and encoder system
CN104330581A (en) * 2014-10-23 2015-02-04 李东升 Motor rotation speed measuring system and measuring method
CN206379903U (en) * 2016-12-03 2017-08-04 中国电子科技集团公司第四十三研究所 A kind of motor without position sensor velocity checking circuits
CN106645786B (en) * 2016-12-31 2019-11-15 深圳市优必选科技有限公司 Permanent magnet synchronous motor speed detection method and device
CN106645784A (en) * 2017-01-16 2017-05-10 哈尔滨理工大学 Method and circuit for measuring rotating speed of rotary machine
CN107133192A (en) * 2017-05-11 2017-09-05 北方电子研究院安徽有限公司 High speed loader and pulse counter circuit in a kind of SoC systems

Also Published As

Publication number Publication date
CN108555906A (en) 2018-09-21

Similar Documents

Publication Publication Date Title
CN108555906B (en) Robot control method and device and robot
JP7354160B2 (en) Encoder signal sampling method and device
US10451647B2 (en) Method and device for measuring speed of permanent magnet synchronous motor
CN107566726B (en) A kind of method and device correcting rotating camera rotation angle
KR20040068971A (en) High accuracy method for determining the frequency of a pulse input signal over a wide frequency range
US6300884B1 (en) Method for decoding a quadrature encoded signal
CN107193824B (en) Abnormal data detection method and device
US11360113B2 (en) Method for measuring the speed of rotation of an aircraft engine shaft, taking into account the measurement noise
JPH04344466A (en) Detecting device for velocity of elevator
WO1982004129A1 (en) Speed detecting device
CN109905059B (en) Sensorless direct current brushless motor control method and device
CN110799807B (en) Orthogonal encoder signal filtering method, device and system
US6310458B1 (en) Blended velocity estimation
CN110568212A (en) encoder speed measurement method, device, equipment and medium
JP2006300699A (en) Speed detector, and abnormal speed detecting method therefor
CN111913805B (en) CPU utilization rate calculation method and device
JP2002311040A (en) Speed detector
KR19990043005A (en) Motor speed detection device using incremental encoder
JPH0592814U (en) Detector
JPH11160338A (en) Instrument and method for measuring pulse width for detecting rotation
JPS5873872A (en) Digital method for detecting velocity
BR0205515A (en) Process for determining the rotary position of the drive shaft of a direct current switched motor
SU681428A1 (en) Device for selecting minimum number
JPH11326356A (en) Speed operation apparatus
JPH07142971A (en) Noise eliminating device and period measuring unit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant