Control method and device of stepper motor, robot, equipment and medium
By switching some pulse sub-cycles within the pulse cycle of a stepper motor to a low-energy-consumption pulse signal, the problems of high energy consumption and insufficient control precision are solved, achieving reduced energy consumption and improved control precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING ROBOROCK INNOVATION TECH CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-06-26
Smart Images

Figure CN122292955A_ABST
Abstract
Description
Technical Field
[0001] This application relates to motor control technology, and more particularly to a control method, device, robot, equipment and medium for a stepper motor. Background Technology
[0002] A stepper motor is an electric motor whose rotation angle and speed are controlled by pulse signals. Its control logic usually uses pulse signals with a fixed period to drive the stepper motor, that is, it maintains the same driving state throughout the entire pulse cycle. However, it is always driven by the drive signal corresponding to the high energy consumption state, which leads to the problem of high control energy consumption. Summary of the Invention
[0003] In view of this, embodiments of this application provide a stepper motor control method, apparatus, robot, device, and medium.
[0004] The technical solution of this application embodiment is implemented as follows: This application provides a stepper motor control method, the method including: Obtain the first drive pulse signal of the stepper motor in the current pulse cycle; the current pulse cycle includes multiple pulse sub-cycles, and the first drive pulse signal maintains the first pulse state in the multiple pulse sub-cycles. The first pulse state is used to drive the stepper motor to rotate. The first driving pulse signal is switched from the first pulse state to the second pulse state in at least one pulse sub-cycle to generate the second driving pulse signal corresponding to the current pulse cycle; the second pulse state is used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state is less than the energy consumption in the first pulse state. Send a second drive pulse signal to the stepper motor.
[0005] In some embodiments, switching the first driving pulse signal from a first pulse state to a second pulse state during at least one pulse sub-cycle to generate a second driving pulse signal corresponding to the current pulse cycle includes: Based on the state switching parameters, at least one target pulse sub-cycle in the current pulse cycle is determined; The first driving pulse signal is switched from the first pulse state to the second pulse state in at least one target pulse sub-cycle to generate the second driving pulse signal corresponding to the current pulse cycle.
[0006] In some embodiments, the state switching parameters include a target ratio, which represents the proportion of the target pulse sub-cycle in the current pulse cycle; Based on the state switching parameters, determine at least one target pulse sub-period in the current pulse period, including: Based on the target ratio and the first number of pulse sub-cycles in the current pulse period, determine the second number of target pulse sub-cycles in the current pulse period; Determine the second number of target pulse sub-cycles from the current pulse cycle.
[0007] In some embodiments, the state switching parameter includes the target holding duration, which characterizes the duration of the first pulse state in the current pulse period; Based on the state switching parameters, determine at least one target pulse sub-period in the current pulse period, including: Based on the target holding duration, determine the third number of target pulse sub-cycles in the current pulse cycle; Determine the third number of target pulse sub-cycles from the current pulse cycle.
[0008] In some embodiments, a stepper motor is used to drive a target component of the robot to move; the method further includes: In response to receiving a stop movement command, a third drive pulse signal is sent to the stepper motor, and the current state of the stepper motor is set to the stop state; the third drive pulse signal maintains the state of the second pulse. Obtain the first drive pulse signal of the stepper motor in the current pulse cycle, including: If the current state of the stepper motor is not a stopped state, acquire the first drive pulse signal of the stepper motor in the current pulse cycle.
[0009] In some embodiments, the method further includes: When the stepper motor is currently in a stopped state, a third drive pulse signal is sent to the stepper motor, and the acquisition of the first drive pulse signal of the stepper motor in the current pulse cycle is stopped.
[0010] In some embodiments, a stepper motor is used to drive a target component of the robot to move; the method further includes: In response to receiving a target movement command, the pulse count value of the stepper motor is set to a preset value; Sending a second drive pulse signal to the stepper motor, including: If the pulse count value does not exceed the target count range, a second drive pulse signal is sent to the stepper motor, and the pulse count value is updated; the target count range is determined according to the target movement command.
[0011] In some embodiments, a stepper motor is used to drive the target component of the robot to move; Obtain the first drive pulse signal of the stepper motor in the current pulse cycle, including: Based on the target position corresponding to the currently received target movement command and the current position of the target component, a first drive pulse signal is generated; The method also includes: If the target component is not detected to have reached the target position within a preset time after receiving the target movement command, the sending of the second pulse signal to the target motor will be stopped.
[0012] In some embodiments, the signal period of the second drive pulse signal is different from the inherent vibration period of the stepper motor.
[0013] In some embodiments, the method further includes: In response to a hardware interrupt event, obtain the data reporting task corresponding to the hardware interrupt event; Generate corresponding message events based on the data reporting task; Send message events to the message queue so that the main processor can read from the message queue and respond to the message events.
[0014] This application provides a stepper motor control device, including:
[0015] The acquisition module is used to acquire the first drive pulse signal of the stepper motor in the current pulse cycle; the current pulse cycle includes multiple pulse sub-cycles, and the first drive pulse signal maintains a first pulse state in the multiple pulse sub-cycles, and the first pulse state is used to drive the stepper motor to rotate; The switching module is used to switch the first driving pulse signal from the first pulse state to the second pulse state in at least one pulse sub-cycle, and generate the second driving pulse signal corresponding to the current pulse cycle; the second pulse state is used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state is less than the energy consumption in the first pulse state. The transmitting module is used to send a second drive pulse signal to the stepper motor.
[0016] This application provides a robot, including: The machine body, stepper motor, target components that can be driven to move based on the stepper motor, and controller; The controller is used to implement the methods provided in the embodiments of this application.
[0017] This application provides a computer device, the computer device comprising: Memory is used to store executable instructions or computer programs. The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the method provided in the embodiments of this application.
[0018] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the method provided in this application when executed by a processor.
[0019] This application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implement the method provided in this application.
[0020] The embodiments of this application have the following beneficial effects: In this embodiment, when sending a pulse signal for driving the stepper motor, the first pulse signal, which has been in a first pulse state, is switched. That is, the signal is switched from a high-energy-consumption first pulse state to a low-energy-consumption second pulse state in at least one pulse sub-cycle. This avoids the stepper motor from rotating in a high-energy-consumption state for a long time. On the one hand, by switching the signal state of the driving signal to the signal state corresponding to the low-energy-consumption state in part of the pulse sub-cycle, the overall energy consumption during motor operation is effectively reduced, and the problem of temperature spikes is avoided. On the other hand, without changing the overall pulse cycle length, precise control of the stepper motor is achieved, and the control accuracy is improved.
[0021] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this application. Attached Figure Description
[0022] Figure 1 A schematic diagram of the implementation process of a stepper motor control method provided in this application embodiment. Figure 1 ; Figure 2 This is a signal timing diagram of the first driving pulse signal corresponding to the current pulse period provided in the embodiments of this application; Figure 3 A schematic diagram of the implementation process of a stepper motor control method provided in this application embodiment. Figure 2 ; Figure 4 This is a schematic diagram of the pulse signal timing during the uniform velocity phase provided in an embodiment of this application; Figure 5 This is a schematic diagram of the pulse signal timing during the acceleration phase provided in an embodiment of this application; Figure 6 This is a schematic diagram of the mop telescopic lifting mechanism provided in an embodiment of this application; Figure 7 This is a schematic diagram of the composition structure of a stepper motor control device provided in an embodiment of this application; Figure 8 A schematic diagram of the composition structure of a robot provided in an embodiment of this application; Figure 9 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application.
[0023] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish between different options and do not represent the degree of superiority or inferiority of the options or their priority in the implementation process. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0026] It should be noted that the terms "first, second, and third" used in the embodiments of this application are merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0027] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which the embodiments of this application pertain. It should also be understood that terms such as those defined in general dictionaries should be understood to have a meaning consistent with their meaning in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0028] A stepper motor is an electric motor whose rotation angle and speed are controlled by pulse signals. It is widely used in automated equipment requiring high positioning accuracy, such as industrial robots, 3D printers, and home robots. Its operation relies on drive pulse signals output by an external controller. By adjusting the pulse frequency and duty cycle, the motor's speed and torque are controlled. In practical applications, optimizing the drive signal to improve efficiency and reduce energy consumption is a continuously evolving technical challenge in this field.
[0029] In related technologies, stepper motors are typically driven by pulse signals with a fixed period, meaning that the same driving state is maintained throughout the entire pulse cycle. For example, in a complete pulse cycle, because the state of the driving signal remains unchanged, the motor will always be in a high-energy-consuming rotational state.
[0030] While such solutions are simple in structure and easy to implement, continuous high-energy-consumption operation will not only significantly affect overall performance and lifespan, but also pose safety hazards due to temperature spikes.
[0031] In view of this, embodiments of this application provide a stepper motor control scheme, which includes at least a stepper motor control method, device, robot, equipment, and medium. The stepper motor control method includes: acquiring a first drive pulse signal of the stepper motor in the current pulse cycle; then, switching the first drive pulse signal from a first pulse state to a second pulse state in at least one pulse sub-cycle to generate a second drive pulse signal corresponding to the current pulse cycle, and sending the second drive pulse signal to the stepper motor; wherein the current pulse cycle includes multiple pulse sub-cycles, and the first drive pulse signal maintains a first pulse state in the multiple pulse sub-cycles, the first pulse state being used to drive the stepper motor to rotate; the second pulse state being used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state being less than the energy consumption in the first pulse state.
[0032] In this embodiment, when sending a pulse signal for driving the stepper motor, the first pulse signal, which has been in a first pulse state, is switched. That is, the signal is switched from a high-energy-consumption first pulse state to a low-energy-consumption second pulse state in at least one pulse sub-cycle. This avoids the stepper motor from rotating in a high-energy-consumption state for a long time. On the one hand, by switching the signal state of the driving signal to the signal state corresponding to the low-energy-consumption state in part of the pulse sub-cycle, the overall energy consumption during motor operation is effectively reduced, and the problem of temperature spikes is avoided. On the other hand, without changing the overall pulse cycle length, precise control of the stepper motor is achieved, and the control accuracy is improved.
[0033] This application provides a stepper motor control method. This method can be applied to a computer device, which may be a device with independent processing capabilities. The computer device can interact with the stepper motor and control its operation by sending signals. In this application, the computer device may be, but is not limited to, a controller, a main control chip, etc. The computer device can be deployed in any machine device based on stepper motor operation. This machine device may be, but is not limited to, a robot. It is understood that the robot can be a fixed-position robot or a mobile robot; a mobile robot refers to a robot that can move autonomously. For example, the robot may include, but is not limited to, at least one of cleaning robots (such as sweeping robots, floor scrubbers, mopping robots, and combined washing and mopping robots), guiding robots, and service robots.
[0034] Figure 1 A schematic diagram of the implementation process of a stepper motor control method provided in this application embodiment. Figure 1,like Figure 1 As shown, the method includes the following steps S101 to S103: Step S101: Obtain the first drive pulse signal of the stepper motor in the current pulse cycle.
[0035] The current pulse cycle includes multiple pulse sub-cycles. During these multiple pulse sub-cycles, the first drive pulse signal maintains a first pulse state, which is used to drive the stepper motor to rotate.
[0036] Here, the pulse period can refer to, but is not limited to, a complete time period used to control the rotation of the stepper motor during the driving process. This time period contains multiple pulse sub-cycles, each corresponding to the timing of the output of a drive signal. Correspondingly, the pulse sub-cycle can refer to, but is not limited to, the basic unit time segment that constitutes the pulse period. During this time period, the drive signal remains in a constant state (such as high level or low level), thereby determining whether the motor rotates.
[0037] In some implementations, the computer device can generate a signal for driving the stepper motor to operate, i.e., a first drive pulse signal, for each pulse cycle based on the received drive command. Here, the drive command may be, but is not limited to, used to instruct the movement of a corresponding component via the stepper motor. The drive command may at least include the direction of movement, the speed of movement, etc. Based on the drive command, a first pulse signal can be generated. It is understood that the signal state of the first pulse signal, the first pulse state, can be used to drive the stepper motor to rotate. That is, the first pulse state may be, but is not limited to, used to characterize that the level of the first pulse signal is not low. The first drive pulse signal with the signal state of the first pulse state can drive the stepper motor to rotate.
[0038] In some implementations, the computer device may receive a first drive pulse signal sent by an external device. It is understood that the external device may be used to generate the first drive pulse signal according to the received drive instruction.
[0039] In some implementations, the specific timing diagram of the first driving pulse signal corresponding to the current pulse period can be referred to... Figure 2 . Figure 2 A timing diagram of a first driving pulse signal is provided for an embodiment of this application.
[0040] Reference Figure 2 Each pulse cycle is 1 second, and each pulse cycle can contain 5 sub-pulse cycles, that is, every 0.2 seconds is a sub-pulse cycle. The driving pulse signal for each pulse cycle can be different.
[0041] exist Figure 2In the diagram, the signal states corresponding to the drive pulse signals of each pulse cycle are sta1, sta2, sta3, and sta4, respectively. It can be understood that the pulse states can be, but are not limited to, set based on different rotation direction angles or different operating states (such as component movement speed or operating stage).
[0042] In some examples, taking the current stepper motor as a two-wire four-phase stepper motor, the control sequences corresponding to sta1, sta2, sta3, and sta4 can be, but are not limited to, 1010, 0110, 0101, and 1001, respectively. The control sequence here represents the energization state of different control terminals corresponding to each coil in the stepper motor. For example, the first two digits correspond to the positive and negative control terminals of coil A, and the last two digits correspond to the positive and negative control terminals of coil B. 1 represents that the control terminal is turned on, and 0 represents that it is not turned on.
[0043] Based on the control sequence corresponding to each signal state, driving pulse signals for different states can be generated.
[0044] Step S102: The first driving pulse signal is switched from the first pulse state to the second pulse state in at least one pulse sub-cycle to generate the second driving pulse signal corresponding to the current pulse cycle.
[0045] The second pulse state is used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state is less than that in the first pulse state.
[0046] It is understandable that the first drive pulse signal corresponding to the first pulse state will drive the stepper motor to keep running in a rotating state throughout the current pulse cycle. This will cause the stepper motor to continuously heat up, which will not only affect the life and performance of the stepper motor itself, but also pose certain safety risks. Therefore, in this embodiment, it is necessary to switch the state of the first drive pulse signal that is always in the first pulse state throughout the current pulse cycle in order to avoid the stepper motor from keeping rotating.
[0047] In some implementations, a second pulse state is set. Here, the second pulse state may refer to, but is not limited to, the drive pulse signal being in an inactive state to stop the rotation of the stepper motor. It can be understood that the drive pulse signal corresponding to the second pulse state can put the stepper motor in a standby state, that is, stop rotating. At this time, the energy consumption of the stepper motor is less than that in the first pulse state.
[0048] In some implementations, to avoid the stepper motor from continuously maintaining the high-energy-consumption state corresponding to the first pulse state, the signal state of at least one pulse sub-cycle in the current pulse cycle can be switched to the low-energy-consumption second pulse state.
[0049] Regarding the switching method, in some implementations, an appropriate switching ratio can be set based on the number of pulse sub-cycles in the current pulse period, so that the signal state switches from the first pulse state to the second pulse state within at least one pulse sub-cycle. It is understood that this switching ratio can be an empirical value.
[0050] In some examples, such as when the current pulse period is 1 second, the pulse sub-period is 0.1 seconds, and the switching ratio is set to 8:2, two pulse sub-periods can be randomly selected to switch the signal state from the first pulse state to the second pulse state.
[0051] In some implementations, at least one designated target pulse sub-cycle can be determined from each pulse sub-cycle, and in the target pulse sub-cycle, the signal state can be switched from a first pulse state to a second pulse state.
[0052] In some examples, the last pulse sub-cycle in the current pulse cycle can be directly specified as the target pulse sub-cycle, and in the target pulse sub-cycle, the signal state can be switched from the first pulse state to the second pulse state.
[0053] It is understandable that by switching the signal state corresponding to a portion of the pulse sub-cycles in the current pulse cycle from the first pulse state to the second pulse state, a second driving pulse signal different from the first driving pulse signal can be generated. Here, the second driving pulse signal is a signal sequence after the signal state is switched based on the original first driving pulse signal. By driving the stepper motor through the second driving pulse signal, it can be avoided that it maintains a high energy consumption state for a long time, reducing the risk of temperature spikes.
[0054] It is understandable that during the operation of a stepper motor, its internal components will also have different vibration cycles. In order to avoid power loss and high-frequency noise caused by resonance between the pulse signal and the motor, the signal period of the second drive pulse signal needs to be set in this embodiment.
[0055] In some implementations, the signal period of the second drive pulse signal is different from the natural vibration period of the stepper motor.
[0056] For example, for a certain model of stepper motor, if the free vibration period corresponding to different internal components is 5 milliseconds, then a signal period that is far from 5 milliseconds can be selected as the signal period of the second drive pulse signal, such as 4.8 milliseconds or 5.2 milliseconds.
[0057] In this way, by setting the signal period of the second drive pulse signal to be different from the inherent vibration period of the stepper motor, the motor resonance phenomenon can be avoided and the stability of the stepper motor operation can be improved.
[0058] Step S103: Send a second drive pulse signal to the stepper motor.
[0059] In some implementations, the generated second drive pulse signal is sent to the stepper motor, which can drive the stepper motor to run based on the second drive pulse signal.
[0060] In some implementations, there is a communication connection between the computer device and the stepper motor, which can send a second drive pulse signal to the stepper motor so that the stepper motor operates in a high-energy-consumption state corresponding to the first pulse state in part of the pulse sub-cycle according to the second drive pulse signal, and then operates in a low-energy-consumption state corresponding to the second pulse state in other pulse sub-cycles.
[0061] It is understandable that the transmission method may, but is not limited to, transmitting the generated second drive pulse signal to the stepper motor's drive circuit through a preset communication interface. During transmission, signal integrity, timing accuracy, and anti-interference capability are all critical factors. To ensure the reliability of signal transmission, high-speed digital signal transmission technology can be employed when transmitting the second drive pulse signal, along with appropriate filtering and error correction mechanisms to address potential noise and interference issues.
[0062] In the above embodiments, when sending a pulse signal for driving the stepper motor, the first pulse signal, which has been in a first pulse state, is switched. That is, the signal is switched from a high-energy-consumption first pulse state to a low-energy-consumption second pulse state in at least one pulse sub-cycle. This avoids the stepper motor from rotating in a high-energy-consumption state for a long time. On the one hand, by switching the signal state of the driving signal to the signal state corresponding to the low-energy-consumption state in part of the pulse sub-cycle, the overall energy consumption during motor operation is effectively reduced, and the problem of temperature spikes is avoided. On the other hand, without changing the overall pulse cycle length, precise control of the stepper motor is achieved, and the control accuracy is improved.
[0063] In some implementations, a stepper motor can be used to move a target component that drives a person. Based on this, the process of "acquiring the first drive pulse signal of the stepper motor in the current pulse cycle" in step S101 above may include: Based on the target position corresponding to the currently received target movement command and the current position of the target component, a first drive pulse signal is generated.
[0064] Based on this step, it can be determined that the method provided in the embodiments of this application may further include: if no target component is detected to have reached the target position within a preset time after receiving the target movement command, stopping the sending of the second drive pulse signal to the target motor.
[0065] In some implementations, a stepper motor is a motor that converts electrical pulse signals into angular or linear displacement. When applied to a robot's operating system, it can drive the movement of specific target components. For example, when the robot is a sweeping robot, the target component can be the sweeping mop module. The movement operation can be divided into extension or lifting operations.
[0066] In this embodiment, the target component typically needs to switch between multiple fixed positions, which may include, but are not limited to, extending into position, retracting into position, raising into position, and lowering into position. In this embodiment, the stepper motor receives pulse signals from the controller and rotates according to a predetermined step distance, thereby driving the mechanical structure to complete the required extension or lifting / lowering actions. Compared to brushless or brushed motors, stepper motors have higher positioning accuracy, making them particularly suitable for applications requiring precise position control.
[0067] In some implementations, when the robot needs to move a target component deployed on it, the computer device can receive a target movement instruction, which can be used to instruct the target component to be moved to a target location.
[0068] In this embodiment of the application, the computer device needs to first detect the current position of the target component to determine the relationship between the current position and the target position, thereby calculating the movement data such as the movement direction and speed of the target component. Based on this movement data, a first driving pulse signal can be generated.
[0069] It is understood that the first drive pulse signal will be modified through the above step S202 to obtain the second drive pulse signal, and the second drive pulse signal will be sent to the stepper motor to drive it to run, thereby moving the target component to the target position.
[0070] In some implementations, the target component can be periodically detected to determine whether it has reached the target position, and the movement time can be timed. In this embodiment, if the movement time exceeds a preset duration, i.e., if the target component has not reached the target position within the preset duration, an abnormal situation can be identified. This abnormal situation may be due to motor stall or mechanical jamming of the target component. In this case, continuing to send the second drive pulse signal to the stepper motor for an extended period will result in unnecessary energy waste and cause a temperature spike. Therefore, if the target component is not detected to have reached the target position within the preset duration, it is necessary to stop sending the second drive pulse signal to the target motor. Regarding the method of detecting whether a target component has reached the target position, in some implementations, a sensor (such as a light blocking sensor) is provided at the target position, and the target component can be detected based on the sensor to determine whether it has moved to the target position.
[0071] In some implementations, a mileage counter can be used to calculate whether the target component has reached the distance between the current location and the target location. If the distance has been reached, it is determined that the target component has reached the target location; otherwise, it is determined that the target component has not reached the target location.
[0072] In the above embodiments, the target component is continuously monitored to see if it reaches the designated position within a preset time. If it does not reach the designated position, a safety protection mechanism is triggered to stop the operation of the target motor, which can prevent damage to the motor hardware or waste of resources.
[0073] In this embodiment of the application, the control method for the stepper motor may further include the following steps: Step S104: In response to the hardware interrupt trigger event, obtain the data reporting task corresponding to the hardware interrupt trigger event.
[0074] Here, a hardware interrupt trigger event refers to an asynchronous signal generated by an external hardware device (such as a sensor, motor controller, etc.) to notify the system that a specific real-time event has occurred. Hardware interrupt trigger events are typically transmitted to the MCU (Microcontroller Unit) via a hardware interrupt line so that the system can respond quickly. For example, in a robotic vacuum cleaner, when the mop module's positioning light is interrupted, a hardware interrupt trigger event is immediately generated. This hardware interrupt trigger event prompts the system to perform corresponding action judgments or status updates.
[0075] When a hardware interrupt event occurs, the corresponding data needs to be reported, thus generating a data reporting task. This data reporting task can refer to, but is not limited to, a series of pending tasks generated based on the interrupt type and context after receiving a hardware interrupt event. These tasks include, but are not limited to, recording event timestamps, collecting relevant sensor data, updating system status, and generating logs. Each data reporting task contains explicit operation instructions and parameters to ensure that the computer device can accurately identify the source of the event and take appropriate action. For example, when a mop is detected to have retracted into place, a retraction completion task can be generated, along with the current mileage count and the arrival signal status.
[0076] Understandably, the data to be reported in a hardware interrupt event may exceed the set value, potentially extending task execution time, causing overall task cycle abnormalities, and resulting in abnormal serial communication data packets. In such cases, a watchdog timer needs to be invoked for a reset. However, this process presents two problems: First, after the computer device is reset and restarted by the watchdog timer, the corresponding machine may malfunction. For example, in the case of a robotic vacuum cleaner, the target components, such as the extension and retraction of the mop module, may exhibit abnormal behavior. Second, if the watchdog timer fails to reset properly, the motor's input / output interfaces will remain in the same state, causing both phases (the two control terminals of the coil) to remain in the same position, further leading to a surge in motor temperature.
[0077] Therefore, it is necessary to perform relevant processing on the data reporting task corresponding to the hardware interrupt trigger event.
[0078] Step S105: Generate corresponding message events based on the data reporting task.
[0079] Here, a message event refers to data that transforms a data reporting task into a standard format message object, which can be sent to a message queue for processing. Message events typically include fields such as event type, timestamp, raw data, and processing priority. For example, a completed task can be encapsulated as an event message with a timestamp and odometer value for subsequent parsing and response.
[0080] In some implementations, target data can be extracted from the data reporting task according to a preset data format, and the target data can be processed according to the data format to generate a message event corresponding to the data reporting task.
[0081] Step S106: Send the message event to the message queue so that the main processor can read from the message queue and respond to the message event.
[0082] Here, a message queue is a first-in-first-out data structure used to cache message events and have them consumed by the main processor when appropriate.
[0083] In some implementations, the main processor can retrieve message events from the message queue sequentially and execute corresponding processing logic based on the event type of the message event. For example, the main processor might adjust the drag position or update the user interface based on a retraction completion event.
[0084] In this embodiment of the application, the data reporting task corresponding to the hardware interrupt trigger event is converted into a corresponding message time and sent to the message queue, waiting for the processor to consume it when it is idle. This avoids the problem that the task execution time is extended and the overall task cycle is abnormal when the amount of data in the data reporting task exceeds the set value.
[0085] Figure 3 A schematic diagram of the implementation process of a stepper motor control method provided in this application embodiment. Figure 2 ,like Figure 3 As shown, the process of step S102 above, "switching the first driving pulse signal from the first pulse state to the second pulse state in at least one pulse sub-cycle, and generating the second driving pulse signal corresponding to the current pulse cycle", includes the following steps S301 and S302: Step S301: Based on the state switching parameters, determine at least one target pulse sub-cycle in the current pulse cycle.
[0086] Here, the state switching parameters can be, but are not limited to, control variables used to determine when to switch pulse states. These can include, but are not limited to, time thresholds, position information, velocity change rate, and target proportions. The target proportion can characterize the percentage of the target pulse sub-cycle within the current pulse cycle. In this embodiment, by setting the state switching parameters, the control system can identify the optimal switching timing, thereby achieving precise control of the drive pulse signal.
[0087] In some implementations, the state switching parameters may include an accurate switching position, based on which at least one specified target pulse sub-cycle can be determined from each pulse sub-cycle, and in the target pulse sub-cycle, the signal state is switched from the first pulse state to the second pulse state.
[0088] In some examples, the last pulse sub-period in the current pulse period can be directly specified as the target pulse sub-period, and in that target pulse sub-period, the signal state can be switched from the first pulse state to the second pulse state. In some implementations, the state switching parameters include a target ratio, which represents the proportion of the target pulse sub-cycle in the current pulse cycle. Based on this, the process of step S301, "determining at least one target pulse sub-cycle in the current pulse cycle based on the state switching parameters", may include: determining a second number of target pulse sub-cycles in the current pulse cycle based on the target ratio and a first number of pulse sub-cycles in the current pulse cycle; and determining the second number of target pulse sub-cycles from the current pulse cycle.
[0089] Here, the target ratio can be, but is not limited to, a parameter used to describe the motor control strategy, representing the proportion of a target pulse sub-cycle within a specific pulse cycle. In the embodiments of this application, the target ratio is typically expressed as a percentage or a decimal, ranging from 0 to 1. For example, when the target ratio is 0.4, it means that 40% of the pulse sub-cycles in the current pulse cycle are target pulse sub-cycles. It is understood that in the embodiments of this application, the target ratio can be dynamically adjusted according to actual application requirements to optimize motor operating efficiency, energy consumption, and response speed.
[0090] Here, the first quantity is the total number of pulse sub-cycles in the current pulse period. Based on the first quantity and the target ratio, the second quantity of target pulse sub-cycles can be determined. For example, when the target ratio is 0.4, and there are 10 pulse sub-cycles in the current pulse period, there are 4 pulse sub-cycles that are the target pulse sub-cycles. In the embodiments of this application, after determining the number of target pulse sub-cycles, the corresponding target pulse sub-cycles can be determined from each pulse sub-cycle.
[0091] In some implementations, a second number of pulse sub-cycles can be randomly selected as the target pulse sub-cycles. Each target pulse sub-cycle can be continuous or discontinuous.
[0092] In some implementations, the state switching parameters also include a switching position, which allows the selection of a second consecutive number of pulse sub-cycles after or before the switching position as the target pulse sub-cycle.
[0093] In the above embodiments, the target ratio determines the overall allocation tendency of the entire control strategy, while the first quantity limits the total amount of allocable resources, and the second quantity is the embodiment formed by the combination of the first two. In practical applications, considering and configuring the target ratio, the first quantity and the second quantity as a whole can ensure the optimization of the control effect.
[0094] In some implementations, the state switching parameters include a target holding duration, which characterizes the holding duration of the first pulse state in the current pulse period. Based on this, the process of step S301, "determining at least one target pulse sub-cycle in the current pulse period based on the state switching parameters", may include: determining a third number of target pulse sub-cycles in the current pulse period based on the target holding duration; and determining the third number of target pulse sub-cycles from the current pulse period.
[0095] Here, the target hold duration may refer to, but is not limited to, the duration during which the first pulse state (e.g., high level, on state, etc.) persists within the current pulse cycle. In the embodiments of this application, the target hold duration may be, but is not limited to, set according to the actual application scenario. For example, if it is necessary to maintain the stability of the stepper motor operation, then the target hold duration needs to be clearly defined so as to more accurately determine when to switch states and avoid errors or abnormal behavior caused by switching too early or too late.
[0096] In this embodiment of the application, based on the target holding duration, the number of pulse sub-cycles that the first pulse state must be maintained in the current pulse cycle can be determined, and the remaining number can be the third number of target pulse sub-cycles that switch to the second pulse state.
[0097] For example, when the target is held for 0.6 seconds, the current pulse period is 1 second, of which the pulse sub-periods are 0.1 seconds and the total number of pulse sub-periods is 10. It can be determined that the first pulse state must be held for 6 pulse sub-periods, and the number of the remaining 4 pulse sub-periods is the third number of the target pulse sub-periods.
[0098] In this embodiment of the application, after determining the third number of target pulse sub-cycles, the corresponding number of target pulse sub-cycles can be determined from the current pulse cycle.
[0099] In some implementations, a third number of pulse sub-cycles can be randomly selected as the target pulse sub-cycles. Each target pulse sub-cycle can be continuous or discontinuous.
[0100] In some implementations, the state switching parameters also include a switching position, which allows the selection of a third consecutive number of pulse sub-cycles after or before the switching position as the target pulse sub-cycle.
[0101] In this way, by introducing the target hold duration as part of the state switching parameter, and determining the number and distribution of the target pulse sub-cycles based on the target hold duration, the accuracy and controllability of pulse signal generation can be improved, and the stepper motor can be ensured to operate in the running state corresponding to the first pulse state according to the preset hold duration, thereby improving the stability of stepper motor operation.
[0102] Step S302: The first driving pulse signal is switched from the first pulse state to the second pulse state in at least one target pulse sub-cycle to generate the second driving pulse signal corresponding to the current pulse cycle.
[0103] Here, the first drive pulse signal is the control signal output in the first pulse state. The first drive pulse signal has a specific duty cycle and frequency, used to drive the motor to operate in a preset manner. The second drive pulse signal is a new signal generated after the state switch. The second drive pulse signal may have a different duty cycle or frequency to further adjust the motor operation.
[0104] For example, refer to Figure 4 This is a schematic diagram of the pulse signal timing during the uniform velocity phase, refer to... Figure 4 As can be seen, during the uniform speed phase, the signal in the four pulse cycles undergoes state switching. Here, Sta0 is the second pulse state. In this embodiment, the target pulse sub-cycle in the four pulse cycles is the last 0.2 seconds. It can be seen that the signal state changes from the original first pulse state to the second pulse state. Taking the first pulse cycle as an example, it can be seen that the signal state changes from Sta1 to Sta0.
[0105] Reference Figure 5 The diagram shows the timing of the pulse signal during the acceleration phase. It can be seen that the time length of the target pulse sub-cycle is different in different phases of the pulse cycle. Therefore, in this embodiment, different state switching parameters can be determined based on different operating phases of the motor, thereby determining different target pulse sub-cycles.
[0106] Figure 5 Taking the pulse period corresponding to acceleration phase 1 as an example, it can be seen that its target pulse sub-period is the last 3.5 seconds of the current pulse period, and the signal state switches from Sta1 to Sta0; taking acceleration phase 2 as an example, it can be seen that its target pulse sub-period is the last 2.5 seconds of the current pulse period, and the signal state switches from Sta2 to Sta0.
[0107] In the above embodiments, the target pulse sub-cycle is determined based on the state switching parameters, and the state of the drive pulse signal is switched in these sub-cycles, thereby achieving fine adjustment of motor control and avoiding the temperature surge problem caused by the stepper motor maintaining a rotating state for a long time.
[0108] In some implementations, the stepper motor is used to drive the target component of the robot to move. The stepper motor control method provided in this application further includes the following steps: in response to receiving a stop movement command, sending a third drive pulse signal to the stepper motor and setting the current state of the stepper motor to a stop state.
[0109] The third driving pulse signal maintains the state of the second pulse.
[0110] Based on this, the above step S101 "obtaining the first drive pulse signal of the stepper motor in the current pulse period" also includes: If the current state of the stepper motor is not a stopped state, acquire the first drive pulse signal of the stepper motor in the current pulse cycle.
[0111] Here, the stop movement command is used to instruct the target component to stop moving. This command can be automatically generated by the robot when the target component is obstructed, or it can be entered by the user through an input control.
[0112] In related technologies, when a stop is detected, a braking pulse signal is sent to the stepper motor. Typically, the control sequence corresponding to this braking pulse signal is that all phases are turned on. However, it's understandable that if a phase of the stepper motor has a short circuit fault, directly sending the original braking pulse signal would directly cause that short-circuited phase to turn on. In this case, the motor temperature would spike, posing a high-risk problem.
[0113] Therefore, in this embodiment of the application, when a stop movement command is detected, a third drive pulse signal can be generated and sent to the stepper motor. Here, the third drive pulse signal maintains the second pulse state, that is, controls each phase to disconnect, so as to avoid the above-mentioned high-risk problem.
[0114] When it is detected that the current state is not a stopped state, it can be determined that the stepper motor is in operation and has not yet been explicitly marked as stopped. In this state, the first drive pulse signal in each pulse cycle can be continuously monitored and recorded to ensure that the stepper motor runs smoothly along the expected path.
[0115] This condition helps prevent the stepper motor from continuing to send drive signals incorrectly after it has already entered a stopped state, thus avoiding unnecessary energy consumption or potential safety hazards.
[0116] In the above embodiments, by detecting the stop movement command, a third drive pulse signal can be generated and sent to the stepper motor. Here, the third drive pulse signal maintains the second pulse state, that is, controls each phase to disconnect, thereby avoiding the high-risk problem caused by directly issuing the original brake indication pulse signal when a phase has a short circuit fault.
[0117] In some embodiments, the stepper motor control method provided in this application further includes the following steps: when the current state of the stepper motor is a stopped state, sending a third drive pulse signal to the stepper motor and stopping the acquisition of the first drive pulse signal of the stepper motor in the current pulse cycle.
[0118] Here, when the stepper motor is in a stopped state, it means that the stepper motor is not performing any motion operation. At this time, the control system detects that the target component is in a stable position, or the motor may be stalled. In this state, in order to ensure the consistency and safety of the control logic, while sending the third drive pulse signal, the control system will stop receiving and processing the first drive pulse signal of the current pulse cycle, to avoid multiple drive signals acting on the stepper motor at the same time, thereby preventing erroneous movement or missed steps.
[0119] In the above embodiments, by sending a third drive pulse signal and stopping the acquisition of the first drive pulse signal in the stopped state, the superposition of multiple pulse signals can prevent the stepper motor behavior from becoming unpredictable, effectively avoiding problems such as jitter, missed steps, or stalling.
[0120] In some embodiments, a stepper motor is used to drive a target component of a robot to move; the stepper motor control method provided in this application further includes: in response to receiving a target movement command, setting the pulse count value of the stepper motor to a preset value.
[0121] Here, the target movement command may refer to, but is not limited to, commands used to control the movement of target components in a robot. In the embodiments of this application, the target movement command typically includes parameters such as target position, direction, and speed. For example, in a robotic vacuum cleaner, when the user sets the mop to be raised to a specific height, a corresponding target movement command is generated to guide the mop to perform the lifting action.
[0122] Here, the pulse count value can refer to, but is not limited to, a numerical variable used to record the rotation history of the stepper motor. Whenever the system receives a pulse signal, the pulse count value will increase by a certain amount.
[0123] In this embodiment, the pulse count value is used to represent the distance the stepper motor has moved. By setting the pulse count value to a preset value, the initial position of the stepper motor can be initialized, thereby ensuring the accuracy of subsequent motion control.
[0124] Here, the preset value is the initial pulse value set according to the target movement command, used to calibrate the motor's starting position. For example, when the target movement command instructs the target component to move, the system resets the pulse count to zero to accurately record every position change during the motor's rotation. Resetting the pulse count to zero avoids position errors caused by the motor's previous state, thereby improving control accuracy.
[0125] It is understandable that the counting method differs depending on the target movement position indicated by the target movement command. For example, if the robot is a sweeping robot and the target component is a mop module, the target movement position can at least include raising to the position, lowering to the position, extending to the position, and retracting to the position. For raising and retracting, the pulse count value is continuously decreased, while for lowering and extending to the position, the pulse count value is continuously increased.
[0126] Based on this, the process of step S103 "sending a second drive pulse signal to the stepper motor" also includes: If the pulse count value does not exceed the target count range, a second drive pulse signal is sent to the stepper motor, and the pulse count value is updated.
[0127] The target counting range is determined based on the target movement command.
[0128] Here, the target counting range can be used to characterize the maximum count value corresponding to the pulse count value after the target component reaches the target movement position indicated by the target movement command. For example, if the robot is a sweeping robot and the target component is a mop module, the target movement position can at least include lifting to the position, lowering to the position, extending to the position, and retracting to the position. Then, for lifting to the position, the target counting range can be 0 to -H, for lowering to the position, the target counting range can be 0 to H, for extending to the position, the target counting range can be 0 to L, and for lifting to the position, the target counting range can be 0 to -L.
[0129] It is understandable that when the motor is stalled, the target component will not move to the target position and will continuously send drive pulse signals to the stepper motor, resulting in wasted resources and a temperature spike. Therefore, in this embodiment, a target counting range is set. When the pulse count value does not exceed the target counting range, a second drive pulse signal is sent to the stepper motor and the pulse count value is continuously updated until the target component reaches the target position or the pulse count value exceeds the target counting range. Then, the second drive pulse signal is stopped from being sent to the stepper motor, thus avoiding the risks caused by stalling.
[0130] The following describes the application of the robot grasping control method provided in this application embodiment in a real-world scenario: In the development of multi-sensor fusion motor control systems, the types of sensors involved include: laser rangefinders, pressure sensors, acoustic sensors, current / voltage sensors, temperature sensors, humidity sensors, speed / acceleration sensors, etc.; and the types of motors involved include: brushless motors, brushed motors, stepper motors, permanent magnet synchronous motors, servos, linear motors, etc.
[0131] Combining these different types of sensors and motors can realize control systems with various functions, such as: machine tool control systems (laser rangefinders, pressure sensors, servo motors), smart factory control systems (temperature and humidity sensors, optical sensors, displacement sensors, brushless motors), washing machines (inertial sensors, permanent magnet brushless motors), robotic vacuum cleaners and mops (light blocking signals, stepper motors), electronic placement machines (optical sensors, cameras, stepper motors), and autonomous driving systems for new energy vehicles (cameras, LiDAR, speed / accelerometers, permanent magnet synchronous motors), etc. In the field of multi-sensor fusion motor control, technological iteration mainly revolves around issues such as control accuracy, safety regulations, energy consumption, control response speed, cost, temperature rise, and the development of new functions.
[0132] This patent focuses on the design and control of robotic vacuum cleaner mops. Robotic vacuum cleaner mop classification: Based on their functional form, they can only be raised and lowered, can only be extended and retracted, or can be both extended and retracted and raised and lowered. According to motor type, brushed motor, brushless motor, stepper motor; The detection is triggered when the current is applied and when the light is cut off. According to the structural design, the telescopic lifting mechanism uses the same motor, while the telescopic lifting mechanism uses different motors. According to the type of mop, there are dual disc mops, vibrating mops, and roller mops with live water. Based on control precision, it can only be raised and lowered to the designated position, raised and lowered to different heights, and extended and retracted to the designated position and extended and retracted to different lengths; Combining these different categories can create different control schemes for sweeping and mopping modules. Different combinations will have different performance in terms of cost, cleaning effect, lifespan, energy consumption, and safety regulations.
[0133] In related technologies, stepper motors, due to their reliable service life and the fact that the number of pulses they send can serve as a rotational history counter without the need for additional counting sensors, overcome the shortcomings of the two solutions mentioned above. However, stepper motors often experience temperature spikes (140℃) in multi-sensor fusion control systems, far exceeding the motor's maximum withstand temperature (80℃), seriously affecting the safety and reliability of user operation.
[0134] This invention designs a solution to strictly control the temperature rise of the stepper motor for the extension and lifting of the sweeping machine's mop, effectively solving all the risk problems that cause the stepper motor temperature to soar; at the same time, while ensuring the normal operation of the motor, it minimizes the heat generated by the motor during the movement process, ensuring that the module's battery life is minimized.
[0135] The technical solution of this application: 1. Temperature rise control during the constant speed and acceleration phases of the stepper motor Four pulse states are defined: Sta1 (1010), Sta2 (0110), Sta3 (0101), and Sta4 (1001) (two-phase conduction generates heat, all four phases are non-conducting (0000), and all four phases are conducting (1111) do not generate heat). Each time a pulse state is switched, the motor rotates through a certain step angle. By switching the pulse states in a specific order and frequency, the stepper motor can be controlled to rotate at different speeds and directions. For example, forward rotation: Sta1--->Sta2--->Sta3--->Sta4, with the time updated every 0.2 seconds (a finer-grained clock cycle is needed to control the insertion of Sta0 within 1 second). The state is switched once at 1s, 2s, 3s, and 4s (switching states every 1 second, i.e., rotating through a certain angle every 1 second). The minimum pulse operation period t = 0.2 seconds, the motor's rated pulse period T = 1s, and T = 5*t.
[0136] Understandably, if the pulse remains in a constant state, the motor will continuously generate heat. A new standby pulse state, Sta0 (0000), is introduced. In this state, the stepper motor neither generates heat nor consumes power. Sta0 is inserted into each stage at a certain ratio (e.g., 8:2) (this ratio is empirical; the larger the Sta0 ratio, the better, while ensuring stable motor operation. The insertion position of Sta0 is not limited; it can be placed at the beginning, end, or middle of each stage. Inserting it at the end of each stage simplifies the control logic). This minimizes heat generation during rotation while ensuring stable motor operation.
[0137] In the embodiments of this application, the period of each acceleration stage of the motor startup is much longer than the period of each stage of uniform motion, making it more necessary to insert a standby pulse Sta0(0000) in each acceleration stage; otherwise, the motor temperature will rise rapidly during the acceleration stage.
[0138] 2. Temperature rise control during the stepper motor stop phase.
[0139] The timing sequence for stopping the stepper motor of the mop retraction and lifting mechanism is as follows: The moment the control system receives the command to stop the retraction and lifting, task 1 sends a braking pulse Sta*(1111) to the stepper motor. Simultaneously, task 2, which controls the start and stable rotation of the stepper motor, ceases its own logic. This control timing sequence has two drawbacks.
[0140] Defect 1: When the motion ends, Task 1 should not send a brake pulse Sta*(1111) to the stepper motor, but should send a standby pulse Sta0(0000). This is because if a short circuit occurs in one phase of the stepper motor, that phase will conduct, causing the motor temperature to spike, which is a high-risk situation.
[0141] Defect 2: Assume that the short-circuit problem in Defect 1 will not occur. Since Task 1 and Task 2 work independently, a problem may occur probabilistically: after Task 1 sends the braking pulse Sta*(1111), the loop task of Task 2 has not been completed. Task 2 will randomly restore the stepper motor pulse signal to any one of Sta1, Sta2, Sta3, Sta3, and maintain this state for a period of time. The motor temperature will soar, which is a high risk.
[0142] The following optimizations are made to address the two defects mentioned above: Optimization 1: After the roller stepping telescopic lifting motion is completed, Task 1 sends a standby pulse Sta0(0000) to the stepper motor.
[0143] Optimization 2: After the stepper motor's telescopic lifting and lowering motion ends, Task 2 continues to execute periodically. At the same time, a new judgment logic is added: if the current state (set a global variable) is the stopped state, Task 2 needs to send the standby pulse Sta0(0000) to the stepper motor again, and the control logic after Task 2 will no longer be executed.
[0144] 3. Figure 6 This is a schematic diagram of the mop's telescopic lifting mechanism. (Refer to...) Figure 6 When the mop descends and extends, it is defined as being in the same direction, both being the OUT direction, and the stepper motor pulse count increases. When the mop retracts and rises, it is defined as being in the same direction, both being the IN direction, and the stepper motor pulse count decreases. The following five abnormal situations that occur during the movement will cause the motor temperature to rise to varying degrees.
[0145] (1) Stall overtime temperature rise control When a stepper motor stalls during telescopic movement, it continuously sends pulses to control the motor's rotation because it cannot reach the target position or telescopic length sent by the application layer. However, the motor is already unable to rotate, and at any given time, two phases of the stepper motor are conducting, preventing the pulse energy from being effectively converted into motor kinetic energy. This continuous pulse sending causes the motor temperature to spike. Furthermore, since the current during stall is the same as the current during normal operation, it is impossible to determine whether a stall has occurred based on current characteristics. To address the temperature spike problem caused by stall, the following solution is introduced: ① When the mop descends to the bottom, the control system will calibrate the stepper motor pulse count to 0. When it rises, the pulse count starts to decrease from 0. When it is fully raised to the bottom (triggered by light blocking when raised to the bottom), the count value decays to the minimum value -H. When it extends, the pulse count starts to increase from 0. When it is fully extended to the bottom (triggered by light blocking when extended to the bottom), the count value increases to the maximum value L. The reverse is true when it descends and retracts.
[0146] ② When the application layer sends the extension-to-position command and the motor stalls during the extension process, the extension-to-position light-blocking signal is not triggered, and the control system continues to send forward rotation pulses to the motor. At this point, the motor does not move during the stall, but the pulse count value quickly spikes far exceeding L. Pulse sending should be stopped immediately.
[0147] ③ The stall during descent is similar to the stall during extension; both require immediately stopping pulse transmission when the pulse count exceeds L+dL. The purpose of dL is to appropriately widen the upper limit of pulse judgment, avoiding misjudgments caused by missed steps and timing errors.
[0148] ④ When the application layer sends a lift-to-position command, and the motor stalls during the lift-to-position process, the light-blocking signal is not triggered. The control system will continue to send reverse pulse timing signals to the motor. At this point, the motor will not move during the stall, but the pulse count value will quickly decay to a value far less than -H. Pulse sending should be stopped immediately.
[0149] ⑤ The stall during retraction is similar to the stall during lifting; both require immediately stopping pulse transmission when the pulse count value is less than -H-dH. The purpose of dH is to appropriately widen the lower limit of pulse judgment to avoid misjudgments caused by missed steps and timing errors.
[0150] (2) The descent / retraction to position light blocking cannot be triggered (retraction to position and descent to position are the same). If the descent-to-position light interruption fails to trigger, and the target position sent by the application layer is the descent-to-position: ①The mop will not stop when it reaches the lowering position; it will directly bypass the lowering position light block and extend out.
[0151] ② Stop when it reaches the extended position, and then move in the opposite direction to retract back to the position (retracting back to the position and descending to the position are the same).
[0152] ③ When the mop retracts into position, due to the light blocking malfunction, the mop will not stop, but will directly bypass the light blocking when it descends into position and rise directly.
[0153] ④ Stop when the lifting position is reached, and then move in the opposite direction to the lowering position (retracting back to the position and lowering to the lowering position are the same).
[0154] ⑤ When it descends to the bottom, repeat steps ① to ④, and the mop will keep moving back and forth, extending and retracting.
[0155] Therefore, a timeout detection for descent is added. When the target position is reached (descent / retraction), if the stepper motor fails to reach the target position within a certain time, it needs to stop sending pulse signals in time to avoid unnecessary movement, which would waste battery power and cause overheating. At the same time, it can also avoid generating unnecessary noise.
[0156] (3) The position of the telescopic and lifting of the mop when the machine is turned on is unknown. If none of the three position light interruption signals are triggered upon power-on, the mop position is unknown and random, making it impossible to control the mop's extension, retraction, and lifting. In this case, it is necessary to first move the mop in the IN or OUT direction, i.e., towards a certain light interruption point, such as... Figure 5 As shown, the circuit can be stopped when a certain light blockage is triggered, and the position at this time is determined.
[0157] Now, assuming the machine initially moves in the IN direction to find its position upon startup, if the mop position cannot be determined within a certain time, it needs to automatically switch direction and move towards the OUT direction to find other light-blocking positions. Similarly, if it moves towards the OUT direction and still cannot find a position within a certain time, it needs to reverse direction and move towards the IN direction to find a position. This also avoids the problem of the machine continuously sending stall pulses after stalling in a certain direction, causing the temperature to spike.
[0158] (4) Temperature rise control caused by short circuit fault When a short circuit fault occurs in one phase of a stepper motor, the motor current will be significantly greater than the normal operating current, and the temperature will also soar far beyond the motor's maximum tolerance temperature. At this time, it is necessary to detect this circuit fault based on the abnormal current characteristics, promptly power down the stepper motor, and report this fault to the application layer.
[0159] (5) The interrupt adds_reportsbuffer reports messages. The `add_reportbuffer` function in the interrupt will disrupt the 20ms periodicity. The `add_reportbuffer` function in the task causes the buffer length to exceed the set value, resulting in abnormal serial communication data packets. Therefore, a `while(1)` loop needs to be used in the high-priority `report_buffer` task to trigger a watchdog reset. Two problems exist in the above process: ① During the process of controlling the robot vacuum at the application layer, if the MCU restarts, the robot vacuum will behave abnormally: spinning in place, hitting walls, falling off cliffs, and the mop extending, retracting, raising, and lowering arbitrarily, etc.
[0160] ② If the watchdog cannot be reset normally (e.g., MR536 RISCV), the MCU will be stuck in the while(1) state. The MCU's control IO for the stepper motor will always remain in the same state, that is, two phases will always be on. At this time, the temperature of the stepper motor will rise rapidly.
[0161] Therefore, to avoid the aforementioned issues of abnormal robot vacuum behavior and temperature spikes, instead of interrupting `add_reportbuffer`, an event should be sent to the message reporting queue within the interrupt. Then, `add_reportbuffer` should be called within this event to report the message. Furthermore, if the AP (CPU) detects that the RV (MCU) cannot be reset, the AP should control the RV to restart.
[0162] 4. Other optimization items (1) Pulse frequency The pulse period of the stepper motor for the mop telescopic lifting mechanism needs to be far removed from the natural vibration periods of the motor; otherwise, it will cause motor resonance. Although motor resonance does not generate much heat, it significantly drains the battery and produces harsh high-frequency noise. Considering both resonance and operational stability, the stepper motor pulse period is 900 microseconds (the period should be as far away from the natural vibration frequencies as possible within the range of 900 to 1200 microseconds; the control system's period increment is 100 microseconds, for example, 900, 1100, and 1200 microseconds).
[0163] (2) Control command response sensitivity If the retraction process results in a larger target length, the extension can be immediately reversed without retracting back to the target length first; conversely, if the extension process results in a smaller target length, the retraction can be immediately reversed without extending to the target length first. Both scenarios reduce unnecessary movement, correspondingly reducing unnecessary heat generation and mechanical energy loss.
[0164] The summary of the technical solution of this application may include the following: 1. This proposal is based on the optimization of instructions and pulse switching after replacing the brushless motor with a stepper motor.
[0165] 2. Optimization of pulse switching includes two aspects: (1) Uniform speed stage. Standby state pulses are added according to the preset duration ratio.
[0166] (2) Acceleration phase. During the acceleration phase, standby pulses are added to different pulses.
[0167] 3. Optimization of instructions.
[0168] (1) For the pulse setting counter during the telescopic lifting process, when the count reaches the preset counting threshold, the pulse will stop being sent to deal with the stall state.
[0169] (2) Set time thresholds for the extension and lifting processes. When the time is reached, pulse transmission will also stop. This is to address situations where light interruption occurs or the extension / lifting position is unclear during power-on / off.
[0170] (3) Check whether the current status is abnormal. If it is abnormal, power off directly and report the motor fault.
[0171] (4) For the entire task cycle (such as add_reportsbuffer in the interrupt), place this function as an event that should be processed in the reporting queue.
[0172] (5) The pulse frequency is set to 909 Hz.
[0173] (6) The instruction takes effect immediately upon receipt and does not need to be returned to the original length first.
[0174] The technical effects of the solutions provided in this application include: (1) Cost: The stepper motor telescopic lifting solution replaces the brushless motor solution, saving costs per machine; the rotary drum mop can also save costs by replacing the brushless motor with a brushed motor.
[0175] (2) Temperature rise: By comprehensively applying the various temperature rise control strategies in this invention patent, the temperature of the sweeper during long-term (2h) mopping process can be stably and effectively controlled from the initial 75℃ to about 43℃. During the large-scale internal and external testing and hardware testing for two weeks, there was no temperature surge (140℃).
[0176] (3) Accuracy: The pulse count of the stepper motor is used instead of the odo count of the brushless motor as the rotation history count value. While reducing costs, a high telescopic lifting control accuracy can still be guaranteed. The horizontal telescopic accuracy of different lengths can be controlled between 0.1 and 0.5 mm.
[0177] (4) Lifespan: The mop telescopic lifting mechanism uses a stepper motor instead of a brushed motor, which solves the problem of the lifespan not meeting the market standard. The key technical points of the solutions provided in this application include: (1) Solution to the problem of temperature spikes when controlling the stop timing of stepper motors.
[0178] (2) During the telescopic lifting process, the rotor stalls and the pulse count exceeds the upper and lower limits of the normal movement range, so pulse generation stops.
[0179] (3) Short circuit fault detection and motor shutdown.
[0180] (4) The interrupt cannot use add_reportsbuffer to report messages.
[0181] (5) The stepper motor is optimized from full-pulse holding to half-pulse holding during operation.
[0182] (6) Respond promptly to the latest target position instructions to reduce unnecessary movement.
[0183] (7) The stepper motor pulse frequency avoids the natural frequencies of each vibration of the motor.
[0184] Based on the above embodiments, this application also provides a stepper motor control device. Figure 7 This is a schematic diagram of the composition structure of a stepper motor control device provided in an embodiment of this application, as shown below. Figure 7 As shown, the stepper motor control device 700 includes: The acquisition module 701 is used to acquire the first drive pulse signal of the stepper motor in the current pulse cycle; the current pulse cycle includes multiple pulse sub-cycles, and the first drive pulse signal maintains a first pulse state in the multiple pulse sub-cycles, and the first pulse state is used to drive the stepper motor to rotate; The switching module 702 is used to switch the first driving pulse signal from a first pulse state to a second pulse state in at least one of the pulse sub-cycles, and generate a second driving pulse signal corresponding to the current pulse cycle; the second pulse state is used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state is less than the energy consumption in the first pulse state; The transmitting module 703 is used to send the second drive pulse signal to the stepper motor.
[0185] In some embodiments, the switching module 702 includes: The target determination unit is used to determine at least one target pulse sub-cycle in the current pulse cycle based on the state switching parameters; The generation unit is used to switch the first driving pulse signal from a first pulse state to a second pulse state in the at least one target pulse sub-cycle, and generate a second driving pulse signal corresponding to the current pulse cycle.
[0186] In some embodiments, the state switching parameter includes a target ratio, which represents the proportion of the target pulse sub-cycle in the current pulse cycle; The target determination unit is specifically used for execution: Based on the target ratio and the first number of pulse sub-cycles in the current pulse period, determine the second number of target pulse sub-cycles in the current pulse period; The second number of target pulse sub-cycles are determined from the current pulse cycle.
[0187] In some embodiments, the state switching parameter includes a target holding duration, which characterizes the duration of the first pulse state in the current pulse period; The target determination unit is specifically used for execution: Based on the target holding duration, determine the third number of target pulse sub-cycles in the current pulse cycle; The third number of target pulse sub-cycles are determined from the current pulse cycle.
[0188] In some embodiments, the stepper motor is used to drive a target component of the robot to move; the device further includes a standby transmission module, used to send a third drive pulse signal to the stepper motor in response to receiving a stop movement command, and set the current state of the stepper motor to a stop state; the third drive pulse signal maintains the second pulse state; The acquisition module 701 includes: The drive unit is used to acquire the first drive pulse signal of the stepper motor in the current pulse cycle when the current state of the stepper motor is not a stopped state.
[0189] In some embodiments, the device includes: The stop drive module is used to send a third drive pulse signal to the stepper motor when the current state of the stepper motor is a stopped state, and to stop acquiring the first drive pulse signal of the stepper motor in the current pulse cycle.
[0190] In some embodiments, the stepper motor is used to drive a target component of the robot to move; the device further includes: The counting detection module is used to set the pulse count value of the stepper motor to a preset value in response to receiving a target movement command; The sending module 703 includes: The counting and sending unit is used to send the second drive pulse signal to the stepper motor and update the pulse count value when the pulse count value does not exceed the target counting range; the target counting range is determined according to the target movement command.
[0191] In some embodiments, the stepper motor is used to drive the target component of the robot to move; The acquisition module 701 includes: A pulse signal generation unit is used to generate the first driving pulse signal based on the target position corresponding to the currently received target movement command and the current position of the target component; The device further includes: The stop-send module is used to stop sending the second drive pulse signal to the target motor if the target component is not detected to have reached the target position within a preset time after receiving the target movement command.
[0192] In some embodiments, the signal period of the second drive pulse signal is different from the inherent vibration period of the stepper motor.
[0193] In some embodiments, the apparatus further includes: The message processing module is used to respond to a hardware interrupt triggering event, obtain the data reporting task corresponding to the hardware interrupt triggering event; generate a corresponding message event according to the data reporting task; and send the message event to a message queue so that the main processor can read from the message queue and respond to the message event.
[0194] The description of the above device embodiments is similar to that of the above method embodiments, and has similar beneficial effects. For technical details not disclosed in the stepper motor control device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0195] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0196] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0197] It should be noted that, in the embodiments of this application, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of software products. These software products are stored in a storage medium and include several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, external hard drives, ROMs, magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0198] This application provides a robot, which includes: a body, a stepper motor, a target component that can be driven to move based on the stepper motor, and a controller; the controller is used to implement some or all of the steps in the above method.
[0199] Reference Figure 8 This is a schematic diagram of the composition structure of a robot provided in an embodiment of this application, as shown below. Figure 8 As shown, the robot 80 may include a body 81, a stepper motor, a target component 82 that can be driven to move based on the stepper motor, and a controller, wherein the controller is used to implement some or all of the steps in the above method. It is understood that the robot may include, but is not limited to, at least one of cleaning equipment, cleaning robots (such as sweeping robots, floor scrubbers, mopping robots, and combined washing and mopping machines), guiding robots, and service robots. In implementation, the composition and structure of the mobile robot may be determined according to the actual situation, and this application embodiment does not limit this; the target component may include a cleaning component, such as a mop module.
[0200] This application provides a computer device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.
[0201] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described method. The computer-readable storage medium can be transient or non-transient.
[0202] This application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied as a computer storage medium; in another optional embodiment, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0203] refer to Figure 9 The present invention will now describe a structural block diagram of an electronic device that can serve as a server or client of the present invention, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0204] like Figure 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. The RAM 903 may also store various programs and data required for the operation of the device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0205] Multiple components in electronic device 900 are connected to I / O interface 905, including: input unit 906, output unit 907, storage unit 908, and communication unit 909. Input unit 906 can be any type of device capable of inputting information to electronic device 900. Input unit 906 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 907 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 908 may include, but is not limited to, disk and optical disk. Communication unit 909 allows electronic device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0206] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above. For example, in some embodiments, the music data processing method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 900 via ROM 902 and / or communication unit 909. In some embodiments, the computing unit 901 can be configured by any other suitable means (e.g., by means of firmware) to perform the methods according to embodiments of the present invention.
[0207] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0208] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0209] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0210] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0211] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0212] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0213] It should be noted that the descriptions of the above embodiments of the apparatus, storage medium, device, and program product are similar to the descriptions of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the embodiments of the robot, storage medium, device, and program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0214] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above embodiments of this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0215] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0216] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0217] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0218] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0219] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory, magnetic disks, or optical disks.
[0220] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.
[0221] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes 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.
Claims
1. A control method for a stepper motor, characterized in that, The method includes: Obtain the first drive pulse signal of the stepper motor in the current pulse cycle; the current pulse cycle includes multiple pulse sub-cycles, and the first drive pulse signal maintains a first pulse state in the multiple pulse sub-cycles, the first pulse state being used to drive the stepper motor to rotate; The first driving pulse signal is switched from a first pulse state to a second pulse state in at least one of the pulse sub-cycles to generate a second driving pulse signal corresponding to the current pulse cycle; the second pulse state is used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state is less than the energy consumption in the first pulse state; The second drive pulse signal is sent to the stepper motor.
2. The method according to claim 1, characterized in that, The step of switching the first driving pulse signal from a first pulse state to a second pulse state in at least one of the pulse sub-cycles to generate a second driving pulse signal corresponding to the current pulse cycle includes: Based on the state switching parameters, at least one target pulse sub-cycle in the current pulse cycle is determined; The first driving pulse signal is switched from a first pulse state to a second pulse state in at least one target pulse sub-cycle to generate a second driving pulse signal corresponding to the current pulse cycle.
3. The method according to claim 2, characterized in that, The state switching parameters include a target ratio, which represents the proportion of the target pulse sub-cycle in the current pulse cycle; Determining at least one target pulse sub-period in the current pulse period based on state switching parameters includes: Based on the target ratio and the first number of pulse sub-cycles in the current pulse period, determine the second number of target pulse sub-cycles in the current pulse period; The second number of target pulse sub-cycles are determined from the current pulse cycle.
4. The method according to claim 2, characterized in that, The state switching parameters include the target holding duration, which characterizes the duration of the first pulse state in the current pulse period; Determining at least one target pulse sub-period in the current pulse period based on state switching parameters includes: Based on the target holding duration, determine the third number of target pulse sub-cycles in the current pulse cycle; The third number of target pulse sub-cycles are determined from the current pulse cycle.
5. The method according to any one of claims 1 to 4, characterized in that, The stepper motor is used to drive the target component of the robot to move; the method further includes: In response to receiving a stop movement command, a third drive pulse signal is sent to the stepper motor, and the current state of the stepper motor is set to a stop state; the third drive pulse signal maintains the second pulse state; The step of obtaining the first drive pulse signal of the stepper motor in the current pulse period includes: If the current state of the stepper motor is not a stopped state, the first drive pulse signal of the stepper motor in the current pulse cycle is acquired.
6. The method according to claim 5, characterized in that, The method further includes: When the current state of the stepper motor is stopped, a third drive pulse signal is sent to the stepper motor, and the acquisition of the first drive pulse signal of the stepper motor in the current pulse cycle is stopped.
7. The method according to any one of claims 1 to 4, characterized in that, The stepper motor is used to drive the target component of the robot to move; the method further includes: In response to receiving a target movement command, the pulse count value of the stepper motor is set to a preset value; Sending the second drive pulse signal to the stepper motor includes: If the pulse count value does not exceed the target count range, the second drive pulse signal is sent to the stepper motor, and the pulse count value is updated; the target count range is determined according to the target movement command.
8. The method according to any one of claims 1 to 4, characterized in that, The stepper motor is used to drive the target component of the robot to move; The step of obtaining the first drive pulse signal of the stepper motor in the current pulse period includes: The first driving pulse signal is generated based on the target position corresponding to the currently received target movement command and the current position of the target component; The method further includes: If the target component is not detected to have reached the target position within a preset time period after receiving the target movement command, the sending of the second drive pulse signal to the target motor is stopped.
9. The method according to any one of claims 1 to 4, characterized in that, The signal period of the second drive pulse signal is different from the natural vibration period of the stepper motor.
10. The method according to any one of claims 1 to 4, characterized in that, The method further includes: In response to a hardware interrupt triggering event, obtain the data reporting task corresponding to the hardware interrupt triggering event; Generate corresponding message events based on the data reporting task; The message event is sent to a message queue so that the main processor reads from the message queue and responds to the message event.
11. A stepper motor control device, characterized in that, The device includes: The acquisition module is used to acquire the first drive pulse signal of the stepper motor in the current pulse cycle; the current pulse cycle includes multiple pulse sub-cycles, and the first drive pulse signal maintains a first pulse state in the multiple pulse sub-cycles, and the first pulse state is used to drive the stepper motor to rotate; A switching module is used to switch the first driving pulse signal from a first pulse state to a second pulse state in at least one of the pulse sub-cycles, and generate a second driving pulse signal corresponding to the current pulse cycle; the second pulse state is used to drive the stepper motor to stop rotating, and the energy consumption of the stepper motor in the second pulse state is less than the energy consumption in the first pulse state; The transmitting module is used to send the second drive pulse signal to the stepper motor.
12. The apparatus according to claim 11, characterized in that, The switching module includes: The target determination unit is used to determine at least one target pulse sub-cycle in the current pulse cycle based on the state switching parameters; The generation unit is used to switch the first driving pulse signal from a first pulse state to a second pulse state in the at least one target pulse sub-cycle, and generate a second driving pulse signal corresponding to the current pulse cycle.
13. The apparatus according to claim 12, characterized in that, The state switching parameters include a target ratio, which represents the proportion of the target pulse sub-cycle in the current pulse cycle; The target determination unit is specifically used to perform: Based on the target ratio and the first number of pulse sub-cycles in the current pulse period, determine the second number of target pulse sub-cycles in the current pulse period; The second number of target pulse sub-cycles are determined from the current pulse cycle.
14. The apparatus according to claim 12, characterized in that, The state switching parameters include the target holding duration, which characterizes the duration of the first pulse state in the current pulse period; The target determination unit is specifically used to perform: Based on the target holding duration, determine the third number of target pulse sub-cycles in the current pulse cycle; The third number of target pulse sub-cycles are determined from the current pulse cycle.
15. The apparatus according to any one of claims 11 to 14, characterized in that, The stepper motor is used to drive the target component of the robot to move; the device also includes: A standby transmission module is used to send a third drive pulse signal to the stepper motor in response to receiving a stop movement command, and set the current state of the stepper motor to a stop state; the third drive pulse signal maintains the second pulse state; The acquisition module includes: If the current state of the stepper motor is not a stopped state, the first drive pulse signal of the stepper motor in the current pulse cycle is acquired.
16. The apparatus according to claim 15, characterized in that, The device further includes: The stop drive module is used to send a third drive pulse signal to the stepper motor when the current state of the stepper motor is a stopped state, and to stop acquiring the first drive pulse signal of the stepper motor in the current pulse cycle.
17. The apparatus according to any one of claims 11 to 14, characterized in that, The stepper motor is used to drive the target component of the robot to move; the device also includes: The counting detection module is used to set the pulse count value of the stepper motor to a preset value in response to receiving a target movement command; The sending module includes: If the pulse count value does not exceed the target count range, the second drive pulse signal is sent to the stepper motor, and the pulse count value is updated; the target count range is determined according to the target movement command.
18. The apparatus according to any one of claims 11 to 14, characterized in that, The stepper motor is used to drive the target component of the robot to move; The acquisition module includes: A pulse signal generation unit is used to generate the first driving pulse signal based on the target position corresponding to the currently received target movement command and the current position of the target component; The device further includes: The stop-send module is used to stop sending the second drive pulse signal to the target motor if the target component is not detected to have reached the target position within a preset time after receiving the target movement command.
19. The apparatus according to any one of claims 11 to 14, characterized in that, The signal period of the second drive pulse signal is different from the natural vibration period of the stepper motor.
20. The apparatus according to any one of claims 11 to 14, characterized in that, The device further includes: The message processing module is used to respond to a hardware interrupt triggering event, obtain the data reporting task corresponding to the hardware interrupt triggering event; generate a corresponding message event according to the data reporting task; and send the message event to a message queue so that the main processor can read from the message queue and respond to the message event.
21. A robot, characterized in that, The robot includes: The device includes a body, a stepper motor, a target component that can be driven to move based on the stepper motor, and a controller. The controller is used to implement the method as described in any one of claims 1 to 10.
22. A computer device, characterized in that, The computer device includes: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the method according to any one of claims 1 to 10.
23. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.
24. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 10.