Position data acquisition method and apparatus, electronic device, and storage medium
By performing translation correction on the initial angle data of the magnetic encoder, the angle deviation caused by different magnetic field polarities is eliminated, achieving high-precision and reliable acquisition of the mover position in the magnetic drive conveyor system and solving the problem of inaccurate magnetic encoder position data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU ZONGWEI AUTOMATION CO LTD
- Filing Date
- 2025-09-30
- Publication Date
- 2026-08-04
AI Technical Summary
Magnetic encoders suffer from inaccurate position data due to the dependence of their angle output on the direction of the magnetic field, making it impossible to accurately distinguish the true position of the mover.
By performing translation correction processing on the initial angle data obtained by the magnetic encoder, the 180-degree fixed offset caused by the difference between the N pole and the S pole is eliminated, ensuring that uniform and unambiguous corrected angle data is generated.
It improves the accuracy and reliability of acquiring the position of the mover in the magnetic drive conveyor system, ensuring the uniqueness and accuracy of the position data without requiring modification to existing hardware.
Smart Images

Figure CN121297641B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to location data acquisition methods, apparatus, electronic devices and storage media. Background Technology
[0002] In industrial automation fields such as magnetic drive conveyors, magnetic encoders are widely used due to their non-contact and low-wear characteristics. These encoders use components such as Hall sensors to detect changes in the magnetic field and output angle data to determine the position of the mover. However, their working principle makes the angle output dependent on the direction of the magnetic field. When the N pole or S pole of the magnetic grating is detected, even if the mover is in the exact same physical position, the angle signal output by the sensor will present two possible scenarios due to the different polarities of the magnetic field. This means that the system cannot directly distinguish the true position of the mover based solely on the received angle data, resulting in inaccurate position data obtained using magnetic encoders. Summary of the Invention
[0003] This application provides a location data acquisition method, apparatus, electronic device, and storage medium, which can improve the accuracy of location data acquired using a magnetic encoder.
[0004] To achieve the above objectives, a first aspect of this application proposes a location data acquisition method, the method comprising:
[0005] Acquire the initial angle data detected by the magnetic encoder under the current magnetic field polarity;
[0006] The initial angle data is translated and corrected to obtain the corrected angle data;
[0007] Based on the corrected angle data, the standard position data corresponding to the initial angle data is obtained.
[0008] In some embodiments, the translation correction process performed on the initial angle data to obtain corrected angle data includes:
[0009] When the current magnetic field polarity is the first preset polarity, the initial angle data is used as the corrected angle data;
[0010] When the current magnetic field polarity is the second preset polarity, the initial angle data is adjusted based on the preset offset to obtain the corrected angle data.
[0011] In some embodiments, adjusting the initial angle data based on a preset offset to obtain the corrected angle data includes:
[0012] When the second preset polarity is Antarctica, the corrected angle data is obtained by subtracting the preset offset from the initial angle data;
[0013] When the second preset polarity is North Pole, the corrected angle data is obtained by adding the preset offset to the initial angle data.
[0014] In some embodiments, obtaining the standard position data corresponding to the initial angle data based on the corrected angle data includes:
[0015] Select a target value range from multiple preset value ranges that matches the corrected angle data;
[0016] The standard location data is obtained based on the location data corresponding to the target numerical range.
[0017] In some embodiments, the method further includes:
[0018] Obtain the number of magnetic pole pairs in the magnetic drive conveyor system, and obtain the position data measurement range of the magnetic encoder;
[0019] The circumferential angle and the position data measurement range are uniformly divided based on twice the number of magnetic pole pairs to obtain multiple preset value ranges and the position data corresponding to each preset value range.
[0020] In some embodiments, when the initial angle data is measurement data during the movement of the mover, the method further includes:
[0021] Obtain the setting position data of the magnetic encoder in the magnetic drive conveyor system;
[0022] Based on the set position data and the standard position data, the real-time position data of the mover is obtained.
[0023] In some embodiments, obtaining the real-time position data of the mover based on the set position data and the standard position data includes:
[0024] The error angle value is obtained based on the difference between the corrected angle data and the lower limit of the target numerical range;
[0025] The error angle ratio is obtained based on the ratio of the error angle value to the range length of the target value range;
[0026] The error position data is obtained by multiplying the error angle ratio by the position data length of the target value range;
[0027] Based on the set position data, the standard position data, and the error position data, the real-time position data of the mover is obtained.
[0028] To achieve the above objectives, a second aspect of this application provides a location data acquisition device, the device comprising:
[0029] The acquisition module is used to acquire the initial angle data detected by the magnetic encoder under the current magnetic field polarity;
[0030] The correction module is used to perform translation correction processing on the initial angle data to obtain corrected angle data;
[0031] The position data calculation module is used to obtain the standard position data corresponding to the initial angle data based on the corrected angle data.
[0032] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the location data acquisition method as described in the first aspect.
[0033] To achieve the above objectives, a fourth aspect of the present application provides a storage medium, which is a computer-readable storage medium storing a computer program that, when executed by a processor, implements the location data acquisition method described in the first aspect.
[0034] The position data acquisition method, apparatus, electronic device, and storage medium proposed in this application include: first, acquiring initial angle data detected by a magnetic encoder under the current magnetic field polarity; then, performing translation correction processing on the initial angle data to obtain corrected angle data; and finally, obtaining standard position data corresponding to the initial angle data based on the corrected angle data. This application eliminates the 180-degree fixed offset caused by different N or S poles at the software level by performing a "translation correction processing" step on the initial angle data acquired by the magnetic encoder. This ensures that for measurement data at the same physical location, regardless of the currently detected magnetic field polarity, a unified and unambiguous corrected angle data can be generated. Therefore, the standard position data obtained based on this corrected data is unique and accurate, solving the problem of both positive and negative angle outputs. This significantly improves the accuracy and reliability of acquiring the mover position in a magnetic drive conveyor system without requiring any modification to existing hardware.
[0035] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of a method for acquiring position data using a magnetic encoder, provided in an embodiment of this application.
[0037] Figure 2 This is a flowchart of a location data acquisition method provided in another embodiment of this application.
[0038] Figure 3 yes Figure 2 The flowchart for step 202.
[0039] Figure 4 yes Figure 3 The flowchart for step 302.
[0040] Figure 5 yes Figure 2 Flowchart for step 203.
[0041] Figure 6 This is a schematic flowchart illustrating the determination of a preset numerical range and location data, provided in another embodiment of this application.
[0042] Figure 7 This is a schematic diagram illustrating the definition of a preset numerical range provided in another embodiment of this application.
[0043] Figure 8 This is a flowchart of the real-time position data acquisition process of a mover provided in another embodiment of this application.
[0044] Figure 9 yes Figure 8 The flowchart for step 802.
[0045] Figure 10 This is a schematic diagram of the structure of a location data acquisition device provided in an embodiment of this application.
[0046] Figure 11 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0048] It should be noted that although functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0050] In industrial automation fields such as magnetic drive conveyors, magnetic encoders are widely used due to their non-contact and low-wear characteristics. These encoders use components such as Hall sensors to detect changes in the magnetic field and output angle data to determine the position of the mover. However, their working principle makes the angle output dependent on the direction of the magnetic field. When the N pole or S pole of the magnetic grating is detected, even if the mover is in the exact same physical position, the angle signal output by the sensor will present two possible scenarios due to the different polarities of the magnetic field. This means that the system cannot directly distinguish the true position of the mover based solely on the received angle data, resulting in inaccurate position data obtained using magnetic encoders.
[0051] To improve the accuracy of position data acquired using magnetic encoders, this application embodiment performs a "translation correction processing" step on the initial angle data acquired by the magnetic encoder. This eliminates the 180-degree fixed offset caused by different N or S poles at the software level, ensuring that for measurement data at the same physical location, regardless of the currently detected magnetic field polarity, a unified and unambiguous corrected angle data can be generated. Thus, the standard position data obtained based on this corrected data is unique and accurate, solving the problem of both positive and negative angle outputs. This significantly improves the accuracy and reliability of acquiring the mover position in the magnetic drive conveyor system without requiring any modifications to existing hardware.
[0052] To better describe the location data acquisition method provided in this application, a schematic flowchart of location data acquisition using a magnetic encoder is first described. (Refer to...) Figure 1 This is a schematic diagram illustrating position data acquisition using a magnetic encoder, as provided in an embodiment of this application. Figure 1 The diagram illustrates the inherent technical problems in the prior art when using magnetic encoders to acquire position data. Figure 1 The paper describes two scenarios: when two magnetic gratings with opposite initial magnetic pole directions (the first is an NS arrangement, the second is an SN arrangement; in a magnetically driven conveyor system, the carrier of the gratings can be a mover) move in the same direction, the magnetic encoder below will sense two sets of periodic angle signals with opposite phases (blue and red waveforms, respectively). This intuitively illustrates a core problem: even if the physical positions of the magnetic gratings are the same, the angle value output by the sensor will have a fixed offset of 180 degrees simply because the dominant magnetic field direction is different. This ambiguity in the angle output prevents the system from obtaining unique and definite position information, thus causing positioning errors, which is precisely the technical problem that this application aims to solve.
[0053] Based on the above-mentioned position data acquisition method based on a magnetic encoder, the position data acquisition method in the embodiments of this application will be described in detail below. (Refer to...) Figure 2 This is an optional flowchart of the location data acquisition method provided in the embodiments of this application. Figure 2 The method may include, but is not limited to, steps 201 to 203. It is also understood that this embodiment... Figure 2 The order of steps 201 to 203 is not specifically limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs. The location data acquisition method provided in this application embodiment can be applied to any control processor (such as a smart terminal, server, computer, etc.) connected to a magnetic encoder.
[0054] Step 201: Obtain the initial angle data detected by the magnetic encoder under the current magnetic field polarity.
[0055] Step 201 will be described in detail below.
[0056] In some embodiments, when performing position data processing on the data output by the magnetic drive encoder, initial angle data detected by the magnetic encoder under the current magnetic field polarity is first acquired, with the aim of acquiring raw, unprocessed position signals from the physical hardware.
[0057] As we can understand, a magnetic encoder is a sensor that determines the position of an object non-contactly by detecting changes in a magnetic field. It is commonly used in industrial automation systems to achieve high durability. "Current magnetic field polarity" refers to the direction of the magnetic field sensed by the encoder on the magnetic scale at that instant, i.e., the north pole (N pole) or the south pole (S pole). "Initial angle data" is the raw angle reading directly output by the magnetic encoder based on this magnetic field polarity. The key characteristic of this data is that its value varies depending on the magnetic field polarity; that is, the same physical location will correspond to different angle values under different polarities, which is the root cause of position uncertainty.
[0058] Step 202: Perform translation correction on the initial angle data to obtain the corrected angle data.
[0059] Step 202 will be described in detail below.
[0060] After acquiring the initial angle data, a translation correction process is performed on it to obtain corrected angle data. The purpose of this step is to eliminate the inherent uncertainty in the initial angle data. This "translation correction process" is a software-level mathematical operation that, according to preset rules, applies a fixed arithmetic offset to the initial angle data acquired under a specific magnetic field polarity (e.g., the S pole), such as adding or subtracting a 180-degree compensation value. The goal of this process is to unify the angle outputs under different polarities to the same reference. The resulting "corrected angle data" will no longer depend on the magnetic field polarity at the time of detection, thus ensuring that any physical location corresponds to only one unique and unambiguous angle value.
[0061] The following section will describe in detail how to perform translation correction.
[0062] Reference Figure 3 The initial angle data is translated and corrected to obtain the corrected angle data, including the following steps 301 to 302.
[0063] Step 301: When the current magnetic field polarity is the first preset polarity, use the initial angle data as the correction angle data.
[0064] Step 302: When the current magnetic field polarity is the second preset polarity, the initial angle data is adjusted based on the preset offset to obtain the corrected angle data.
[0065] Steps 301 to 302 are described in detail below.
[0066] In some embodiments, when the "current magnetic field polarity" is a first preset polarity, the initial angle data is directly used as the correction angle data. Here, the "first preset polarity" is a pre-defined reference polarity, such as the North Pole (N pole). When the system determines that the magnetic field polarity currently detected by the magnetic encoder matches this first preset polarity, it considers the acquired "initial angle data" to be accurate without any mathematical adjustment. Therefore, under this specific condition, the initial angle data is directly adopted and considered equivalent to "correction angle data," providing a unified reference standard for subsequent position calculations.
[0067] When the "current magnetic field polarity" is the second preset polarity, the initial angle data is adjusted based on a preset offset to obtain corrected angle data. This step defines the compensation or "adjustment" conditions in the data correction process. Here, the "second preset polarity" is the other polarity corresponding to the first preset polarity, such as the South Pole (S pole). The "preset offset" is a fixed, known value, typically 180 degrees in this application's scheme, representing the inherent difference in angle output under two different polarities. When the system detects that the current magnetic field polarity is the second preset polarity, it initiates the adjustment mechanism, applying the preset offset to the "initial angle data" (e.g., through addition or subtraction), thereby converting it to a reference consistent with the output value under the first preset polarity, ultimately obtaining the "corrected angle data," as described below.
[0068] Reference Figure 4 The initial angle data is adjusted based on a preset offset to obtain corrected angle data, including the following steps 401 to 402.
[0069] Step 401: When the second preset polarity is Antarctica, the corrected angle data is obtained by subtracting the preset offset from the initial angle data.
[0070] Step 402: When the second preset polarity is North Pole, the corrected angle data is obtained by adding a preset offset to the initial angle data.
[0071] Steps 401 to 402 are described in detail below.
[0072] In some embodiments, when the second preset polarity is Antarctica, that is, in one case, Antarctica (S pole) is selected as the "second preset polarity" that needs to be corrected. In this case, the corresponding North Pole (N pole) naturally becomes the reference (i.e., the first preset polarity). In this implementation, in order to align the "initial angle data" measured at Antarctica to the reference at the North Pole, the system performs a subtraction operation, that is, subtracts a preset offset (i.e., 180 degrees) representing the polarity difference from the initial angle data. The result of the operation is the unambiguous "corrected angle data".
[0073] When the second preset polarity is North Pole, that is, in another case, North Pole (N pole) is selected as the "second preset polarity" to be corrected, and South Pole (S pole) is used as the reference (i.e., the first preset polarity). Under this setting, in order to align the "initial angle data" measured at North Pole with the reference at South Pole, the system will perform an addition operation, that is, add a preset offset (i.e., 180 degrees) to the initial angle data. Through this "upward translation" method, "corrected angle data" that is consistent with the reference and independent of magnetic field polarity can also be obtained.
[0074] Through steps 401 and 402 above, two specific implementation paths for the technical feature of "adjustment based on preset offset" are demonstrated. They are not executed sequentially, but represent two equivalent design choices. By applying a fixed offset, the angular deviation caused by one polarity is compensated, thereby achieving the unification of the data reference. By clearly defining the two opposite but equally effective operation methods of subtraction and addition, the flexibility and universality of its implementation are demonstrated. Regardless of whether the North or South Pole is used as the reference, the ambiguity of the angle can be reliably eliminated through the corresponding arithmetic adjustment, ensuring the uniqueness and accuracy of the final corrected angle data.
[0075] Through steps 301 and 302 above, a complete and rigorous conditional judgment and correction logic is constructed. By distinguishing the magnetic field polarity into "first preset polarity" and "second preset polarity," the initial angle data output by the magnetic encoder is selectively processed: the data under the reference polarity is not modified, while the data under the other polarity is precisely compensated by applying a "preset offset." This differentiated approach ensures that regardless of the original detection conditions, the final output corrected angle data can be unified under the same measurement standard, thereby effectively and reliably eliminating the ambiguity of angles caused by the dependence of magnetic field direction, laying a solid foundation for obtaining accurate standard position data subsequently.
[0076] Step 203: Based on the corrected angle data, obtain the standard position data corresponding to the initial angle data.
[0077] Step 203 will be described in detail below.
[0078] In some embodiments, after obtaining the corrected angle data, in order to transform the obtained, unambiguous corrected angle data into finally usable position information, further, standard position data corresponding to the initial angle data is obtained based on the corrected angle data. Specifically, the system maps the corrected angle data to a predefined position coordinate or number using methods such as table lookup, interval judgment, or further interpolation calculation. This final output result is the "standard position data," whose "standard" is reflected in its uniqueness and accuracy, and can be directly adopted by the system for subsequent control or monitoring tasks because it has completely eliminated interference caused by changes in magnetic field polarity, as described below.
[0079] Reference Figure 5 Based on the corrected angle data, the standard position data corresponding to the initial angle data is obtained, including the following steps 501 to 502.
[0080] Step 501: Select the target value range that matches the correction angle data from multiple preset value ranges.
[0081] Step 502: Obtain standard location data based on the location data corresponding to the target numerical range.
[0082] Steps 501 to 502 are described in detail below.
[0083] In some embodiments, after obtaining the corrected angle data, in order to locate the continuous, corrected angle values within a range, a target numerical range matching the corrected angle data needs to be selected from multiple preset numerical ranges. Here, "multiple preset numerical ranges" refers to a series of continuous and non-overlapping angle intervals pre-divided by the system according to its physical structure (such as the number of magnetic pole pairs). For example, a complete 360-degree cycle is divided into six 60-degree intervals, each numbered. Then, by comparing the current value of the "corrected angle data," it is determined which preset interval it falls into; the successfully matched interval is the "target numerical range."
[0084] After determining the target numerical range corresponding to the corrected angle data, in order to convert the located angle interval into the final position information, it is necessary to obtain standard position data based on the position data corresponding to the target numerical range. Here, "the position data corresponding to the target numerical range" refers to the specific location identifier that is pre-associated with each preset numerical range during system initialization, such as a segment number, a rough coordinate, or a logical address. Therefore, based on the selected "target numerical range," the corresponding "position data" is retrieved from the preset mapping relationship and used as the final output, i.e., the "standard position data."
[0085] Through steps 501 and 502 above, a precise "corrected angle data" is categorized into a macroscopic "target value range" by interval matching, thus achieving the initial positioning of the data. Subsequently, through a direct search and extraction operation, this range is directly converted into "standard position data" that the system can understand. This not only has a clear logical structure and is easy to implement, but also ensures that the conversion process from unambiguous angle signals to final position information is stable and unique, thereby completing the closed loop of the entire position data acquisition method and guaranteeing the accuracy and usability of the final output results.
[0086] The following will further describe how multiple preset numerical ranges are predefined in the scheme of this application.
[0087] Reference Figure 6 The location data acquisition method also includes the following steps 601 to 602.
[0088] Step 601: Obtain the number of magnetic pole pairs in the magnetic drive conveyor system, and obtain the position data measurement range of the magnetic encoder.
[0089] Step 602: Divide the measurement range of circumferential angle and position data evenly based on twice the number of magnetic pole pairs to obtain multiple preset value ranges and the position data corresponding to each preset value range.
[0090] Steps 601 to 602 are described in detail below.
[0091] In some embodiments, to collect the basic physical parameters necessary for subsequent partitioning operations, it is first necessary to obtain the number of magnetic pole pairs in the magnetic drive conveyor system and the position data measurement range of the magnetic encoder. Here, "number of magnetic pole pairs" refers to the total number of complete magnetic units consisting of one N pole and one S pole on the magnetic scale or stator constituting the drive path of the magnetic drive conveyor system. This is a core hardware parameter that determines the period of the system's magnetic field distribution. The "position data measurement range of the magnetic encoder" defines the complete period of the sensor's output signal. For rotary encoders, this typically represents the physical length measured at a 360-degree angle of a physical circumference; for linear systems, it may correspond to a specific physical length.
[0092] Next, the physical parameters obtained in the previous step are used to construct a lookup table or logical basis for data transformation. At this point, the circumferential angle and position data measurement range are uniformly divided based on twice the number of magnetic pole pairs, resulting in multiple preset numerical ranges and the corresponding position data for each preset numerical range. The core operation of this step is to use the total number of magnetic poles in the system (i.e., "twice the number of magnetic pole pairs") as the division base, and use this base to evenly divide the entire "circumferential angle" (e.g., 360 degrees) and "position data measurement range". By uniformly dividing the circumferential angle, a series of equal-width, continuous angle intervals can be obtained, which are the "multiple preset numerical ranges"; at the same time, by uniformly dividing the position data measurement range in the same way, a corresponding discrete "position data" can be assigned to each angle interval, thereby establishing a one-to-one mapping relationship between the two.
[0093] Reference Figure 7 This is a schematic diagram illustrating the definition of a preset numerical range provided in an embodiment of this application. For example... Figure 7The diagram illustrates the core process of defining the "preset numerical range" in this application's scheme, namely, how to standardize the original angle signals under different magnetic field polarities. The upper and lower parts of the diagram (blue SN and red NS) represent the cases under opposite magnetic field polarities: the upper sawtooth wave is the "initial angle data" output by the magnetic encoder with opposite phase; the lower sawtooth wave is the "corrected angle data" with completely consistent phase obtained after "translation correction processing" (indicated by the vertical arrow). Crucially, this standardized corrected waveform is further evenly divided into 12 consecutive intervals (numbered 0 to 11), which constitute "multiple preset numerical ranges." This division process perfectly matches the scheme's "even division based on twice the number of magnetic pole pairs," ensuring that regardless of the initial magnetic field direction, the corrected angle data can always accurately map to only one of these 12 standard ranges, thus providing a solid foundation for obtaining accurate position data.
[0094] Through steps 601 and 602 above, an automated and parameterized system configuration method is constructed. The purpose is to pre-generate the necessary mapping rules that are precisely matched with the physical system for the subsequent position analysis process. First, the key hardware specifications of the system are collected, and then standardized mathematical division is performed based on these specifications. This automatically creates the core data structure used to convert sensor signals into position information. This not only ensures the accuracy and rationality of the position division, but also makes the entire position data acquisition method highly adaptable and portable. It can be easily applied to magnetic drive systems with different numbers of magnetic pole pairs, greatly enhancing the versatility and robustness of the technical solution.
[0095] Next, the location data acquisition method provided in this application will be described in association with the operating data of the mover in the magnetic drive conveyor system.
[0096] Reference Figure 8 The location data acquisition method also includes the following steps 801 to 802.
[0097] Step 801: Obtain the setting position data of the magnetic encoder in the magnetic drive conveyor system.
[0098] Step 802: Based on the set position data and standard position data, obtain the real-time position data of the mover.
[0099] Steps 801 to 802 are described in detail below.
[0100] In some embodiments, to provide a basis for subsequent calculation of the precise physical coordinates of the mover, it is first necessary to obtain the setting position data of the magnetic encoder in the magnetic drive conveyor system. Here, "setting position data" refers to a fixed, known physical position of the magnetic encoder itself within the coordinate system of the entire magnetic drive conveyor system (e.g., a long guide rail). This data is typically calibrated and stored during the equipment installation and commissioning phase; it serves as a static "zero point" or "reference point" and is crucial for subsequently converting relative position information into absolute position information.
[0101] Then, in order to synthesize all known information and output the final, physically meaningful mover position, it is necessary to obtain the mover's real-time position data based on the setpoint data and the standard position data. This process combines the acquired static sensor "setpoint data" with the dynamic "standard position data" (representing the mover's position relative to the magnetic field period) calculated in the previous process. Through a specific algorithm (e.g., adding the two and considering possible fine interpolation), the system can calculate the "motor's real-time position data," which is a precise and continuously varying absolute coordinate value in the entire transport system coordinate system, as described below.
[0102] Reference Figure 9 Based on the set position data and standard position data, the real-time position data of the mover is obtained, including the following steps 901 to 904.
[0103] Step 901: Obtain the error angle value based on the difference between the corrected angle data and the lower limit of the target value range.
[0104] Step 902: Obtain the error angle ratio based on the ratio of the error angle value to the range length of the target value range.
[0105] Step 903: Obtain the error position data based on the product of the error angle ratio and the position data length of the target numerical range.
[0106] Step 904: Based on the set position data, standard position data and error position data, obtain the real-time position data of the mover.
[0107] Steps 901 to 904 are described in detail below.
[0108] In some embodiments, to quantify the precise angular displacement of the mover within the current position segment, an error angle value is obtained based on the difference between the corrected angle data and the lower limit of the target numerical range. Specifically, the system subtracts the unambiguous "corrected angle data" from the starting value (i.e., the "lower limit") of the "target numerical range" to which the data belongs. This calculation result is called the "error angle value," which does not represent a system error but rather refers to the specific amount by which the corrected angle value exceeds the lower limit of its range. This value accurately reflects the relative angular displacement of the mover within the current angular segment.
[0109] Next, to normalize the obtained absolute angular offset, it is converted into a relative proportional value. This is done by dividing the error angle value by the total width (i.e., the range length) of the target numerical range. The resulting error angle ratio is a dimensionless value between 0 and 1, precisely representing the percentage of the mover's current position within the entire angular segment. For example, an error angle ratio of 0.5 means the mover is exactly in the middle of the current segment.
[0110] Next, to remap the dimensionless "error angle ratio" calculated in the previous step back to a physically meaningful unit of length, the error position data is obtained by multiplying the error angle ratio by the length of the position data within the target numerical range. In this process, the system multiplies the error angle ratio by the length of the actual physical segment corresponding to the "target numerical range" (i.e., the "position data length"). The result of this multiplication is the "error position data," a specific physical length value representing the precise displacement of the mover within the current physical segment relative to the starting point of that segment.
[0111] Finally, all previously obtained position components are integrated, that is, the real-time position data of the mover is obtained based on the set position data, standard position data, and error position data. This process involves arithmetically summing the sensor's fixed "set position data" (absolute reference), the "standard position data" (coarse position) representing the starting position of the segment, and the calculated "error position data" (fine displacement within the segment). The final sum is the "real-time position data of the mover," which is a high-precision absolute physical coordinate in the entire system coordinate system.
[0112] Through steps 901 to 904 above, a complete and refined interpolation calculation method is formed. It is no longer satisfied with only determining the coarse segment where the mover is located (given by standard position data). Instead, by calculating the angle offset, normalization ratio, and physical displacement mapping, the precise position of the mover within the segment is analyzed. By integrating the absolute reference, coarse segment, and fine displacement, smooth, continuous, and highly accurate real-time position data can be output. This upgrades the entire system from a segment positioning system to a high-precision continuous tracking system, thereby meeting the requirements of higher-level precision motion control.
[0113] Through steps 801 and 802 above, a conversion from relative position to absolute position is achieved. By introducing the "set position data" of the magnetic encoder as the absolute coordinate reference, and combining it with the reliable "standard position data" obtained after correction and analysis, the internal readings of the sensor can be successfully mapped to the external physical world coordinate system. This ensures that the final output "real-time position data of the mover" is not only unambiguous and accurate, but also has clear physical meaning, and can directly serve industrial application scenarios such as high-precision motion control, path tracking, and real-time monitoring. Thus, a complete technical closed loop from raw signal acquisition to final precise positioning is completed.
[0114] In one example, the physical parameters of a magnetically driven conveyor system are initialized. The system includes a magnetic scale with six pole pairs and a total length of 120 mm. Typically, one pole pair (i.e., one N / S pole) represents one 360-degree cycle. Multiple N / S poles have multiple identical cycles, and the values within each cycle are unique.
[0115] However, in the scheme of this application, according to the division rule of "based on twice the number of magnetic pole pairs", the 360-degree period of multiple magnetic pole pairs is changed into the 180-degree period of twice the number of magnetic pole pairs (i.e. the preset value range mentioned above), and then the linear offset position is obtained by using the preset value range and the value within the preset value range.
[0116] Based on this, the system divides the 360° electrical angle measurement range of the 6 pairs of magnetic poles in the magnetic encoder into 12 "preset value ranges," each with a width of 180° (360° / 2). Simultaneously, the 120mm physical length is also divided into 12 segments, each 10mm long. Thus, the system establishes a mapping table; for example, the first preset value range (i.e., 180°) corresponds to a physical segment of [0mm, 10mm), the second preset value range (i.e., 180°) corresponds to a segment of [10mm, 20mm), and so on.
[0117] In a specific measurement scenario, the mover moves to a physical position of 25mm. This position is located in the middle of the third physical segment [20mm, 30mm]. At this point, if the magnetic field polarity below the mover is N (first preset polarity), the magnetic encoder will output an "initial angle data," such as 90°. However, if the polarity is S (second preset polarity), the encoder will output a value with a 180° offset, i.e., 270° (90° + 180°). After obtaining this initial angle data, the system immediately performs "translation correction processing." In the case of N pole, 90° is directly used as the "corrected angle data." In the case of S pole, the system subtracts the 180° "preset offset" from 270°, also obtaining 90° as the "corrected angle data." Through this step, regardless of the initial conditions, the measured electrical angle is uniformly unified to a unique 90°.
[0118] Finally, the system performs precise position analysis based on the 90° correction angle data. The system first determines that the mover has moved to 90° within the [0, 180°] range of the third physical block, and that the starting position of the third physical block is 20mm. Subsequently, the system performs fine interpolation calculations: calculating the "error angle value" as 90° (90°-0°), the "error angle ratio" as 0.5 (90° / 180°), and finally obtaining the "error position data" as 5mm (0.5*10mm). Adding this error position data to the standard position data (20mm) and the sensor's set position data (assumed to be 0mm), the system finally calculates the "real-time position data of the mover" as 25mm (0mm+20mm+5mm). This result perfectly matches the actual physical position of the mover, proving that this method can effectively overcome the dependence on magnetic field direction and achieve high-precision position acquisition.
[0119] The location data acquisition method, apparatus, electronic device, and storage medium proposed in this application include: First, acquiring initial angle data detected by a magnetic encoder under the current magnetic field polarity; then, when the current magnetic field polarity is a first preset polarity, using the initial angle data as correction angle data; when the current magnetic field polarity is a second preset polarity, and the second preset polarity is the South Pole, obtaining correction angle data by subtracting a preset offset from the initial angle data; and when the second preset polarity is the North Pole, obtaining correction angle data by adding a preset offset to the initial angle data; finally, selecting a target value range that matches the correction angle data from multiple preset value ranges, and obtaining standard position data based on the position data corresponding to the target value range; furthermore, the method also includes... The method includes: acquiring the number of magnetic pole pairs in the magnetic drive conveyor system and acquiring the position data measurement range of the magnetic encoder; uniformly dividing the circumferential angle and position data measurement range based on twice the number of magnetic pole pairs to obtain multiple preset value ranges and position data corresponding to each preset value range; and further comprising: acquiring the set position data of the magnetic encoder in the magnetic drive conveyor system; obtaining the error angle value based on the difference between the correction angle data and the lower limit of the target value range; obtaining the error angle ratio based on the ratio of the error angle value to the range length of the target value range; obtaining the error position data based on the product of the error angle ratio and the position data length of the target value range; and obtaining the real-time position data of the mover based on the set position data, standard position data, and error position data.
[0120] This application embodiment eliminates the 180-degree fixed offset caused by different N or S poles at the software level by performing a "translation correction processing" step on the initial angle data acquired by the magnetic encoder. This ensures that for measurement data at the same physical location, regardless of the currently detected magnetic field polarity, a unified and unambiguous corrected angle data can be generated. Therefore, the standard position data obtained based on this corrected data is unique and accurate, solving the problem of both positive and negative angle outputs. This significantly improves the accuracy and reliability of the mover position acquisition in the magnetic drive conveyor system without requiring any modification to existing hardware. Furthermore, a fixed offset is applied to compensate for... The method addresses the angular deviation caused by one polarity, thereby unifying the data benchmark. By clearly defining subtraction and addition—two opposite but equally effective arithmetic operations—it demonstrates the flexibility and universality of its implementation. Regardless of whether the North or South Pole is used as the benchmark, the ambiguity of the angle can be reliably eliminated through appropriate arithmetic adjustments, ensuring the uniqueness and accuracy of the final corrected angle data. Furthermore, by distinguishing the magnetic field polarity into "first preset polarity" and "second preset polarity," the initial angle data output by the magnetic encoder is selectively processed: the data under the benchmark polarity is not modified, while the data under the other polarity is precisely compensated by applying a "preset offset."This differentiated approach ensures that regardless of the initial detection conditions, the final output corrected angle data is unified under the same measurement standard. This effectively and reliably eliminates the ambiguity of angles caused by magnetic field direction dependence, laying a solid foundation for obtaining accurate standard position data. Furthermore, by using interval matching, a precise "corrected angle data" is categorized into a macroscopic "target value range," achieving initial data localization. Subsequently, a direct lookup and extraction operation converts this range directly into "standard position data" that the system can understand. This not only has a clear and easy-to-implement logical structure but also ensures that the conversion process from unambiguous angle signals to final position information is stable and unique, thus completing the closed loop of the entire position data acquisition method and guaranteeing the accuracy and usability of the final output. Moreover, by acquiring the key hardware specifications of the system and then performing standardized mathematical partitioning based on these specifications, a core data structure for converting sensor signals into position information is automatically created. This not only ensures the accuracy and rationality of the position partitioning but also makes the entire position data... The acquisition method exhibits excellent adaptability and portability, making it easily applicable to magnetic drive systems with varying numbers of magnetic pole pairs, significantly enhancing the versatility and robustness of the technical solution. Furthermore, by introducing the "set position data" of the magnetic encoder as an absolute coordinate reference, combined with reliable "standard position data" obtained after correction and analysis, the sensor's internal readings can be successfully mapped to the external physical world coordinate system. This ensures that the final output of "real-time position data of the mover" is not only unambiguous and accurate but also possesses clear physical meaning, directly serving high-precision motion control, path tracking, and real-time monitoring in industrial applications. This completes the entire technical loop from raw signal acquisition to precise positioning. Finally, by calculating angular offset, normalized ratio, and physical displacement mapping, the minute position of the mover within the segment is precisely analyzed. By integrating the absolute reference, coarse segment, and fine displacement, smooth, continuous, and highly accurate real-time position data can be output, upgrading the entire system from a segment positioning system to a high-precision continuous tracking system, thereby meeting higher-level precision motion control requirements.
[0121] This application also provides a location data acquisition device that can implement the above-described location data acquisition method, see reference. Figure 10 The device 1000 includes:
[0122] The acquisition module 1010 is used to acquire the initial angle data detected by the magnetic encoder under the current magnetic field polarity;
[0123] The correction module 1020 is used to perform translation correction processing on the initial angle data to obtain the corrected angle data;
[0124] The position data calculation module 1030 is used to obtain the standard position data corresponding to the initial angle data based on the corrected angle data.
[0125] In some embodiments, the correction module 1020 is further configured to:
[0126] When the current magnetic field polarity is the first preset polarity, the initial angle data is used as the correction angle data;
[0127] When the current magnetic field polarity is the second preset polarity, the initial angle data is adjusted based on the preset offset to obtain the corrected angle data.
[0128] In some embodiments, the correction module 1020 is further configured to:
[0129] When the second preset polarity is Antarctica, the corrected angle data is obtained by subtracting the preset offset from the initial angle data;
[0130] When the second preset polarity is North Pole, the corrected angle data is obtained by adding a preset offset to the initial angle data.
[0131] In some embodiments, the location data calculation module 1030 is further configured to:
[0132] Select the target value range that matches the correction angle data from multiple preset value ranges;
[0133] Standard location data is obtained based on the location data corresponding to the target numerical range.
[0134] In some embodiments, the location data calculation module 1030 is further configured to:
[0135] Obtain the number of magnetic pole pairs in the magnetic drive conveyor system, and obtain the position data measurement range of the magnetic encoder;
[0136] The measurement range of circumferential angle and position data is uniformly divided based on twice the number of magnetic pole pairs, resulting in multiple preset numerical ranges and the position data corresponding to each preset numerical range.
[0137] In some embodiments, the location data calculation module 1030 is further configured to:
[0138] Acquire the setting position data of the magnetic encoder in the magnetic drive conveyor system;
[0139] Based on the set position data and standard position data, the real-time position data of the mover is obtained.
[0140] In some embodiments, the location data calculation module 1030 is further configured to:
[0141] The error angle value is obtained based on the difference between the corrected angle data and the lower limit of the target value range.
[0142] The error angle ratio is obtained based on the ratio of the error angle value to the range length of the target value range;
[0143] The error position data is obtained by multiplying the error angle ratio by the length of the position data within the target numerical range.
[0144] Based on the set position data, standard position data, and error position data, the real-time position data of the mover is obtained.
[0145] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, the specific implementation of the location data acquisition device is basically the same as the specific implementation of the location data acquisition method described above, and will not be repeated here.
[0146] The position data acquisition device in this embodiment performs a "translation correction processing" step on the initial angle data acquired by the magnetic encoder. This eliminates the 180-degree fixed offset caused by different N or S poles at the software level, ensuring that for measurement data at the same physical location, regardless of the currently detected magnetic field polarity, a unified and unambiguous corrected angle data is generated. Therefore, the standard position data obtained based on this corrected data is unique and accurate, resolving the issue of both positive and negative angle outputs. This significantly improves the accuracy and reliability of the mover position acquisition in the magnetic drive conveyor system without requiring any modification to existing hardware. Furthermore, by applying a fixed offset... The method compensates for the angular deviation caused by one polarity, thereby unifying the data benchmark. By clearly defining the two opposite but equally effective operation methods of subtraction and addition, it demonstrates the flexibility and universality of its implementation. Regardless of whether the North or South Pole is used as the benchmark, the ambiguity of the angle can be reliably eliminated through corresponding arithmetic adjustments, ensuring the uniqueness and accuracy of the final corrected angle data. In addition, by distinguishing the magnetic field polarity into "first preset polarity" and "second preset polarity", the initial angle data output by the magnetic encoder is selectively processed: the data under the benchmark polarity is not modified, while the data under the other polarity is precisely compensated by applying a "preset offset".This differentiated approach ensures that regardless of the initial detection conditions, the final output corrected angle data is unified under the same measurement standard. This effectively and reliably eliminates the ambiguity of angles caused by magnetic field direction dependence, laying a solid foundation for obtaining accurate standard position data. Furthermore, by using interval matching, a precise "corrected angle data" is categorized into a macroscopic "target value range," achieving initial data localization. Subsequently, a direct lookup and extraction operation converts this range directly into "standard position data" that the system can understand. This not only has a clear and easy-to-implement logical structure but also ensures that the conversion process from unambiguous angle signals to final position information is stable and unique, thus completing the closed loop of the entire position data acquisition method and guaranteeing the accuracy and usability of the final output. Moreover, by acquiring the key hardware specifications of the system and then performing standardized mathematical partitioning based on these specifications, a core data structure for converting sensor signals into position information is automatically created. This not only ensures the accuracy and rationality of the position partitioning but also makes the entire position data... The acquisition method exhibits excellent adaptability and portability, making it easily applicable to magnetic drive systems with varying numbers of magnetic pole pairs, significantly enhancing the versatility and robustness of the technical solution. Furthermore, by introducing the "set position data" of the magnetic encoder as an absolute coordinate reference, combined with reliable "standard position data" obtained after correction and analysis, the sensor's internal readings can be successfully mapped to the external physical world coordinate system. This ensures that the final output of "real-time position data of the mover" is not only unambiguous and accurate but also possesses clear physical meaning, directly serving high-precision motion control, path tracking, and real-time monitoring in industrial applications. This completes the entire technical loop from raw signal acquisition to precise positioning. Finally, by calculating angular offset, normalized ratio, and physical displacement mapping, the minute position of the mover within the segment is precisely analyzed. By integrating the absolute reference, coarse segment, and fine displacement, smooth, continuous, and highly accurate real-time position data can be output, upgrading the entire system from a segment positioning system to a high-precision continuous tracking system, thereby meeting higher-level precision motion control requirements.
[0147] This application also provides an electronic device, including:
[0148] At least one memory;
[0149] At least one processor;
[0150] At least one program;
[0151] The program is stored in a memory, and the processor executes the at least one program to implement the location data acquisition method described above in this application. The electronic device can be any smart terminal, including mobile phones, tablets, personal digital assistants (PDAs), in-vehicle computers, etc.
[0152] Please see Figure 11 , Figure 11 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0153] The processor 1101 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0154] The memory 1102 can be implemented in the form of ROM (Read-Only Memory), static storage device, dynamic storage device, or RAM (Random Access Memory). The memory 1102 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1102 and is called and executed by the processor 1101 to execute the location data acquisition method of the embodiments of this application.
[0155] Input / output interface 1103 is used to implement information input and output;
[0156] The communication interface 1104 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0157] Bus 1105 transmits information between various components of the device (e.g., processor 1101, memory 1102, input / output interface 1103, and communication interface 1104);
[0158] The processor 1101, memory 1102, input / output interface 1103 and communication interface 1104 are connected to each other within the device via bus 1105.
[0159] This application embodiment also provides a storage medium, which is a computer-readable storage medium, storing a computer program that, when executed by a processor, implements the above-described location data acquisition method.
[0160] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0161] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0162] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0163] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0164] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0165] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0166] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0167] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, or indirect coupling or communication connection between the apparatus or units, and may be electrical, mechanical, or other forms.
[0168] 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; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0169] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0170] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0171] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for acquiring location data, characterized in that, The method includes: Acquire the initial angle data detected by the magnetic encoder under the current magnetic field polarity; The initial angle data is translated and corrected to obtain the corrected angle data; Based on the corrected angle data, the standard position data corresponding to the initial angle data is obtained; The process of performing translation correction on the initial angle data to obtain corrected angle data includes: When the current magnetic field polarity is the first preset polarity, the initial angle data is used as the corrected angle data; When the current magnetic field polarity is the second preset polarity, the initial angle data is adjusted based on the preset offset to obtain the corrected angle data; Based on the corrected angle data, the standard position data corresponding to the initial angle data is obtained, including: Select a target value range from multiple preset value ranges that matches the corrected angle data; The standard location data is obtained based on the location data corresponding to the target numerical range.
2. The location data acquisition method according to claim 1, characterized in that, The step of adjusting the initial angle data based on a preset offset to obtain the corrected angle data includes: When the second preset polarity is Antarctica, the corrected angle data is obtained by subtracting the preset offset from the initial angle data; When the second preset polarity is North Pole, the corrected angle data is obtained by adding the preset offset to the initial angle data.
3. The location data acquisition method according to claim 1, characterized in that, The method further includes: Obtain the number of magnetic pole pairs in the magnetic drive conveyor system, and obtain the position data measurement range of the magnetic encoder; The circumferential angle and the position data measurement range are uniformly divided based on twice the number of magnetic pole pairs to obtain multiple preset value ranges and the position data corresponding to each preset value range.
4. The location data acquisition method according to claim 1, characterized in that, When the initial angle data is measurement data during the movement of the mover, the method further includes: Obtain the setting position data of the magnetic encoder in the magnetic drive conveyor system; Based on the set position data and the standard position data, the real-time position data of the mover is obtained.
5. The location data acquisition method according to claim 4, characterized in that, The process of obtaining the real-time position data of the mover based on the set position data and the standard position data includes: The error angle value is obtained based on the difference between the corrected angle data and the lower limit of the target numerical range; The error angle ratio is obtained based on the ratio of the error angle value to the range length of the target value range; The error position data is obtained by multiplying the error angle ratio by the position data length of the target value range; Based on the set position data, the standard position data, and the error position data, the real-time position data of the mover is obtained.
6. A location data acquisition device, characterized in that, The device includes: The acquisition module is used to acquire the initial angle data detected by the magnetic encoder under the current magnetic field polarity; The correction module is used to perform translation correction processing on the initial angle data to obtain corrected angle data; The position data calculation module is used to obtain the standard position data corresponding to the initial angle data based on the corrected angle data; The process of performing translation correction on the initial angle data to obtain corrected angle data includes: When the current magnetic field polarity is the first preset polarity, the initial angle data is used as the corrected angle data; When the current magnetic field polarity is the second preset polarity, the initial angle data is adjusted based on the preset offset to obtain the corrected angle data; Based on the corrected angle data, the standard position data corresponding to the initial angle data is obtained, including: Select a target value range from multiple preset value ranges that matches the corrected angle data; The standard location data is obtained based on the location data corresponding to the target numerical range.
7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the location data acquisition method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the location data acquisition method according to any one of claims 1 to 5.