Encoder-based position information reading method, measurement system, device and medium
By processing the position configuration information and position information frames of the SSI absolute value encoder, the read inaccuracy problem caused by different encoding types is solved, and interference and jitter are eliminated through filtering, achieving high accuracy and compatibility of position information reading.
Patent Information
- Application Number
- CN202510102999.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, when reading the position information of the SSI absolute value encoder, different encoding types lead to inaccurate data reading, which increases user reading costs, and interferes or jitter problems, reducing the accuracy of reading data.
By acquiring the position configuration information of the encoder, including encoding type and valid bit position information, the first position information frame is processed to obtain the second position information frame, the real-time reading position information is obtained based on the valid bit position information, and filtering is performed through the relationship with the motor position information of the previous cycle to determine the motor position information of the current cycle.
Improve the accuracy of reading position information, reduce user reading costs, enhance compatibility of encoders of different specifications, reduce maintenance costs, and eliminate interference and jitter problems during data reading.
Smart Images

Figure CN119865094A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automation control technology, and in particular to a method, a measuring system, a device and a medium for reading position information based on an encoder. Background Art
[0002] Synchronous Serial Interface Absolute Encoder (SSI) absolute encoder has become an indispensable key component in automation equipment due to its high precision, high speed and reliability, and is widely used in industrial and scientific fields.
[0003] The encoding type of the SSI absolute encoder can be either binary or Gray code. In the actual reading process, the encoder collects accurate data, but in the corresponding user reading process, due to the different encoding types of the encoder, there are problems with the read data, which increases the user's reading cost. At the same time, there are interference or jitter problems in the data reading process, which will also reduce the accuracy of the read data.
[0004] Therefore, how to improve the accuracy of reading position information is an urgent problem that those skilled in the art need to solve. Summary of the invention
[0005] The object of the present invention is to provide a method, a measuring system, a device and a medium for reading position information based on an encoder, so as to solve the problem of reduced accuracy of read data.
[0006] In order to solve the above technical problems, the present invention provides a method for reading position information based on an encoder, comprising:
[0007] Acquire the position configuration information corresponding to the current encoder and the first position information frame output in the current cycle; wherein the position configuration information includes the encoding type and effective bit position information of the current encoder;
[0008] Processing the first position information frame according to the encoding type to obtain a second position information frame;
[0009] Processing the second position information frame based on the valid bit position information to obtain the real-time reading position information of the current cycle;
[0010] The real-time read position information is filtered according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
[0011] On the one hand, filtering the real-time read position information according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle includes:
[0012] Get the filtering threshold;
[0013] Obtaining differential position information corresponding to the real-time read position information of the current cycle and the motor position information of the previous cycle;
[0014] The motor position information of the current cycle is determined based on the relationship between the difference position information and the filtering threshold.
[0015] On the other hand, determining the motor position information of the current cycle based on the relationship between the difference position information and the filtering threshold includes:
[0016] Get the rotation direction of the motor;
[0017] The motor position information of the current cycle is determined according to the relationship between the difference position information and the filtering threshold and the rotation direction.
[0018] On the other hand, when the rotation direction is forward rotation, the difference position information is the difference between the real-time read position information and the motor position information of the previous cycle; determining the motor position information of the current cycle according to the relationship between the difference position information and the filtering threshold and the rotation direction includes:
[0019] If the rotation direction is forward rotation, when the first difference position information is greater than or equal to the filtering threshold, the real-time read position information of the current cycle is determined to be the motor position information of the current cycle; when the first difference position information is less than the filtering threshold, it is determined that the motor position information of the previous cycle remains unchanged and is used as the motor position information of the current cycle.
[0020] On the other hand, the process of determining the location configuration information includes:
[0021] Obtain the model, encoding type, and effective bit position information of each encoder based on the user manual in advance;
[0022] Establish a first mapping relationship between each encoder model, encoding type, and effective bit position information;
[0023] The programming interface of the processor is matched with the interface of each encoder, so as to determine the corresponding position configuration information according to the first mapping relationship and the encoder model of the current encoder.
[0024] On the other hand, processing the first position information frame according to the encoding type to obtain a second position information frame includes:
[0025] Get the preset encoding type of the encoder corresponding to the processor;
[0026] If the preset coding type is different from the coding type, the processing method corresponding to the preset coding type is converted into the processing method corresponding to the coding type; the first position information frame is decoded using the processing method corresponding to the converted coding type to obtain the second position information frame.
[0027] On the other hand, processing the second position information frame based on the valid bit position information to obtain the real-time read position information of the current cycle includes:
[0028] Obtain the most significant bit position information and the least significant bit position information of the valid bit position information;
[0029] Performing identification processing on the second position information frame according to the most significant bit position information and the least significant bit position information to obtain target position information corresponding to the most significant bit position information and the least significant bit position information;
[0030] The target position information is used as the real-time read position information of the current cycle.
[0031] In order to solve the above technical problems, the present invention also provides a position measurement system based on an encoder, the position measurement system comprising an encoder, an FPGA and a host computer; the encoder is connected to the FPGA, and the FPGA is connected to the host computer;
[0032] The host computer sends the position configuration information corresponding to the current encoder; wherein the position configuration information includes the encoding type and effective bit position information of the current encoder;
[0033] The FPGA is used to obtain the position configuration information corresponding to the current encoder and the first position information frame output by the current encoder in the current cycle; the first position information frame is processed according to the encoding type to obtain the second position information frame; the second position information frame is processed based on the valid bit position information to obtain the real-time read position information of the current cycle; the real-time read position information is filtered according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
[0034] In order to solve the above technical problems, the present invention also provides a position information reading device based on an encoder, comprising:
[0035] Memory for storing computer programs;
[0036] A processor is used to implement the steps of the encoder-based position information reading method when executing the computer program.
[0037] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the encoder-based position information reading method are implemented.
[0038] The present invention provides a method for reading position information based on an encoder, which processes the first position information frame based on the encoding type corresponding to the position configuration information, so that the absolute value encoders corresponding to different encoding types are processed for their respective encoding types, thereby improving the reading accuracy of the read data and reducing the user's additional reading cost, so as to present the final read position information to the user. In the second position information frame processing process, the real-time read position information of the current cycle is determined based on the effective position information, so as to solve the compatibility problem of different effective position information corresponding to different encoder models of different encoders, improve the compatibility of absolute value encoders of different specifications, and do not need to be developed separately for a specific encoder, thereby reducing the maintenance cost. In addition, corresponding to the interference or jitter problem in the data reading process, the present invention filters the real-time read position information according to the relationship between the real-time read position information and the motor position information of the previous cycle, and uses the filtered real-time read position information as the final motor position information of the current cycle to eliminate interference or jitter problems and improve the data reading accuracy and reliability.
[0039] In addition, the present invention also provides an encoder-based position measurement system, an encoder-based position information reading device and a medium, which have the same beneficial effects as the above-mentioned encoder-based position information reading method. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 A flowchart of a method for reading position information based on an encoder provided in an embodiment of the present invention;
[0042] Figure 2 A structural diagram of a position measurement system based on an encoder provided in an embodiment of the present invention;
[0043] Figure 3 A structural diagram of another encoder-based position measurement system provided by an embodiment of the present invention;
[0044] Figure 4 A schematic diagram of an encoder feedback signal frame provided by an embodiment of the present invention;
[0045] Figure 5 A structural diagram of a position information reading device based on an encoder provided in an embodiment of the present invention;
[0046] Figure 6 A structural diagram of another encoder-based position information reading device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] The core of the present invention is to provide a method, a measuring system, a device and a medium for reading position information based on an encoder to solve the problem of reduced accuracy of read data.
[0049] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0050] There are many manufacturers of SSI absolute encoders, and the specifications of each encoder are different. Some SSI absolute encoders are single-turn encoders, starting from the origin position 0, and returning to the origin position 0 after one turn. Some SSI absolute encoders are multi-turn encoders, up to 50,000 or 60,000 turns or even more. Starting from the origin position 0, this encoder needs to rotate tens of thousands of turns before returning to the origin 0. There are not only differences between single-turn and multi-turn, but also differences in resolution. Different encoders have a resolution bit width of only about 10 bits, while others are as high as 25 bits or even more. Secondly, there are differences in signal encoding formats, the most common of which are binary signal formats and Gray code signal formats. In addition, there are differences in communication protocols. Some manufacturers like to add some status feedback information before the position information, and some manufacturers like to add status feedback information after the position information. It can be seen that there are many specifications for SSI absolute encoders. At the same time, the reading process corresponding to the data frame is to obtain the actual value of the target data to be transmitted and the configuration parameters, thereby calculating the transmission data of the target data, and then determining the bit length occupied by the target data in the data frame according to the configuration parameters, and then generating a new data frame by the transmission data and the bit length, and sending the data frame to the target device. However, corresponding to the encoding type of the encoder, when presenting the read position information to the user, it is generally read in binary code. If it corresponds to Gray code, there will be problems with the read data, and the reading cost will be increased on the user side for analysis, or the user side will always use it as accurate position information. At the same time, due to the lack of filtering function in the data reading process, there are interference or jitter problems, resulting in interference and reduced stability of the position information, which in turn causes the problem of reduced accuracy of the read data. The encoder-based position information reading method provided by the present invention can solve the above technical problems.
[0051] Figure 1 A flowchart of a method for reading position information based on an encoder is provided in an embodiment of the present invention, such as Figure 1 As shown, the method includes:
[0052] S11: Acquire position configuration information corresponding to the current encoder and the first position information frame output in the current cycle;
[0053] The position configuration information includes the encoding type and valid bit position information of the current encoder;
[0054] S12: Processing the first position information frame according to the encoding type to obtain a second position information frame;
[0055] S13: Processing the second position information frame based on the valid bit position information to obtain real-time reading position information of the current cycle;
[0056] S14: filtering the real-time read position information according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
[0057] Specifically, the method for obtaining the position configuration information corresponding to the current encoder may be the position configuration information corresponding to the current execution subject stored, or the position configuration information transmitted by another processor or a host computer, etc., which is not limited here. The position configuration information of this embodiment, how to determine the current encoder, may be to set the encoder model allowed to be connected by the interface between the processor corresponding to the execution subject and the encoder, or to sort and map all applicable encoder models on the market, which can be set according to actual conditions.
[0058] The first position information frame output by the current encoder in the current cycle, it should be noted here that the processor as the execution subject is connected to the current encoder, and its current encoder outputs the first position information frame to be transmitted to the execution subject. The execution subject here can be a field programmable gate array (Field-Programmable Gate Array, FPGA) or other processors, controllers, etc., which are not limited here.
[0059] Position configuration information includes the encoding type and valid bit position information of the current encoder. The encoding type corresponds to the encoding method. Common encoding methods include binary code, Gray code, and one-hot code. Different encoding methods correspond to different reading and decoding methods to facilitate the subsequent reading of position information. The valid bit position information includes the least significant bit (LSB) and the most significant bit (MSB). For example, in the binary 1001 (decimal 9), the rightmost "1" is the LSB because it only changes the value from 8 to 9. The leftmost "1" is the MSB because it has the greatest impact on the value, the change range from 1 to 9. Data transmission is triggered by a clock signal, and data is transmitted starting from the MSB and then to the LSB.
[0060] In step S12, the first position information frame is processed according to the encoding type to obtain the second position information frame. The different encoding types here are followed by decoding processing corresponding to the encoding method to improve the universal compatibility of the read position information. The processing method here can be decoded according to the decoding method corresponding to the respective encoding type, and is not limited here. If it is a binary code, no decoding process is required; if it is a Gray code, it needs to be decoded according to the decoding method of the Gray code; if it is a one-hot code, it needs to be decoded according to the decoding method of the one-hot code.
[0061] In step S13, the second position information frame is processed based on the effective bit position information. The effective bit position information of encoders of different models is different. Considering the effective bit position information of the current encoder, the specific storage bit information of the real-time read position information output in the current cycle can be known.
[0062] In step S14, the real-time read position information is filtered according to the relationship between the real-time read position and the motor position information of the previous cycle to determine the motor position information of the current cycle. It is worth noting that the real-time read position information in the present embodiment is the read position information output by the current encoder in real time. After stabilization processing, it is used as the motor position information. The stabilization processing here can be a filtering process to filter out the error signal caused by burr interference or jitter interference. For example, the motor is in the accumulation state of position information, and its corresponding position information is always accumulated. If an interference signal appears, it will reduce the position information, but the motor position information relative to the previous cycle will be reduced, resulting in an error in the trend of accumulation, so it is necessary to filter the interference signal. The filtering method here can be to retain the real-time read position information corresponding to the accumulation or cumulative reduction, and to filter out the reverse real-time read position information; it can also be to compare the difference between the real-time read position information and the motor position information of the previous cycle with the threshold value, so as to realize the screening and filtering process of the corresponding real-time read position information.
[0063] The embodiment of the present invention provides a method for reading position information based on an encoder, which obtains the position configuration information corresponding to the current encoder and the first position information frame output in the current cycle; wherein the position configuration information includes the encoding type and effective position information of the current encoder; the first position information frame is processed according to the encoding type to obtain the second position information frame; the second position information frame is processed based on the effective position information to obtain the real-time read position information of the current cycle; the real-time read position information is filtered and processed according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle. The present invention processes the first position information frame based on the encoding type corresponding to the position configuration information, so that the absolute value encoders corresponding to different encoding types are processed for their respective encoding types, thereby improving the reading accuracy of the read data and reducing the additional reading cost of the user, so as to present the final read position information to the user. In the process of processing the second position information frame, the real-time read position information of the current cycle is determined based on the effective position information, so as to solve the compatibility problem of different effective position information corresponding to different encoder models of different encoders, improve the compatibility of absolute value encoders of different specifications, and do not need to be developed separately for a specific encoder, which also reduces the maintenance cost. In addition, in response to interference or jitter problems during the data reading process, the present invention filters the real-time read position information according to the relationship between the real-time read position information and the motor position information of the previous cycle, and uses the filtered real-time read position information as the final motor position information of the current cycle to eliminate interference or jitter problems and improve data reading accuracy and reliability.
[0064] In some embodiments, filtering the real-time read position information according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle includes:
[0065] Get the filtering threshold;
[0066] Obtain the difference position information corresponding to the real-time read position information of the current cycle and the motor position information of the previous cycle;
[0067] The motor position information of the current cycle is determined based on the relationship between the difference position information and the filtering threshold.
[0068] Specifically, a filtering threshold is obtained, and the motor position information of the current cycle is determined based on the relationship between the difference position information corresponding to the real-time read position information of the current cycle and the motor position information of the previous cycle and the filtering threshold. For example, when the difference position information is greater than or equal to the filtering threshold, the real-time read position information of the current cycle is updated to the motor position information of the current cycle; when the difference position information is less than the filtering threshold, the motor position information of the previous cycle is kept unchanged, that is, the motor position information of the previous cycle is used as the motor position information of the current cycle.
[0069] This embodiment provides the difference position information corresponding to the real-time read position information of the current cycle and the motor position information of the previous cycle, and determines the motor position information of the current cycle through the relationship with the filtering threshold. The data of the filtering threshold is added for comparison to improve the accuracy, stability and reliability of data filtering.
[0070] In some embodiments, determining the motor position information of the current cycle based on the relationship between the difference position information and the filtering threshold includes:
[0071] Get the rotation direction of the motor;
[0072] The motor position information of the current cycle is determined according to the relationship between the difference position information and the filtering threshold and the rotation direction.
[0073] Specifically, in addition to considering the relationship between the difference position information and the filtering threshold, the corresponding rotation direction of the motor must also be considered. It should be noted that the motor has two rotation directions: forward and reverse. The accumulation process corresponds to different directions. If it is in the forward rotation process, the number of pulses output by the encoder will increase. In the pulse accumulation process, the accumulated rotation position of the motor is obtained. In the forward rotation process, if there is interference or jitter, it will be lower than the original pulse accumulation, and even lower than the original pulse (position information of the previous cycle). Therefore, it is necessary to consider whether it needs to be removed to determine the motor position information of the current cycle corresponding to the rotation direction.
[0074] This embodiment provides a method for determining the motor position information of the current cycle based on the relationship between the difference position information and the filtering threshold and the rotation direction, thereby avoiding the situation where the motor position information of the current cycle is lower than the motor position information of the previous cycle due to different rotation directions, thereby improving the accuracy of reading the motor position information.
[0075] In some embodiments, when the rotation direction is forward rotation, the difference position information is the difference between the real-time read position information and the motor position information of the previous cycle; the motor position information of the current cycle is determined according to the relationship between the difference position information and the filtering threshold and the rotation direction, including:
[0076] If the rotation direction is forward, when the difference position information is greater than or equal to the filtering threshold, the real-time read position information of the current cycle is determined to be the motor position information of the current cycle; when the difference position information is less than the filtering threshold, the motor position information of the previous cycle is determined to remain unchanged and is used as the motor position information of the current cycle.
[0077] Specifically, when the rotation direction is forward rotation, if the difference position information is greater than or equal to the filtering threshold, the only difference position information that exists is the real-time read position information of the current cycle minus the motor position information of the previous cycle, and the real-time read position information of the current cycle is determined to be the motor position information of the current cycle. When the difference position information is less than the filtering threshold, the motor position information of the previous cycle is determined to remain unchanged as the motor position information of the current cycle.
[0078] When the rotation direction is reverse rotation, the difference position information is obtained by subtracting the real-time read position information of the current cycle from the motor position information of the previous cycle, and the real-time read position information of the current cycle is determined to be the motor position information of the current cycle. When the difference position information is less than the filtering threshold, the motor position information of the previous cycle is determined to remain unchanged as the motor position information of the current cycle.
[0079] The present embodiment provides a process for determining the motor position information of the current cycle corresponding to different differential position information in different rotation directions, which improves the accuracy of data reading while also improving the reliability and stability of data reading.
[0080] In some embodiments, the process of determining the location configuration information includes:
[0081] Obtain the model, encoding type, and effective bit position information of each encoder based on the user manual in advance;
[0082] Establish a first mapping relationship between each encoder model, encoding type, and effective bit position information;
[0083] The programming interface of the processor is matched with the interface of each encoder, so as to determine the corresponding position configuration information according to the first mapping relationship and the encoder model of the current encoder.
[0084] Specifically, the purpose of establishing a mapping relationship is to match the output data of the encoder with the input port of the processor while improving the compatibility of encoders of different models. Under normal circumstances, based on encoders of different models, the corresponding reading methods are different, that is, the valid bit position information and encoding types corresponding to encoders of different models are different, and the corresponding reading and output methods are different. If encoders of different models are replaced, it is necessary to run the next reading and output method. Before reading and outputting, a matching operation is performed first, and the operation process is cumbersome. In this embodiment, the encoding type and valid bit position information of encoders of all models are established with a first mapping relationship, and the programming interface of the processor is matched with the interface of each encoder to ensure that the data can be transmitted and parsed normally. The processor is the executor of the present invention. After matching its interface, the corresponding position configuration information is determined according to the first mapping relationship and the encoder model of the current encoder.
[0085] It should be noted that the output format that matches the processor and the encoder needs to set the corresponding number of absolute value bits based on the data bits of the encoder in the user manual; determine the corresponding pulse equivalent of the processor based on the resolution of each encoder; and determine the output format that matches the processor based on the axis type, pulse equivalent and absolute value bit number of each encoder.
[0086] The process of determining the position configuration information provided in this embodiment acquires the position configuration information through an established mapping relationship, thereby achieving compatibility with different encoding types and various models of encoders on the market.
[0087] In some embodiments, processing the first position information frame according to the encoding type to obtain the second position information frame includes:
[0088] Get the preset encoding type of the encoder corresponding to the processor;
[0089] If the preset coding type is different from the coding type, the processing method corresponding to the preset coding type is converted into the processing method corresponding to the coding type; the first position information frame is decoded using the processing method corresponding to the converted coding type to obtain the second position information frame.
[0090] Specifically, the preset encoding type corresponding to the processor is compared with the encoding type of the current encoder. If they are different, it is necessary to convert them into the processing method corresponding to the encoding type of the current encoder to decode the first position information frame to obtain the second position information frame.
[0091] If the preset encoding type is the same as the encoding type, and the encoding type is a binary encoding type, the first position information frame is used as the second position information frame;
[0092] If the preset encoding type is the same as the encoding type, and the encoding type is a Gray code encoding type, the first position information frame corresponding to the Gray code is decoded according to the processing method of the encoding type to obtain the second position information frame.
[0093] In the same case, if it is a binary encoding type, the first position information frame will be used as the second position information frame. If it is a Gray code encoding type, it is necessary to decode it according to the Gray code decoding method to obtain the second position information frame. It should be noted that the Gray code decoding method here is the same as the conventional Gray code decoding method, and is not limited here.
[0094] This embodiment provides that the first location information frame is processed according to the coding type to obtain the second location information frame, thereby realizing the coding type configurable function and being compatible with different coding types.
[0095] In some embodiments, processing the second position information frame based on the valid bit position information to obtain the real-time read position information of the current cycle includes:
[0096] Obtain the most significant bit position information and the least significant bit position information of the valid bit position information;
[0097] The second position information frame is identified and processed according to the most significant bit position information and the least significant bit position information to obtain the target position information corresponding to the most significant bit position information and the least significant bit position information;
[0098] The target position information is used as the real-time read position information of the current cycle.
[0099] Specifically, based on the knowledge of the most significant bit position information and the least significant bit position information of the valid bit position information of encoders of different models, the second position information frame is identified and processed based on the most significant bit position information and the least significant bit position information to obtain the target position information, and its target position information is used as the real-time read position information of the current cycle to realize the configurable function of the valid bit position information, which is compatible with different communication protocols and different resolutions, and is compatible with various models of encoders to the maximum extent possible.
[0100] Furthermore, the present invention also provides a position measurement system based on an encoder, Figure 2 A structural diagram of a position measurement system based on an encoder provided in an embodiment of the present invention, such as Figure 2 As shown, the position measurement system includes an encoder, an FPGA and a host computer; the encoder is connected to the FPGA, and the FPGA is connected to the host computer;
[0101] The host computer sends the position configuration information corresponding to the current encoder; wherein the position configuration information includes the encoding type and effective position information of the current encoder;
[0102] The FPGA is used to obtain the position configuration information corresponding to the current encoder and the first position information frame output by the current encoder in the current cycle; the first position information frame is processed according to the encoding type to obtain the second position information frame; the second position information frame is processed based on the valid bit position information to obtain the real-time read position information of the current cycle; the real-time read position information is filtered according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
[0103] Specifically, the hardware of the position acquisition solution consists of a host computer, FPGA, and SSI absolute encoder. The host computer is responsible for the human-machine interface interaction, sends the corresponding control parameters to the FPGA, and obtains the encoder position information from the FPGA. Figure 3 A structural diagram of another encoder-based position measurement system provided in an embodiment of the present invention, such as Figure 3 As shown in the figure, the main control information sent by the host computer includes the SSI encoding type (codeType), position parameters MSB and LSB, where MSB is the position of the SSI feedback frame where the highest bit of the position information is located, and LSB is the position of the SSI feedback frame where the lowest bit of the position information is located. FPGA obtains the feedback position information of the encoder through MSB and LSB, which is referred to as the original position information. FPGA decodes the original position information according to codeType. If codeType is binary, the original position parameter is directly filtered. If codeType is Gray code, it is decoded in Gray code format and the decoded position parameter is filtered. This is a special filtering method. According to the current position and the real-time position value, a threshold is set. If the interval between the current position and the real-time position is greater than the threshold, the real-time position is updated to the current position, otherwise the current position value remains unchanged. The real-time position is always updated in real time according to the information obtained from the encoder. The filtered current position information is uploaded to the host computer for use. The SSI absolute encoder is connected to the FPGA and communicates through the SSI serial port. When the SSI encoder receives a read request from the FPGA, it uploads its position information to the FPGA.
[0104] The host computer may be an Advanced RISCMachine (ARM) chip, a Digital Signal Processor (DSP) chip, a Microcontroller Unit (MCU), and a display interface connected to these chips, such as a display screen, according to the usage. Or it may be a computer. The host computer communicates with the FPGA through various interfaces such as network ports, Recommended Standard 232 (RS232) serial ports, Recommended Standard 485 (RS485) serial ports, parallel communication ports, etc., and sends control parameters to the FPGA while reading the SSI position information collected by the FPGA. FPGA is the FPGA chip and is the core of this solution. The SSI absolute encoder is a monitoring component used to detect the position and communicates with the FPGA through the SSI interface. All types of SSI encoders on the market are compatible.
[0105] Figure 4 A schematic diagram of an encoder feedback signal frame provided by an embodiment of the present invention, such as Figure 4 As shown, each feedback signal frame contains the most significant bit position information and the least significant bit position information corresponding to the valid bit position information.
[0106] For an introduction to an encoder-based position measurement system provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above encoder-based position information reading method.
[0107] The above describes in detail various embodiments corresponding to the encoder-based position information reading method. On this basis, the present invention also discloses an encoder-based position information reading device corresponding to the above method. Figure 5 The structure diagram of a position information reading device based on an encoder provided in an embodiment of the present invention. Figure 5 As shown, the position information reading device based on the encoder includes:
[0108] The acquisition module 11 is used to acquire the position configuration information corresponding to the current encoder and the first position information frame output in the current cycle; wherein the position configuration information includes the encoding type and effective bit position information of the current encoder;
[0109] A first processing module 12, configured to process the first position information frame according to the encoding type to obtain a second position information frame;
[0110] A second processing module 13, used to process the second position information frame based on the valid bit position information to obtain real-time reading position information of the current cycle;
[0111] The fourth processing module 14 is used to filter the real-time read position information according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
[0112] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.
[0113] For an introduction to a position information reading device based on an encoder provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above encoder-based position information reading method.
[0114] Figure 6 A structural diagram of another encoder-based position information reading device provided in an embodiment of the present invention, such as Figure 6 As shown, the device comprises:
[0115] A memory 21, used for storing computer programs;
[0116] The processor 22 is used to implement the steps of the encoder-based position information reading method when executing the computer program.
[0117] The encoder-based position information reading device provided in this embodiment may include, but is not limited to, a tablet computer, a laptop computer, or a desktop computer.
[0118] Among them, the processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 22 can be implemented in at least one hardware form of DSP, FPGA, and programmable logic array (PLA). The processor 22 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 22 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0119] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used to store the following computer program 211, wherein, after the computer program is loaded and executed by the processor 22, the relevant steps of the encoder-based position information reading method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 212 may include Windows, Unix, Linux, etc. The data 213 may include, but is not limited to, data involved in the encoder-based position information reading method, etc.
[0120] In some embodiments, the encoder-based position information reading device may further include a display screen 23 , an input / output interface 24 , a communication interface 25 , a power supply 26 , and a communication bus 27 .
[0121] Those skilled in the art can understand that Figure 6 The structure shown in the figure does not constitute a limitation on the encoder-based position information reading device, and may include more or fewer components than those shown in the figure.
[0122] The processor 22 implements the encoder-based position information reading method provided in any of the above embodiments by calling the instructions stored in the memory 21 .
[0123] For an introduction to a position information reading device based on an encoder provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above encoder-based position information reading method.
[0124] Furthermore, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor 22, the steps of the encoder-based position information reading method are implemented.
[0125] It is understandable that if the method in the above embodiment is implemented in the form of 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 the present invention is essentially 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, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0126] For an introduction to a computer-readable storage medium provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above encoder-based position information reading method.
[0127] The above is a detailed introduction to a method for reading position information based on an encoder, a measurement system, a device and a medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.
[0128] It should also be noted that, in this specification, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for reading position information based on an encoder, characterized in that: include: Acquire the position configuration information corresponding to the current encoder and the first position information frame output in the current cycle; wherein the position configuration information includes the encoding type and effective bit position information of the current encoder; Processing the first position information frame according to the encoding type to obtain a second position information frame; Processing the second position information frame based on the valid bit position information to obtain the real-time reading position information of the current cycle; The real-time read position information is filtered according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
2. The encoder-based position information reading method according to claim 1, characterized in that: The real-time read position information is filtered according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle, including: Get the filtering threshold; Obtaining differential position information corresponding to the real-time read position information of the current cycle and the motor position information of the previous cycle; The motor position information of the current cycle is determined based on the relationship between the difference position information and the filtering threshold.
3. The encoder-based position information reading method according to claim 2, characterized in that: Determining the motor position information of the current cycle based on the relationship between the difference position information and the filtering threshold includes: Get the rotation direction of the motor; The motor position information of the current cycle is determined according to the relationship between the difference position information and the filtering threshold and the rotation direction.
4. The encoder-based position information reading method according to claim 3, characterized in that: When the rotation direction is forward rotation, the difference position information is the difference between the real-time read position information and the motor position information of the previous cycle; Determining the motor position information of the current cycle according to the relationship between the difference position information and the filtering threshold and the rotation direction includes: If the rotation direction is forward rotation, when the difference position information is greater than or equal to the filtering threshold, determining that the real-time read position information of the current cycle is the motor position information of the current cycle; In the case where the difference position information is less than the filtering threshold, it is determined that the motor position information of the previous cycle remains unchanged and is used as the motor position information of the current cycle.
5. The encoder-based position information reading method according to claim 1, characterized in that: The process of determining the location configuration information includes: Obtain the model, encoding type, and effective bit position information of each encoder based on the user manual in advance; Establish a first mapping relationship between each encoder model, encoding type, and effective bit position information; The programming interface of the processor is matched with the interface of each encoder, so as to determine the corresponding position configuration information according to the first mapping relationship and the encoder model of the current encoder.
6. The encoder-based position information reading method according to claim 1, characterized in that: Processing the first location information frame according to the encoding type to obtain a second location information frame includes: Get the preset encoding type of the encoder corresponding to the processor; If the preset coding type is different from the coding type, the processing method corresponding to the preset coding type is converted into the processing method corresponding to the coding type; the first position information frame is decoded using the processing method corresponding to the converted coding type to obtain the second position information frame.
7. The encoder-based position information reading method according to claim 1, characterized in that: Processing the second position information frame based on the valid bit position information to obtain the real-time read position information of the current cycle includes: Obtain the most significant bit position information and the least significant bit position information of the valid bit position information; Performing identification processing on the second position information frame according to the most significant bit position information and the least significant bit position information to obtain target position information corresponding to the most significant bit position information and the least significant bit position information; The target position information is used as the real-time read position information of the current cycle.
8. A position measurement system based on an encoder, characterized in that: The position measurement system includes an encoder, an FPGA and a host computer; the encoder is connected to the FPGA, and the FPGA is connected to the host computer; The host computer sends the position configuration information corresponding to the current encoder; wherein the position configuration information includes the encoding type and effective bit position information of the current encoder; The FPGA is used to obtain the position configuration information corresponding to the current encoder and the first position information frame output by the current encoder in the current cycle; the first position information frame is processed according to the encoding type to obtain the second position information frame; the second position information frame is processed based on the valid bit position information to obtain the real-time read position information of the current cycle; the real-time read position information is filtered according to the relationship between the real-time read position information and the motor position information of the previous cycle to determine the motor position information of the current cycle.
9. A position information reading device based on an encoder, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the encoder-based position information reading method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the encoder-based position information reading method according to any one of claims 1 to 7 are implemented.