An offline interactive state machine control method and device based on decoupling of blowing events and identification windows, equipment and medium
By employing a state machine control method in offline interactive devices, an interaction context is established and the blowing events and recognition results are cached. This solves the problems of false triggering and inconsistent states caused by the asynchrony between the blowing events and the visual recognition window, thus achieving stable and secure execution of the device.
Patent Information
- Application Number
- CN202611357299.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, the asynchrony between the air blowing event and the visual recognition window leads to problems such as false triggering, missed triggering, repeated execution, and inconsistent states of multiple actuators, which are particularly difficult to effectively unify in offline interactive devices.
A state machine control method is adopted, which establishes an interaction context, caches the air blowing event and the recognition result respectively, and combines multi-frame stabilization judgment and software reset mechanism to achieve unified management and safe recovery of asynchronous events.
It reduces false triggering caused by transient noise, ensures synchronous processing of identification results and air blowing type, avoids repeated execution, and ensures safe recovery of multiple actuators in abnormal situations.
Smart Images

Figure CN123177280A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of embedded interactive control, edge vision recognition, and multi-actuator collaborative control, and particularly to a control method, apparatus, electronic device, and computer-readable storage medium for asynchronous caching, same-round verification, gating execution, and safe reset of air blowing type events and visual recognition results in offline interactive devices. Background Technology
[0002] Offline interactive devices typically sense user actions through local sensors, acquire objects to be identified through cameras or other data acquisition devices, and have a local controller handle recognition, decision-making, and actuator feedback. Because these devices do not rely on cloud services, their control systems need to complete a closed loop from event triggering to action completion under limited computing power and storage conditions.
[0003] For interactive devices that simultaneously feature breath input and visual recognition, the breath event and the image recognition window have different temporal characteristics. The breath start event typically arrives earlier and is suitable as a signal to initiate an interaction; the recognition result, however, requires image acquisition, preprocessing, local inference, and multi-frame stabilization before it can be obtained. Whether a breath is short or long may also depend on the release event or a duration threshold, therefore the breath type may precede or follow the stable recognition result.
[0004] Existing control methods, which immediately drive the actuator upon the occurrence of any of the following conditions—the start of air blowing, the single-frame recognition result, or the release event—are prone to mistaking transient noise or unstable candidate results for valid input. Furthermore, the air blowing type may be lost if the release event occurs before the recognition is completed. When multiple actuators operate in parallel, timeouts or mid-process resets can also cause lights, servos, audio, or fans to remain in an unsafe state. Therefore, it is necessary to unify the programming of air blowing events, recognition windows, and actuator feedback. Summary of the Invention
[0005] Technical issues
[0006] The present invention aims to provide an offline interactive state machine control method based on the decoupling of the air blowing event and the recognition window, so as to solve the problems of false triggering, missed triggering, repeated execution, and inconsistent states when multiple actuator actions end or are reset caused by the asynchrony between the air blowing event and the recognition window.
[0007] Technical solution
[0008] To address the aforementioned technical problems, this invention provides a control method for an offline interactive device. The offline interactive device includes an airflow sensing module, an image acquisition module, a local recognition module, a state machine control module, a strategy generation module, an actuator control module, a reset module, and local parameter storage. The state machine control module establishes an interaction context with a single airflow interaction as the boundary, and associates airflow events, recognition result events, parameter versions, and actuator feedback with the interaction context. The overall relationship is as follows: Figure 1 As shown.
[0009] The state machine maintains at least the idle state, the recognition state, the waiting-for-blow-type state, and the action execution state. When the controller detects a blow-start event in the idle state, it establishes an independent interaction context for this interaction, assigns an interaction identifier and a recognition window identifier, clears the previous round's cache, starts image acquisition and local recognition, and enters the recognition state. The blow-start event is only used to establish this round of interaction and start the recognition window; it does not directly drive the actuator.
[0010] The local recognition module identifies one or more frames of an image within the recognition window, outputting candidate categories, confidence levels, or rejection results. The state machine performs stability checks on the candidate results, latching the recognition results after satisfying majority voting, continuity, weighted confidence, the difference between the highest and second-highest candidate, or a combination thereof. Release, short-blow, or long-blow events only update the blowing type cache within the same interaction context.
[0011] When the recognition result arrives before the air blowing type, the state machine enters a waiting state for the air blowing type, maintaining the latched recognition result and preventing the actuator from acting solely based on the recognition result. When the air blowing type arrives before the recognition result, the state machine buffers the air blowing type and continues to complete the current recognition window. The strategy generation module only generates an execution strategy when both the latched recognition result and the air blowing type are valid, belong to the same interaction context, and no software reset event has been received. The aforementioned interaction context and data flow are as follows: Figure 2 As shown, the arrival order of the two events is as follows: Figure 3 As shown.
[0012] Software reset events are prioritized over actuator feedback events, recognition window events, and airflow events. Upon receiving a software reset event in any state, the state machine closes the current recognition window, clears candidate results, latched results, airflow type, and execution strategy, sends a stop, reset, or shut-off command to the actuator control module, and returns to a safe idle state. The state transition relationships are as follows: Figure 4 As shown.
[0013] The local recognition module can load recognition model parameters, recognition thresholds, rejection thresholds, and action mapping tables obtained from offline configuration. Each round of interaction is bound to a parameter version at startup; the new version is only used in the next round of interaction after the current round ends and returns to an idle state, thus avoiding cross-version mixing of recognition results, blowing types, and action mappings. The parameter version handover relationship is as follows: Figure 5 As shown.
[0014] The actuator control module maintains an actuator status table, recording the target state, current state, and safety state of each actuator. The execution strategy can control white backlighting, RGB ambient lighting, mechanical actuators, audio actuators, and fan actuators in parallel. Upon normal completion of an action, timeout, or software reset, the actuators uniformly stop, return to their original position, or shut down according to the status table. The recovery process is as follows: Figure 6 As shown.
[0015] Beneficial effects
[0016] 1. By limiting the blowing start event to the trigger condition of "establishing interaction and starting the recognition window" instead of the direct action condition, and combining it with multi-frame stable latching, false triggering caused by instantaneous airflow or single-frame candidate results directly driving the action can be reduced.
[0017] 2. By caching the air type and the recognition result separately, the current recognition window can continue to be completed when the recognition result arrives first, thus eliminating the dependency on the fixed order of the two types of events.
[0018] 3. By using interactive identifiers, identification window identifiers, and execution gating conditions, incorrect combinations of identification results and blowing types in different rounds can be prevented, reducing repeated executions.
[0019] 4. By resetting the highest priority, actuator completion, and safety status table through software, the status of lights, servos, audio, and fans can be uniformly restored after normal completion, timeout, or abnormal reset. Attached Figure Description
[0020] Figure 1 The diagram illustrates the input, control, and feedback relationships between the airflow sensing module, image acquisition module, local recognition module, state machine control module, strategy generation module, actuator control module, reset module, and local parameter storage.
[0021] Figure 2 It shows the data relationship between the interaction identifier, recognition window identifier, candidate result cache, latched recognition result, air blowing type cache, execution start flag and reset pending flag corresponding to an interaction, as well as the discard path of the identifier inconsistency event.
[0022] Figure 3It shows the relative timing when the stable identification result arrives before the blowing type, and when the blowing type arrives before the stable identification result, and shows the convergence and gating moments of the two types of events in the same interaction context.
[0023] Figure 4 It shows the transitions between the idle state, the identification state, the waiting for air type state, and the action execution state, as well as the paths of rejection, identification window timeout, waiting timeout, action completion, action timeout, and software reset returning to the idle state.
[0024] Figure 5 It shows the current valid parameter version bound to the interaction, the waiting round boundary for the parameter version to take effect, the integrity check, and the process of loading the new parameter version in the next round of interaction.
[0025] Figure 6 This illustrates the process of execution strategy parsing, parallel deployment of multiple executors, active executor masking, completion and failure state merging, action timeout, and software reset prioritizing the restoration of a safe state.
[0026] Figure 7 The diagram shows an implementation of a shadow puppet interactive device, including a writing area, an airflow sensor, a fan, a camera, a local controller, a fixed white backlight behind the screen, RGB ambient lighting around the device, a speaker, and three servo motors that control the head, left arm, and right arm respectively.
[0027] Figure 8 It illustrates the high-level workflow relationships between image acquisition, image preprocessing, local OCR inference, candidate result caching, multi-frame stable latching, same-round verification, and expired result discarding. Detailed Implementation
[0028] The embodiments of the present invention will be described below with reference to the accompanying drawings. The state names, thresholds, time parameters, model categories, action durations, and action mappings in the embodiments are used to illustrate the control relationships, and those skilled in the art can make adjustments without departing from the core control relationships of the present invention.
[0029] Example 1: Device Module and Interaction Context
[0030] like Figure 1As shown, the airflow sensing module is used to collect airflow intensity and generate events such as blowing start, release, and short or long blowing types; the image acquisition module is used to acquire images of the writing area to be recognized within the recognition window; the local OCR recognition module is used to perform image preprocessing, offline model inference, and multi-frame stabilization determination; the state machine control module is used to maintain the state, interaction context, event validity, and execution gating; the policy generation module is used to map the latched recognition results and blowing types into action policies; the actuator control module is used to control the lights, servos, audio, and fans; the reset module is used to trigger software reset; and the local parameter storage is used to save the model, thresholds, mapping tables, and parameter versions.
[0031] As shown in Figure 2, each air-blowing interaction establishes an independent interaction context. This interaction context includes at least the interaction identifier I (index ctx), the recognition window identifier I (index r), the candidate result cache, the latched result L (index r), the air-blowing type validity flag L (index b), the current execution strategy, and the reset flag R. Before starting a new round of interaction, the controller invalidates the previous round's context to prevent historical results from participating in the generation of the current strategy.
[0032] Example 2: State Machine Control Flow
[0033] In the IDLE state, the controller listens to the airflow sensor module. Upon detecting a blow start event that meets the minimum duration and anti-shake conditions, the controller generates a new interaction identifier and recognition window identifier, records the start time, clears the candidate cache, latched results, blow type, and previous execution flag, binds the current active_version, starts image acquisition and local recognition, and enters the RECOGNIZING state.
[0034] In the recognition state, the breath type event and the recognition result event are processed independently. If `result_valid` becomes valid first while `breath_type_valid` remains invalid, the state machine enters `WAIT_BREATH_TYPE` and maintains the current recognition window flag. If `breath_type_valid` becomes valid first, only the breath type valid flag is cached without closing the current recognition window, and acquisition and recognition continue until a stable result is obtained, a rejection occurs, or the recognition window times out. The interaction flag is verified before each event is processed; recognition events also verify the recognition window flag. Events that fail verification are discarded.
[0035] When the dual-condition execution gating is satisfied, the state machine first atomically sets `execution_started`, then generates and issues an execution strategy based on the identification window, the valid flag for the air blowing type, and the current round's parameter version, entering `PERFORMING`. This ensures that even if a duplicate release event, identification result event, or execution gating check is subsequently received in the same round, the action will not be restarted repeatedly. After all active actuators complete, an execution failure occurs, an action times out, or a software reset is received, the controller performs a unified safety recovery, invalidates the current context, and returns to `IDLE`.
[0036] Example 3: Determining the Type of Air Blowing
[0037] The duration of the blow-off is determined by the difference between the release time and the start time of the blow-off, and can be classified as a short blow or a long blow based on a duration threshold. For interactions where the duration has not yet reached the long blow-off threshold, a short blow-off can be determined when the release event arrives; when the duration reaches the long blow-off threshold, a long blow-off event can be generated in advance before the release. For example:
[0038] In equation (1), T (subscript b) is the duration of the current blowing, t (subscript rel) is the release time, and t (subscript start) is the start time of the blowing. Based on the configurable short-blow and long-blow boundary thresholds, S and L represent short-blow and long-blow, respectively. The airflow sensing module can also set the shortest effective blowing time and the release anti-shake time to filter out short noises and mechanical vibrations.
[0039] Example 4: Image Acquisition, Preprocessing, and Offline Recognition Process
[0040] like Figure 8 As shown, in one embodiment of a shadow puppet interactive device, the image acquisition module connects to a camera via a MIPI CSI interface and acquires RGB565 format image frames containing the water-writing area within the recognition window at preset sampling intervals. These image frames are associated with the current interaction identifier and the recognition window identifier so that subsequent recognition results can be verified in the same round.
[0041] The local recognition module first extracts the region of interest based on the location of the writing area in the device, reducing the interference of device borders, screen backlight, surrounding lights and non-writing background on recognition; then it performs color channel conversion or grayscale processing on the RGB565 image to obtain the grayscale intensity map corresponding to the writing area.
[0042] Based on the grayscale image, the controller can estimate the background brightness according to the global or local background grayscale features of the writing area, and perform binarization in combination with a preset threshold to separate the foreground and background areas of the water-writing characters. For the binarized image, candidate character regions can be determined by connected component analysis, contour analysis, foreground pixel boundary analysis, or character region analysis, and isolated noise with an area smaller than a preset threshold can be removed.
[0043] After obtaining the candidate character regions, the local recognition module scales, pads, centers, or normalizes the character regions while maintaining their aspect ratio, forming a 64×64 pixel model input image. Based on the input quantization parameters corresponding to the offline recognition model, the 64×64 input is converted into an INT8 tensor and fed into the TensorFlow Lite Micro offline inference model deployed on the local controller.
[0044] The offline inference model outputs 12 candidate results. The controller reads the category scores from the output tensor, obtains the candidate categories of the current frame and their corresponding scores, and maps the category codes to preset single-character labels, poem labels, or rejection results through a local label mapping table; single-character labels may include device interaction categories such as "fire", "water", and "moon".
[0045] The current frame candidate results do not directly drive the executor, but are written to a multi-frame candidate result cache bound to the current interaction identifier and the recognition window identifier. If the image processing task, model inference task, or callback result is delayed after the recognition window fails, the software is reset, or a new round of interaction is established, it will be discarded because the two types of identifiers it carries are inconsistent with the current context.
[0046] Example 5: Multi-frame stability determination
[0047] The recognition window can capture one or more frames of images at preset intervals. Each frame infers candidate categories and the model's output score; it can use equal-weighted majority voting or classify categories according to frame weights. c The scores are accumulated, and the category with the highest accumulated score is selected as the current candidate category:
[0048] In equation (2), p(subscript k)(c) represents the model output score or normalized confidence score of the k-th frame belonging to category c, w(subscript k) represents the weight of that frame, S(subscript c) represents the cumulative score of category c, C represents the set of candidate categories, and ĉ represents the candidate category with the highest cumulative score. The current device can use equal-weighted majority voting to achieve stable multi-frame determination; when it is necessary to further suppress ambiguous frames or similar categories, frame weights, confidence scores, and candidate differences can also be combined.
[0049] To avoid single-frame candidates directly triggering actions, stable latch conditions can be set within the recognition window. Stable latch conditions can at least use majority voting or the number of consecutive consensuses; when the model output provides comparable scores, the cumulative score, the difference between the first and second candidates, the rejection threshold, and the number of consecutive consensuses can also be combined. For example:
[0050] In equation (3), L (subscript r) represents the latched recognition result, S (subscript c) and S (subscript (2)) represent the cumulative scores of the first and second candidates, respectively, θ (subscript c) is the score or confidence threshold, θ (subscript m) is the candidate difference threshold, V (subscript ĉ) is the number of consecutive consensuses or votes for candidate category ĉ, and N (subscript min) is the minimum number of consensuses. When the stability condition is not met, result_valid remains invalid; when the stability condition is not met by the end of the recognition window, a rejection result is generated instead of an action execution strategy.
[0051] A set of illustrative time parameters can be set as follows: minimum effective blowing time 60 ms, long blowing threshold 800 ms, stabilization release time 120 ms, single-round recognition window 5000 ms, and OCR sampling interval 1000 ms. The action strategy can be configured with different maximum durations depending on the blowing type, such as 60000 ms for short blowing and 120000 ms for long blowing. The above values are example values and can be configured based on sensor response, model inference speed, action choreography, and user experience; they do not constitute the sole limitation on the protection scope.
[0052] Example 6: Asynchronous event aggregation, same-round verification and execution gating
[0053] like Figure 3 As shown, stable identification results and airflow type can arrive in different orders. The state machine does not use the order of any event as the execution condition, but caches both separately and recalculates the execution gating after each cache update. The identification result event carries L(index ctx) and L(index r), and the airflow type event carries L(index ctx); the state machine only receives events that are consistent with the current context and are still within their valid lifetime. One gating representation is as follows:
[0054] In equation (4), G represents the gating result, L (subscript r) and L (subscript b) correspond to the valid latch result and valid breath type indicated by result_valid and breath_type_valid, respectively, R corresponds to reset_pending, I (subscript r), I (subscript b) and I (subscript ctx) represent the round identifiers associated with the recognition result, breath type and current interaction context, respectively; t (subscript lock) and t (subscript type) are the latching time of the recognition result and the determination time of the breath type, respectively, and t (subscript exec) is the time when execution is allowed to start after all conditions are met. In actual execution, execution_started=0 is also checked, and after G changes from invalid to valid, execution_started=1 is atomically set first, and then the execution strategy is generated and issued.
[0055] If the interaction identifier associated with an event is inconsistent with the current interaction, the window identifier associated with the event is inconsistent with the current recognition window, or the current context has expired due to timeout, action start, action end, or reset, then the event will not update the cache. This expiration mechanism is used to handle cases where camera tasks, sensor tasks, or actuator callbacks are delayed after round switching.
[0056] Example 7: Event Scheduling and Security Reset
[0057] The state machine control module maintains a queue of events to be processed or an equivalent set of periodic events. For events occurring simultaneously within the same control cycle, the software reset event has the highest processing priority; actuator feedback, identification window events, and airflow events are processed in a preset order. One formal representation of this is:
[0058] In equation (5), Q (subscript k) is the set of events to be processed in the kth processing cycle, P(e) is the event priority, and e (subscript reset), e (subscript act), e (subscript rec), and e (subscript air) represent the software reset event, actuator feedback event, identification window event, and airflow event, respectively. If the reset event is hit, the controller immediately sets reset_pending and skips the low-priority identification, airflow, and motion generation processes that have not yet been executed in this control cycle.
[0059] The reset process is executed in the following order: invalidate the context—close the identification window—clear the candidate and latch cache—clear the blow type—abort policy generation—stop or revert the executor—clear or mark the old round events in the queue—return to IDLE. When a new interaction round is generated after the reset, the old interaction identifier and identification window identifier are no longer valid, so even if an old task callback is received later, the old actions will not be restored.
[0060] Example 8: Parameter Version Handover
[0061] like Figure 5 As shown, the local parameter storage maintains `active_version` and `pending_version`. Each version record contains at least `version_id`, `model_digest` (model summary or validation value), preprocessing configuration identifier, model input quantization configuration, stability decision threshold, rejection threshold, and action mapping table identifier. At the start of the blow-through, the current interaction is bound to `active_version`; this binding remains unchanged during the current `RECOGNIZING`, `WAIT_BREATH_TYPE`, and `PERFORMING` cycles.
[0062] When new parameters are generated through offline configuration or local updates, they are first written to `pending_version` and an integrity check is performed; the original `active_version` continues to be used in the current round. Only when the state machine returns `IDLE` and there is no active interaction will the validated `pending_version` be atomically switched to the new `active_version`. If the model summary, configuration fields, or validation values do not meet the integrity requirements, the switch is canceled and the original `active_version` continues to be used, thus avoiding the mixing of model, threshold, and action mappings across versions in the same round.
[0063] Example 9: Multiple actuators complete convergence and safe recovery
[0064] like Figure 6 As shown, the execution strategy can include executor identifier, target parameters, action duration, start order, stop order, and safety state. After strategy parsing, the corresponding bit of active_executor_mask is set according to the executor actually activated in this round; when an executor completes its planned action, the corresponding bit of completed_executor_mask is set, and when execution fails or the target state cannot be reached, the corresponding bit of failed_executor_mask is set.
[0065] In equation (6), m is the number of controlled actuators in this round, d (subscript i) is the completion flag of the i-th actuator, D is the condition for full completion, u (subscript i) is the control quantity of the i-th actuator, u (subscript i, superscript safe) and u (subscript i, superscript plan) represent the safety control quantity and the planned control quantity, respectively, t (subscript 0) is the start time of the action, and T (subscript max) is the maximum allowed action duration. When using a mask, the normal completion condition is equivalent to (completed_executor_mask&active_executor_mask)=active_executor_mask and failed_executor_mask=0; when failed_executor_mask is non-zero, reaches T_max, or reset_pending is set, safe recovery is entered.
[0066] Upon safe recovery, the three servos return to their respective preset midpoint or safe angle, audio playback stops, fans stop or switch to a safe state, RGB ambient lighting returns to standby mode, and the white backlight remains a single-color white light or is turned off according to the standby strategy. After the actuators have recovered, the current round mask is cleared and the current interaction context is invalidated.
[0067] Example 10: Shadow Puppet Interactive Device
[0068] like Figure 7 As shown, an interactive shadow puppet device includes a writing area, an airflow sensor, a fan, a camera, a local controller, a white backlight behind a screen, RGB ambient lights surrounding the device, a speaker, and head servos, left arm servos, and right arm servos that control the shadow puppet's head, left arm, and right arm respectively. The white backlight provides only stable white light to form a clear shadow puppet outline and does not change color based on the recognition result; the RGB ambient lights only provide color feedback for the surrounding environment.
[0069] After the user finishes writing, they blow air into the writing area. This "blowing start" event establishes the interaction context and launches the relevant program. A fan can assist in drying the writing area for a configurable duration. The camera captures images after a preset acquisition delay or during the drying process, and the local OCR module recognizes individual Chinese characters. Once the recognition result is stably latched and the blowing type is determined, the state machine generates lighting, servo, audio, and fan strategies based on the action mapping table. Table 1 provides an illustrative mapping of single-character patterns.
[0070] Table 1. Examples of Single-Word Pattern Action Mapping
[0071] The above three servo motor movements are all completed by a single rotational degree of freedom, without requiring the shadow puppet's torso to translate, walk, rotate as a whole, or engage in complex linkages. After the movement is completed, the head servo, left arm servo, and right arm servo return to the preset mid-position angle, the RGB ambient light returns to standby mode, and the speaker stops playing; the white backlight can remain on or be turned off according to the device's standby strategy.
[0072] The output of the 12 model categories is converted into specific interaction tags through a local tag mapping table. Single-character tags and poem tagging can be set simultaneously: single-character tags directly look up the single-character action mapping, while poem tagging can look up preset combined action sequences, WAV audio, and lighting schemes. For outputs that do not belong to valid interaction tags, lack stability conditions, or do not meet the rejection criteria, the state machine generates a rejection result and ends the current round without executing the performance action.
[0073] Example 11: Exception Handling and Logging
[0074] If no stable result is obtained after the recognition window ends, the controller generates a rejection event, invalidates the current context, and returns to IDLE. If WAIT_BREATH_TYPE exceeds the waiting time limit, the controller clears the recognition result, the blowing type, and its validity flag, and ends the current round. If PERFORMING exceeds T (subscript max), failed_executor_mask is non-zero, or the actuator state is abnormal, the controller immediately enters safe recovery. Software reset takes precedence in any of the above stages.
[0075] When the controller records state transitions and event handling logs, each record may include an interaction identifier, an identification window identifier, an active_version, an entry state, a triggering event, an event association identifier, an updated cached object, a gating result, an executor mask, and the next state. The log is not a necessary condition for action execution, but is used to verify whether expired events have been discarded, whether the old context has become invalid after a reset, and to distinguish between normal completion, rejection, timeout, action timeout, execution failure, and software reset.
[0076] Example 12: Electronic Devices and Storage Media
[0077] This invention can also be implemented as an electronic device, a computer-readable storage medium, or a computer program product. The electronic device includes a processor, a memory, and an interface circuit. The interface circuit connects to an airflow sensor, an image acquisition device, and one or more actuators. When the program in the memory or the instructions in the computer program product are executed by the processor, corresponding steps in interactive context establishment, recognition window management, asynchronous event caching, same-round verification, execution gating, parameter version handover, multi-actuator convergence, and safe reset are implemented.
Claims
1. An offline interactive control method based on decoupling of air blowing events and recognition windows, characterized in that, include: In response to a blowing start event that meets preset conditions, establish the interaction context for this interaction, generate an interaction identifier to distinguish the interaction rounds, and launch an identification window with an identification window identifier. The system receives and caches the recognition result and the blowing type of the current interaction, respectively, so that the recognition result and the blowing type are associated with the corresponding interaction identifiers; if either the recognition result or the blowing type arrives first, it keeps the cached effectively without driving the actuator alone, and waits for the other to arrive. When the identification result and the blowing type are both valid, the interaction identifier associated with them is consistent with the current interaction identifier, the identification window is valid, and there is no reset pending flag, an execution strategy is generated based on the identification result and the blowing type, and the start flag is executed before the execution strategy is executed. When a software reset event is received in any state, the current interaction context and recognition window are invalidated, the current action is stopped, the recognition result and air blowing type cache of the current interaction are cleared, and one or more actuators are restored to a preset safe state.
2. The method according to claim 1, characterized in that, When the recognition result arrives before the air type, the recognition result is latched and the system enters a waiting state for the air type; when the air type arrives before the recognition result, the air type is cached and the current recognition window continues to work.
3. The method according to claim 1, characterized in that, The interaction context includes at least an interaction identifier, an identification window identifier, a candidate result cache, a latched identification result, an identification result validity flag, a blowing type validity flag, an execution start flag, and a reset pending flag. If the interaction identifier associated with the received event is inconsistent with the current identifier, the event will be discarded as an expired event. When a software reset event is detected in the same control cycle, the reset pending flag is set first, and low-priority processing that has not yet been executed is skipped.
4. The method according to claim 1, characterized in that, The local recognition module performs preprocessing and local inference on one or more frames of images within the recognition window, and obtains a stable recognition result based on one or more of the following methods: multi-frame voting, continuous consistency, or confidence threshold. The recognition result remains invalid when the stability condition is not met.
5. The method according to claim 4, characterized in that, The image acquisition module acquires RGB565 images; the local recognition module performs grayscale, binarization, character region extraction, and scaling processing on the writing area to form the model input image, which is then input into the offline inference model; the model outputs candidate results, which are mapped to preset single-character labels, poem labels, or rejection results through a local label mapping table.
6. The method according to claim 1, characterized in that, The blowing type includes at least short blowing and long blowing, which is determined based on the duration between the start and release times of blowing, or determined in advance when the duration reaches a preset long blowing threshold; the blowing event is filtered by the shortest effective blowing time and anti-shake conditions.
7. The method according to claim 1, characterized in that, When the execution gate changes from unsatisfied to satisfied, the execution start flag is first atomically set, and then the execution strategy is generated; repeated events in the same round that arrive after the execution start flag has been set will not restart the execution strategy.
8. The method according to claim 1, characterized in that, The local parameter storage maintains the currently valid parameter version and the parameter version to be applied. In each round of interaction, the current valid parameter version is bound when the interaction context is established. After the current round ends, the integrity of the parameter version to be applied is checked. If the check passes, it is switched to the new valid parameter version.
9. The method according to claim 1, characterized in that, The actuator maintains an activity mask, a completion mask, and a failure mask for the actuators participating in the action in this round. When the activity mask and the completion mask are all matched and the failure mask is zero, the round is considered to be completed normally. If the failure mask is non-zero, the action times out, or the software is reset, the incomplete action is stopped and a safe recovery is performed.
10. An electronic device comprising a processor, a memory, and an interface circuit, the interface circuit being used to connect an airflow sensing module, an image acquisition module, and one or more actuators, the memory storing a computer program, characterized in that... When the computer program is executed by the processor, it implements the method according to any one of claims 1 to 9.
11. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the method described in any one of claims 1 to 9.
