Disclosure of Invention
One of the purposes of the present invention is to overcome the defects in the background art, and to provide a window-wiping robot capable of accurately detecting its operating state, the specific scheme is as follows:
a window cleaning robot comprises a travelling mechanism, a sampling circuit and a single chip microcomputer, wherein the travelling mechanism is used for driving the window cleaning robot to move on the surface of glass; the sampling circuit is used for sampling the current of the travelling mechanism according to a fixed frequency; the single chip microcomputer comprises a storage module, a calculation module and a judgment module, wherein the storage module is used for storing a current sampling value of the travelling mechanism; the calculation module is used for calculating subtraction values of the current sampling value and the previous n continuous current sampling values, the sum of the subtraction values and the accumulated value of the sum of the m subtraction values; the judging module is used for judging the current walking state of the window cleaning robot according to the accumulated value.
In one embodiment of the invention, the sampling circuit comprises a sampling resistor and an amplifying circuit.
Furthermore, one end of the sampling resistor is connected with a motor of the travelling mechanism, and the other end of the sampling resistor is grounded; one end of the amplifying circuit is connected between the motor of the travelling mechanism and the sampling resistor, and the other end of the amplifying circuit is connected to an IO port of the single chip microcomputer.
The second purpose of the present invention is to overcome the defects in the background art, and to provide a method for detecting the walking state of a window-cleaning robot, the scheme of which is as follows:
a walking state detection method of a window cleaning robot is characterized in that the following steps are executed when the window cleaning robot is in a working state, and S1: continuously sampling the motor current of a traveling mechanism of the window cleaning robot according to a fixed frequency; s2: respectively subtracting the current sampling value from the previous n continuous current sampling values and calculating the sum of the subtraction values; s3: repeating the step S2 until the sum of m subtraction values is obtained; s4: and judging the current walking state of the window wiping robot according to the accumulated value of the sum of the m subtraction values.
Further, the method further comprises step S5: and controlling the window cleaning robot to execute corresponding actions according to the walking state.
In order to avoid the erroneous determination, in an embodiment of the method, before the step S1, a step SO is further included: the window-cleaning robot moves along the direction opposite to the direction to be traveled for a predetermined time or distance and then returns to the traveling direction.
Further, the step S1 further includes a step of amplifying the sampled current value.
Compared with the prior art, the scheme of the invention cancels a collision detection structure of the existing window-cleaning robot, and realizes the quick judgment of the walking state of the window-cleaning robot by utilizing the real-time change of the motor current of the walking mechanism; meanwhile, the walking state of the window-cleaning robot is judged by adding the sum of a plurality of continuous current difference values and a comparison result of a set threshold value, so that current noise can be effectively filtered, and the detection precision of the walking state of the window-cleaning robot is improved.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings and specific embodiments, and it is to be understood that the embodiments described herein are only a part of the embodiments of the invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the description of the specific embodiments of the invention without inventive step, shall fall within the scope of protection of the invention, as defined by the claims.
Example 1
As shown in fig. 1 and 2, a window cleaning robot in this embodiment includes a traveling mechanism, a sampling circuit, a single chip microcomputer, a power module, and necessary components such as a suction cup, a safety rope, a cleaning cloth, and an air pump.
Specifically, the running gear is used for driving the window cleaning robot to move on the surface of the glass, and the running gear of the window cleaning robot in the embodiment is a crawler-type running gear and comprises a motor, a gear and a crawler. Sampling circuit is used for sampling the electric current of running gear according to fixed frequency, sampling circuit in this embodiment includes sampling resistor and amplifier circuit, the motor of running gear is connected to sampling resistor one end, other end ground connection, amplifier circuit one end is connected between running gear's motor and sampling resistor, the other end is connected to the IO mouth of singlechip, the accuracy of sampling resistor and amplifier circuit's magnification are important parameter, adopt the higher sampling resistor of accuracy and sensitivity in this embodiment, amplifier circuit is used for enlargiing the sampling current value, a detection sensitivity is improved. The single chip microcomputer in the embodiment is an STM32, and comprises a storage module, a calculation module, a judgment module and an IO port, wherein the storage module is used for storing a current sampling value of a travelling mechanism, such as a Random Access Memory (RAM); the calculation module is used for calculating the sum of subtraction values and the sum of subtraction values of the current sampling value and the previous n continuous current sampling values and the accumulated value of the sum of m subtraction values, and the calculation module is an Arithmetic logic Unit (ALU for short); the judging module is used for judging the current walking state of the window cleaning robot according to the accumulated value, such as an MCU of a singlechip. In addition, the window cleaning robot in this embodiment further includes an alarm module, such as a buzzer or a warning light, for sending an alarm prompt when detecting that the window cleaning robot is in an abnormal working state but cannot automatically recover to a normal working state, or sending alarm information to a mobile phone of a user.
Example 2
The present embodiment describes a method for detecting the traveling state of a window-cleaning robot in detail. The hardware configuration of the window cleaning robot in the present embodiment can refer to embodiment 1. As shown in fig. 3, a flowchart of a method for detecting a walking state of a window-cleaning robot in this embodiment includes the following steps:
s0: the running mechanism moves along the direction opposite to the direction to be traveled for a preset time or distance and then returns to the traveling direction to move.
After the window cleaning robot is started, the traveling mechanism (such as a crawler-type traveling mechanism) of the window cleaning robot firstly moves in the direction opposite to the direction to be traveled for a preset time or distance and then returns to the traveling direction to move, so that the situation that when the window cleaning robot is started at the edge or corner of a window and is stuck, the current sampling value of the driving wheel is unchanged all the time and the state of the window cleaning robot is judged to be normal traveling is mainly avoided.
S1: and continuously sampling the motor current of the traveling mechanism of the window cleaning robot according to a fixed frequency.
In this embodiment, when the window-cleaning robot normally walks, the sampling circuit (such as the sampling circuit in embodiment 1) collects one piece of data every millisecond, and after 3 pieces of current data are collected, the highest value and the lowest value of the current are removed, and the middle value is selected as a current sampling value and stored in the memory of the single chip microcomputer.
S2: and respectively subtracting the current sampling value from the previous n continuous current sampling values and calculating the sum of the subtraction values.
As shown in connection with fig. 4, at time t by the sampling circuit 1 To t n Obtaining n continuous current sampling values i in total 1 To i n The numerical value is amplified by an amplifying circuit and then stored in a memory of the single chip; the single-chip microcomputer is at the moment t n+1 Obtaining the n +1 th sampling current value i n+1 Then the obtained n +1 th sampling current value i n+1 Respectively with time t 1 To t n Obtaining n successive current sampling values, subtracting to obtain n subtracted values, and calculating the sum I of the n subtracted values 1 I.e. I 1 =∑(i n+1 -i k ) K =1, 2, 3, · n. As can be seen from the formula, I 1 The value of (c) may be positive or negative.
It should be noted that, when the window-cleaning robot is walking, the time of noise current is short, in order to reduce the influence of the noise current sampling value on the sum of the subtraction values, the noise current sampling value can be realized by setting the value of n, and if the sampling circuit can collect j current sampling values at the maximum within the noise current duration, the noise current sampling value is realized by setting n to be more than or equal to 3j. Specifically, it is known from experience and test data that the duration of the noise current is generally less than 100ms, that is, 33 current samples can be collected at the sampling frequency in step S1, so that n is set to be greater than 99, specifically, n is set to be 100 in this embodiment.
S3: step S2 is repeated until the sum of m subtraction values is obtained.
Similarly, the single-chip microcomputer is at the time t n+2 Obtaining the n +2 th sampling current value i n+2 Then the obtained n +2 th sampling current value i n+2 Respectively associated with time t 2 To t n+2 Obtaining n continuous current sampling values in total, subtracting to obtain n difference values, and calculating the sum I of the n difference values 2 I.e. I 2 =∑(i n+2 -i k ) K =2, 3, 4,. N, n +1, and so on, until the m-th subtraction value sum I is obtained m ,I m =∑(i n+m -i k ),k=m、m+1、...、n+m-1。
S4: and judging the current walking state of the window-cleaning robot according to the accumulated value of the sum of the m subtraction values.
According to step S3, a sum of m subtraction values can be obtained, which are then added to obtain an accumulated value D, i.e. D = ∑ I k And k =1, 2, 3.. Times, m, and then comparing the accumulated value D with a set threshold value to determine the current walking state of the window-wiping robot. For example, in the present embodiment, two thresholds are set, including detection for detecting that the window wiping robot collides with the window frame and detection for slipping. Specifically, when the window cleaning robot collides with the window frame, the motor current of the traveling mechanism (crawler) of the window cleaning robot is increased and continues for a period of time, at this time, the accumulated value D can be compared with a set threshold value, and when the accumulated value D is greater than the set threshold value, the window cleaning robot is considered to move to the window frame; when the walking mechanism of the window cleaning robot slips (the friction between the surface of the crawler and the glass is too small, and the crawler rotates but does not move relative to the surface of the glass), the motor current of the walking mechanism (the crawler) is reduced and continues for a period of time, at the moment, the accumulated value D can be compared with a set threshold value, and when the accumulated value D is smaller than the set threshold value, the window cleaning robot is considered to be in a slipping state.
It should be noted that, in order to reduce the influence of the noise current sampling value on the accumulated value D, the magnitude of m may be set, and if the sampling circuit can collect a maximum number of current sampling values within the noise current duration, m is set to be greater than or equal to j. Specifically, it is known from experience and test data that the duration of the noise current is generally less than 100ms, that is, 33 current samples can be collected at the sampling frequency in step S1, so that m is set to be greater than 33, specifically, m is set to be 50 in this embodiment.
S5: and controlling the window cleaning robot to execute corresponding actions according to the walking state.
When the window cleaning robot is detected to touch the window frame, the window cleaning robot is controlled to perform walking action or retreating action along the frame; when detecting that window-cleaning robot is in the state of skidding, then send alarm information in order to indicate work unusual.
Next, the procedure of detecting the movement of the window cleaning robot in this embodiment will be described in detail.
As shown in fig. 5, it is a real-time sampling current curve diagram of a sampling circuit, where the ab segment and the cd segment are current sampling values when the window cleaning robot works normally, the bc segment is a noise current sampling value (mostly when the window cleaning robot shakes), the de segment is a current sampling value when the window cleaning robot works normally to touch a window frame, and the ef segment is a current sampling value after the window cleaning robot collides with the window frame; as shown in fig. 6, which is a graph corresponding to the accumulated value D of the current sampling values in fig. 5, when the window cleaning robot is in a normal working state, the current is relatively stable, the accumulated value D is also substantially stable and is between two threshold values (threshold value 1 for window frame detection and threshold value 2 for track slip detection), when a noise current is sampled in a bc section, because the duration of noise is short, the number of sampled current sampling values which are larger (or smaller) is also smaller, the accumulated value D is only raised a little and is between the threshold value 1 and the threshold value 2, and the window cleaning robot is judged to be in a normal working state, and the walking state of the window cleaning robot cannot be misjudged due to the noise current; when the window cleaning robot collides with the window frame, the current of the motor of the crawler belt is increased and continues for a period of time, at the moment, the accumulated value D is rapidly increased and exceeds the threshold value 1, and then the window cleaning robot is judged to collide with the window frame, and then the moving direction is changed, such as retreating, turning or walking along the edge of the window.
As shown in fig. 7, it is another real-time sampling current curve diagram of the sampling circuit, where the ab segment and the cd segment are current sampling values when the window cleaning robot works normally, the bc segment is a noise current sampling value (mostly when the window cleaning robot shakes), the de segment is a current sampling value when the window cleaning robot works normally to the crawler belt slips, and the ef segment is a current sampling value after the crawler belt slips; as shown in fig. 8, which is a graph corresponding to the accumulated value D of the current sampling values in fig. 7, when the window cleaning robot is in a normal operating state, the current is relatively stable, the accumulated value D is also substantially stable and is between two threshold values (threshold value 1 for window frame detection and threshold value 2 for track slip detection), when a noise current is sampled in the bc section, because the duration of noise is short, the number of the sampled current sampling values which are larger (or smaller) is also smaller, the accumulated value D is only slightly increased and is between the threshold values 1 and 2, and the window cleaning robot is judged to be in a normal operation, and the error judgment on the walking state of the window cleaning robot due to the noise current is not caused; when the window cleaning robot slips due to insufficient friction force between the crawler and the glass surface, the motor current of the crawler is reduced and continues for a period of time, at the moment, the accumulated value D is rapidly reduced and is lower than the threshold value 2, the window cleaning robot is further judged to be in a slipping state, and then the window cleaning robot sends alarm information through an alarm device (such as a buzzer, an alarm indicator lamp or sends information to a mobile phone).
The above-mentioned embodiments are merely examples of the present invention, which should not be construed as limiting the scope of the invention, and therefore all equivalent variations to the claims are intended to be included in the scope of the invention.