Control switching method, device and equipment of electric steering engine and medium
By receiving and processing electric servo commands, the system achieves precise storage and retrieval of servo parameters, generates suitable PWM waveforms, solves the problems of low switching efficiency and accuracy of electric servo control, and realizes replaceable control of different types of servos to meet different user needs.
Patent Information
- Application Number
- CN202511624137.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-03-10
AI Technical Summary
Existing control switching methods for electric servos suffer from low switching efficiency and accuracy. In particular, the PID control parameters cannot be fully matched due to environmental differences between different manufacturers and users, and there are significant differences in servo type and torque within the same servo system.
By receiving the instruction to be judged and determining the instruction type according to the type field, storing the servo parameters to the storage module and updating the record table when configuring the instruction, and reading the target servo parameters to generate a PWM waveform when controlling the instruction, the servo is driven by combining the real-time angle and PID parameters, thereby realizing replaceable control of different types of servos and avoiding hardware changes.
It improves the accuracy and efficiency of servo switching, solves the problem of easy confusion and difficulty in managing multiple servo parameters, and realizes replaceable control of different types of servos to meet different user needs.
Smart Images

Figure CN121634964A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electric servo control, and particularly relates to a control switching method, device and equipment of an electric steering engine and a medium. BACKGROUND
[0002] Electric servo control refers to taking an electric servo system as a core to realize precise motion control of mechanical components such as a steering engine, a motor, a mechanical arm and the like, and is widely applied to industrial automation, robots, aerospace, precision manufacturing and the like. Since different application scenarios have great differences in core indexes such as torque, response speed, volume and weight of a steering engine, it is necessary to ensure that actual task requirements are matched with performance parameters of the steering engine.
[0003] Existing electric steering engine systems mostly adopt a traditional PID control mode to adjust parameters, and the number of steering engines of a steering system and the torque of the steering engines need to be determined at the beginning of design. Since the use environment and test method of manufacturers and users may be different, the same PID control parameters may not completely meet the requirements of both sides, and the steering engines used in the same steering system are usually steering engines of different types and torques.
[0004] Therefore, the control switching method of the existing electric steering engine has the problems of low switching efficiency and accuracy. SUMMARY
[0005] The present application provides a control switching method, device, equipment and medium of an electric steering engine to solve the problem of low switching efficiency and accuracy of the control switching method of the existing electric steering engine.
[0006] In a first aspect, the present application provides a control switching method of an electric steering engine, which comprises the following steps: According to the target communication interface, a to-be-judged instruction is received, and according to the type field carried by the to-be-judged instruction, a corresponding instruction type is determined; If the instruction type is a configuration instruction, the steering engine parameters are stored in a storage module according to a storage address, and a preset storage relationship record table is recorded and updated according to the steering engine identifier. The storage address, the steering engine parameters and the steering engine identifier are information carried by the configuration instruction; If the instruction type is a control instruction, the target steering engine identifier and the target angle carried by the control instruction are determined, and the corresponding target steering engine parameters are read according to the target steering engine identifier and the preset storage relationship record table. The target steering engine parameters include the target steering engine and the corresponding target PID parameters. The target PWM waveform is generated according to the real-time angle of the target steering engine, the target angle and the target PID parameters, and the target steering engine is driven according to the target PWM waveform.
[0007] In some embodiments of the present application, according to the target communication interface, a to-be-judged instruction is received, comprising: The terminal device sends an instruction, and according to the corresponding type byte, it is judged whether the instruction is a communication instruction; If yes, according to the interface type byte carried by the communication instruction, the corresponding target communication interface is determined from the preset communication interface; If no, the target communication interface is not determined.
[0008] In some embodiments of the present application, according to the type field carried by the to-be-judged instruction, the corresponding instruction type is determined, comprising: The configuration type field corresponding to the configuration instruction and the control type field corresponding to the control instruction are determined, and the type field is compared with the configuration type field and the control type field to obtain a comparison result; If the comparison result is that the type field and the configuration type field are consistent, it is determined that the to-be-judged instruction is a configuration instruction; If the comparison result is that the type field and the control type field are consistent, it is determined that the to-be-judged instruction is a control instruction; If the comparison result is that the type field is inconsistent with the configuration type field and the control type field, it is determined that the to-be-judged instruction is other instructions.
[0009] In some embodiments of the present application, according to the storage address, the steering engine parameter is stored in the storage module, comprising: According to the preset storage field, the storage address carried by the configuration instruction is determined, and according to the preset parameter field, the steering engine parameter carried is determined; According to the storage address, the corresponding storage area in the storage module is determined, and the steering engine parameter is stored in the storage area.
[0010] In some embodiments of the present application, according to the target steering engine identifier and the preset storage relationship record table, the corresponding target steering engine parameter is read, comprising: The preset storage relationship record table is read to obtain the storage corresponding relationship of a plurality of steering engine identifiers and storage areas, and according to the storage corresponding relationship, the target storage area corresponding to the target steering engine identifier is determined; The steering engine parameter stored in the target storage area is read to obtain the target steering engine parameter.
[0011] In some embodiments of the present application, according to the real-time angle of the target steering engine, the target angle and the target PID parameter, the target PWM waveform is generated, comprising: According to the AD module, the real-time digital quantity corresponding to the target steering engine is determined, and according to the difference between the real-time digital quantity and the minimum digital quantity, the real-time digital quantity difference is determined; According to the real-time digital quantity difference value and the preset digital quantity difference value, a target digital quantity ratio value is determined, and according to the multiplication of the target digital quantity ratio value and a preset angle value, a real-time angle is obtained. According to the real-time angle, the target angle and the target PID parameter, a target PWM waveform is generated.
[0012] In some embodiments of the present application, the target PWM waveform is generated according to the real-time angle, the target angle and the target PID parameter, including: According to the target angle and the real-time angle, a corresponding angle difference value is calculated, and the angle difference value and the target PID parameter are substituted into a target PID rule to obtain a target adjustment analog quantity. According to the target adjustment analog quantity, a corresponding waveform duty cycle and waveform pulse are determined to obtain the target PWM waveform.
[0013] In a second aspect, the present application provides a control switching device of an electric rudder, which comprises: The receiving module is configured to receive a to-be-judged instruction according to a target communication interface, and determine a corresponding instruction type according to a type field carried by the to-be-judged instruction. The storage module is configured to, if the instruction type is a configuration instruction, store the rudder parameters into the storage module according to a storage address, and record and update a preset storage relationship record table according to a rudder identifier; the storage address, the rudder parameters and the rudder identifier are information carried by the configuration instruction. The reading module is configured to, if the instruction type is a control instruction, determine a target rudder identifier and a target angle carried by the control instruction, read corresponding target rudder parameters according to the target rudder identifier and the preset storage relationship record table; the target rudder parameters include a target rudder and corresponding target PID parameters thereof; generate a target PWM waveform according to a real-time angle of the target rudder, the target angle and the target PID parameters, and drive the target rudder according to the target PWM waveform.
[0014] In a third aspect, the present application provides a computer device, which comprises a processor and a memory in communication connection with the processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the method of the present application.
[0015] In a fourth aspect, the present application provides a computer readable storage medium, which stores program codes, and the program codes are executed by a processor to implement the method of the present application.
[0016] The application provides a control switching method, device and equipment of an electric rudder and a medium. The method comprises the following steps: receiving a to-be-judged instruction according to a target communication interface, and determining a corresponding instruction type according to a type field carried by the to-be-judged instruction; if the instruction type is a configuration instruction, storing a rudder parameter to a storage module according to a storage address, and recording and updating a preset storage relationship record table according to a rudder identifier; the storage address, the rudder parameter and the rudder identifier are information carried by the configuration instruction; if the instruction type is a control instruction, determining a target rudder identifier and a target angle carried by the control instruction, and reading a corresponding target rudder parameter according to the target rudder identifier and the preset storage relationship record table; the target rudder parameter comprises a target rudder and a corresponding target PID parameter; generating a target PWM waveform according to a real-time angle of the target rudder, the target angle and the target PID parameter, and driving the target rudder according to the target PWM waveform.
[0017] In this way, the receiving of the to-be-judged instruction is realized through the target communication interface, and the instruction type is determined based on the type field, so that the system can adapt to interfaces of different communication modes, such as different communication links of CAN bus or RS232, and can distinguish the configuration instruction from the control instruction according to the type field, so as to avoid confusion in instruction analysis and improve accuracy; when the instruction is the configuration instruction, the rudder parameter is stored through the carried storage address, so as to realize accurate binding of the parameter and the hardware storage unit, ensure the orderly storage of core parameters such as the type and PID of different rudders, and update the storage relationship record table according to the rudder identifier, so as to establish a mapping relationship between the specific electric rudder and the storage address, so that the stored rudder parameter can be quickly called subsequently, and the problem of easy confusion and difficult management of multiple rudder parameters is solved; when the instruction is the control instruction, the corresponding parameter is read according to the target rudder identifier and the storage relationship record table, the parameter calling efficiency is greatly improved through index-based query, and the time loss of blind search is avoided, and the PWM waveform is generated in combination with the real-time angle, the target angle and the PID parameter, the closed-loop control algorithm is used to ensure the accuracy and stability of the rudder action, effectively offset the interference of load changes, mechanical friction and the like, so as to drive the target electric rudder meeting the user's demand, realize the replaceable control of different types of rudders, and control different types of rudders by changing the PID control parameter, so that the user can select the required type of rudder according to the user's own demand, and the accuracy, efficiency and applicability of the rudder switching and the rudder system are improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0019] Figure 1 A flowchart of a control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 1. Figure 2 A communication instruction diagram of a control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 2. Figure 3 A communication instruction diagram of another control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 3. Figure 4 A scenario diagram of a control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 4. Figure 5 A hardware architecture diagram of a control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 5. Figure 6 A software architecture diagram of a control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 6. Figure 7 A flowchart of another control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 7. Figure 8 A structure diagram of a control switching device of an electric rudder provided by an embodiment of the present application is shown in FIG. 8. Figure 9 A structure block diagram of an apparatus for performing a control switching method of an electric rudder according to an embodiment of the present application is shown in FIG. 9. DETAILED DESCRIPTION
[0020] The exemplary embodiments will be described in detail hereinbelow with reference to the drawings. In the following description, the same numbers in different drawings represent the same or similar elements unless otherwise represented. The embodiments described in the following exemplary embodiments do not represent all the embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0021] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the drawings.
[0022] Figure 1 A flowchart of a control switching method of an electric rudder provided by an embodiment of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, the control switching method of the electric rudder can include the following steps: S110, receiving a to-be-judged instruction according to the target communication interface, and determining the corresponding instruction type according to the type field carried by the to-be-judged instruction.
[0023] The target communication interface refers to a pre-configured and enabled physical communication link, such as a CAN bus, an RS232 serial port, etc., so as to transmit instructions between the host computer and the master control chip, so as to ensure that the instructions sent by the host computer can be stably received by the master control chip.
[0024] The to-be-judged instruction refers to the original instruction data transmitted to the master control chip through the target communication interface, such as a string of binary or hexadecimal data frames, and the specific content of the instruction has not been parsed and needs to be further judged to determine the operation requirements of the host computer to the system, such as configuration parameters, control actions, etc.
[0025] The type field is a specific byte or data segment in the to-be-judged instruction that is used to identify the type of the instruction, which is usually a fixed position field in the instruction frame, such as the first byte of the CAN instruction frame, so as to quickly distinguish the type of the to-be-judged instruction; for example, in actual application, type field = 0xAA can be preset to represent a configuration instruction, and type field = 0xBB can represent a control instruction, so that the master control chip can directly determine whether the subsequent parameter storage or steering engine control driving should be executed by reading the field, thereby avoiding instruction parsing errors.
[0026] The instruction type refers to the instruction category obtained by parsing the type field, which can include configuration instructions and control instructions.
[0027] Therefore, the to-be-judged instruction with unknown content received through the target communication interface is classified according to the preset field of the instruction, so that the instruction type corresponding to the to-be-judged instruction can be determined, so that different instruction processing methods can be adopted for different types of instructions in the future, avoiding instruction parsing errors and improving the accuracy and efficiency of steering engine switching.
[0028] S120, if the instruction type is a configuration instruction, storing the steering engine parameters into the storage module according to the storage address, and recording and updating the preset storage relationship record table according to the steering engine identifier; the storage address, the steering engine parameters and the steering engine identifier are information carried by the configuration instruction.
[0029] The configuration instruction refers to an instruction sent through the CAN bus or the RS232 serial port for setting the core parameters of the steering engine, which carries key information such as the storage address, the steering engine parameters and the steering engine identifier, so as to determine the corresponding steering engine type and PID control parameters.
[0030] The storage address is a hardware unit position in the storage module for storing specific parameters carried in the configuration instruction. In actual application, the storage address can be a fixed hexadecimal address and is bound to the parameter type one by one, for example, 0xA0 = steering engine type storage address, 0xA5 = PID proportional parameter address, 0xA6 = PID differential parameter address, and 0xA7 = PID integral parameter address, so as to realize the storage of different steering engine parameters.
[0031] The steering engine parameter is core data related to the steering engine characteristics and control accuracy carried in the configuration instruction, which can include the steering engine type parameter and the corresponding PID control parameter. The steering engine type parameter corresponds to the steering engine identification value of different torque or function, for example, under the storage address 0xA0, the configuration parameter 0xA0 represents a 15Nm torque steering engine, 0xA1 represents a 30Nm torque steering engine, 0xA2 represents a 60Nm torque steering engine, and 0xA3 represents a tilting steering engine. The PID control parameter includes the proportional coefficient (Kp, stored in 0xA5), the differential coefficient (Kd, stored in 0xA6), and the integral coefficient (Ki, stored in 0xA7). In actual application, the existing steering engine switching method needs to replace the hardware of the steering engine, but the replacement of the steering engine hardware will cause the difference between the front and rear corresponding hardware circuits, and the difference between the corresponding PID parameters of the software. Each time the steering engine of different types is switched, the corresponding hardware and PID parameters need to be re-set, the switching efficiency is too low, and errors are easy to occur, and the accuracy is low. By configuring the instruction, the steering engine type and the corresponding PID parameter of different types are directly stored in the corresponding storage address. Although the steering engine types are different, the same software and hardware design can be used for the total controller, so that the steering engine of the same channel has replaceability. For steering engines of different types, the PID control parameter is classified and controlled by the configuration instruction, so that the hardware can be changed only by changing the PID control parameter, the control of steering engines of different types is realized, and the switching efficiency and accuracy are improved.
[0032] The storage module is a module for persistently storing the steering engine parameters transmitted by the configuration instruction, which can be a data storage circuit in hardware structures such as EEPROM and Flash chip.
[0033] The steering engine identification is an identity for distinguishing multiple physical steering engines, which can be understood as a binding label of the physical steering engine and the parameter. In the application scenario of integrated control of multiple steering engines, if only the parameter is stored without the steering engine identification, the main control chip cannot determine which specific electric steering engine the stored steering engine parameter corresponds to. Through the steering engine identification, the physical steering engine corresponding to the steering engine parameter can be determined, for example, the steering engine identification A corresponds to the actual electric steering engine 1, and the steering engine identification B corresponds to the actual electric steering engine 2, so as to avoid driving the wrong steering engine during control.
[0034] The preset storage relationship record table is an index table that is determined in advance and used for recording the correspondence between the rudder identification and the storage address; for example, the table can record that the rudder identification A corresponds to the actual electric rudder 1 and the rudder identification B corresponds to the actual electric rudder 2, so that subsequent actual electric rudders corresponding to the rudder identification A and the rudder identification B can be determined directly according to the record table.
[0035] Therefore, in order to solve the problem that the existing rudder switching needs to be replaced with corresponding hardware and the PID parameters are repeatedly configured according to the type of the rudder, resulting in low efficiency and accuracy of the rudder switching, a plurality of different rudder parameters can be integrated, so that in actual application, the target electric rudder corresponding to the current target electric rudder can be determined directly from a plurality of electric rudders by calling the parameters without the need for hardware replacement; specifically, the storage address, the rudder parameter and the rudder identification carried by the configuration instruction are used to store the rudder parameter in the storage module according to the storage address, to realize storage of the rudder parameter, and to record the newly stored rudder parameter in the preset storage relationship record table according to the rudder identification, to obtain updated records in the table, so that the actual electric rudder corresponding to the rudder identification can be determined directly according to the record table in the subsequent process, to realize calling of the rudder.
[0036] S130, if the instruction type is a control instruction, the target rudder identification and the target angle carried by the control instruction are determined, and the corresponding target rudder parameter is read according to the target rudder identification and the preset storage relationship record table; the target rudder parameter includes the target rudder and the target PID parameter corresponding thereto; the target PWM waveform is generated according to the real-time angle of the target rudder, the target angle and the target PID parameter, and the target rudder is driven according to the target PWM waveform.
[0037] The control instruction is an instruction type sent through the configured target communication interface (CAN bus or RS232 serial port) and used for driving the rudder to perform a specific action, carries the target rudder identification and the target angle, and thus the control object (which rudder) and the control target (to which angle) are transmitted to the master control chip through the control instruction, so that the master control chip can perform subsequent rudder driving to realize switching of the rudder; in actual application, the control instruction needs to be effective based on the completed rudder parameter configuration, that is, the rudder control can be performed only after the parameter configuration is completed; the configuration instruction and the control instruction are separated for safety, reliability and high efficiency; if the configuration instruction can directly trigger the action, the rudder may perform unpredictable crazy action in case of data stream disorder or instruction analysis bug when the host computer software sends the parameters, which may cause damage to the equipment and even personal injury.
[0038] The target steering engine identifier refers to an identity carried in the control instruction and used to determine the corresponding identity of the physical steering engine that needs to be driven currently, that is, if the physical steering engine 1 needs to be driven currently, the steering engine identifier A corresponding to the steering engine 1 is carried in the control instruction.
[0039] The target angle refers to an angle value carried in the control instruction and used to determine the final position angle to which the target steering engine needs to move; for example, if the target angle carried in the control instruction is 50 degrees, it represents that the target steering engine needs to be driven to the angle value of 50 degrees finally.
[0040] The target steering engine parameter refers to the steering engine configuration data corresponding to the target steering engine read from the storage module by the master control chip according to the target steering engine identifier and the preset storage relationship record table.
[0041] The target steering engine refers to the physical steering engine that needs to be driven currently, and the target steering engine identifier corresponds thereto.
[0042] The target PID parameter refers to the PID control parameter corresponding to the target steering engine type and used to accurately control the steering engine action, including a proportional coefficient, a differential coefficient and an integral coefficient, which needs to be configured according to the mechanical characteristics of the target steering engine.
[0043] The real-time angle refers to the position angle value actually located by the target steering engine currently.
[0044] The target PWM waveform refers to the pulse width modulation (PWM) signal waveform generated by the master control chip based on the real-time angle, the target angle and the target PID parameter and used to drive the target steering engine action; PWM (pulse width modulation) can transmit information by adjusting the width of the pulse, and the PWM waveform is determined by two key parameters, i.e., frequency and duty cycle (i.e., the ratio of the pulse high level time to the whole cycle time), in actual application, the signal analysis circuit inside the electric steering engine is used to identify the core parameters of the PWM waveform, i.e., the period and the duty cycle, and convert them into the control signal of the target position of the steering engine, so as to drive the target steering engine.
[0045] Based on this, after the parameter configuration and storage of the steering engine, if the control instruction is received, the target steering engine identifier and the target angle carried in the control instruction can be determined, the storage address corresponding to the target steering engine identifier in the preset storage relationship record table can be determined according to the target steering engine identifier, and the steering engine parameter in the storage address can be read, so as to calculate and generate the corresponding target PWM waveform through the real-time angle, the target angle and the target PID parameter, so as to drive the corresponding target steering engine, realize the switching of the steering engine, and no regular hardware replacement and repeated configuration of the PID parameter are needed.
[0046] On the basis of the feasible implementation manner of S110, the application further provides that the to-be-judged instruction is received according to the target communication interface. receiving the instruction sent by the terminal device, and judging whether the instruction is a communication instruction according to the corresponding type byte; If yes, determining the corresponding target communication interface from the preset communication interfaces according to the interface type byte carried by the communication instruction; If no, not determining the target communication interface.
[0047] The terminal device is the instruction initiating end of the entire rudder control system, is responsible for outputting various operation instructions to realize communication configuration, parameter setting and rudder control, and can be an upper computer, such as an industrial computer in a control room, a computer and the like.
[0048] The type byte refers to a specific byte in the instruction sent by the terminal device for identifying the instruction category; for example, when the type byte is 0x55, it is an instruction for configuring the communication mode of the rudder parameter; when the type byte is 0xAA, it is an instruction for configuring the rudder type and PID parameter.
[0049] The communication instruction is a special instruction for configuring the system communication mode; when the type byte is 0x55, the instruction is an instruction for configuring the communication mode of the rudder parameter; for example, when the configuration parameter is 0x66, the communication mode is CAN bus mode enabled, and when the configuration parameter is 0x77, the communication mode is RS232 serial port mode enabled.
[0050] Please refer to Figure 2 , Figure 2 a communication instruction schematic diagram of a control switching method of an electric rudder provided by the embodiment of the present application; as shown in Figure 2 , a CAN bus mode instruction diagram is shown; the instruction type indicates that when the current byte is 0x55, it is a selection signal for configuring the communication mode of the rudder parameter, and when it is 0xAA, it is a configuration signal for configuring the rudder type and PID control parameter mode; the data storage address indicates that when the byte is 0x5A, it is used to store the address of the rudder communication mode, when it is 0xA0, it is used to store the address of the rudder type, when it is 0xA5, it is used to store the address of the proportional parameter in the PID control of the rudder, when it is 0xA6, it is used to store the address of the differential parameter in the PID control of the rudder, and when it is 0xA7, it is used to store the address of the integral parameter in the PID control of the rudder; the read-write flag bit indicates that when the byte is 0x01, it is used to read the configuration parameter in the storage address, and when it is 0x10, it is used to write the configuration parameter in the storage address; the configuration parameter indicates the parameter for configuration, wherein when the instruction type of the current instruction is the configuration of the communication mode of the rudder parameter, the configuration parameter is 0x66, the communication mode is CAN bus mode enabled, and the configuration parameter is 0x77, the communication mode is RS232 serial port mode enabled; the standby bit indicates two byte bits to be used, and the default is 0; the check sum is the CRC check sum of all the previous bytes.
[0051] Please refer to Figure 3 , Figure 3Another communication instruction schematic diagram of the control switching method of the electric rudder provided by the embodiment of the application is shown in FIG. 2. As shown in FIG. 2, an instruction diagram of an RS232 serial port communication protocol is shown, a frame header indicates a frame header of a serial port sending instruction, here two consecutive frame headers 0x55 and 0x84; the remaining instruction information can refer to a CAN communication configuration instruction frame, but it is necessary to ensure that a storage address sent by the RS232 communication protocol is the same as the CAN bus protocol, and the data frame length can be defined by the user. Figure 3
[0052] The interface type byte refers to a specific byte carried in the communication instruction and used for specifying a specific communication interface. When the interface type byte is 0x66, the communication mode is CAN bus enabled, and when the interface type byte is 0x77, the communication mode is RS232 serial port enabled.
[0053] The preset communication interface is a physical channel previously determined and used for transmitting instructions between a terminal device and a master control chip, and includes a CAN and RS232 serial port communication circuit, so that switching between different communication interfaces is realized according to the communication instruction.
[0054] Therefore, by receiving the instruction and judging that it is a communication instruction, the corresponding communication interface is determined according to the interface field carried thereby, so that the target communication mode is determined, and the subsequent communication efficiency and accuracy are improved.
[0055] On the basis of the feasible implementation manner of S110, the application further provides that the corresponding instruction type is determined according to the type field carried by the instruction to be judged, including: The configuration type field corresponding to the configuration instruction and the control type field corresponding to the control instruction are determined, and the type field is compared with the configuration type field and the control type field to obtain a comparison result; If the comparison result is that the type field and the configuration type field are consistent, it is determined that the instruction to be judged is a configuration instruction; If the comparison result is that the type field and the control type field are consistent, it is determined that the instruction to be judged is a control instruction; If the comparison result is that the type field is inconsistent with the configuration type field and the control type field, it is determined that the instruction to be judged is other instructions.
[0056] The configuration type field refers to a specific byte value used for determining a configuration instruction, and the control type field refers to a specific byte value used for determining a control instruction. The two types of fields correspond to the fixed value of the instruction type field in the instruction frame. For example, when the instruction type byte of the instruction is 0xAA, the instruction is an instruction for configuring the rudder type and the PID control parameter.
[0057] The other instructions can be communication instructions, or other redundant instructions or error instructions.
[0058] Based on this, by determining the field for identifying the instruction type in the to-be-judged instruction, and comparing the field with the configuration type field and the control type field, whether the instruction type corresponding to the to-be-judged instruction is a configuration instruction or a control instruction is determined according to the comparison result, so as to implement the rudder drive by subsequently processing the instruction.
[0059] On the basis of the feasible implementation manner of S120 described above, the application further provides storing the rudder parameters into the storage module according to the storage address, comprising: According to the preset storage field, the storage address carried by the configuration instruction is determined, and according to the preset parameter field, the rudder parameters carried are determined; According to the storage address, the corresponding storage area in the storage module is determined, and the rudder parameters are stored into the storage area.
[0060] The preset storage field refers to a fixed data segment in the configuration instruction frame specially used for carrying the storage address information, for example, 0xA0 is used for storing the rudder type address, and 0xA5 is used for storing the PID proportion parameter address, so that according to the preset storage field, the address where the configuration parameter should be stored is determined.
[0061] The preset parameter field is a fixed data segment in the configuration instruction frame specially used for carrying the rudder parameter information, for example, 0xA0 represents the 15Nm rudder identifier.
[0062] The storage area refers to the physical storage unit partition corresponding to the storage address in the storage module, each storage address corresponds to an independent storage area, which is used for storing the rudder parameters of a specific type, so that the storage module is divided into multiple storage addresses, and each storage area only stores the parameters of the corresponding type, and does not interfere with each other.
[0063] Based on this, by determining the storage address carried in the configuration instruction, the storage area corresponding to the storage address in the storage module is determined, so as to store the configuration parameters into the storage area in the storage module, and the storage of the parameters is realized.
[0064] On the basis of the feasible implementation manner of S130 described above, the application further provides reading the target rudder parameters according to the target rudder identifier and the preset storage relationship record table, comprising: The preset storage relationship record table is read to obtain the storage corresponding relationship of the multiple rudder identifiers and the storage areas, and according to the storage corresponding relationship, the target storage area corresponding to the target rudder identifier is determined; The rudder parameters stored in the target storage area are read to obtain the target rudder parameters.
[0065] The target storage area refers to a physical storage unit partition corresponding to the target steering engine identifier in the storage module, and stores the configuration parameters corresponding to the target steering engine.
[0066] Based on this, each time the storage of the steering engine configuration parameters is completed according to the configuration instruction, the correspondence between the steering engine identifier and the storage address is recorded in the preset storage relationship record table in real time, so that after receiving the control instruction, the corresponding target storage area can be determined according to the target steering engine identifier carried by the control instruction and the correspondence, so as to read the stored configuration parameters.
[0067] Based on the above feasible implementation manner of S130, the application further provides generating a target PWM waveform according to a real-time angle of the target steering engine, a target angle and target PID parameters, comprising: determining a real-time digital quantity corresponding to the target steering engine according to the AD module, and determining a real-time digital quantity difference value according to a difference value between the real-time digital quantity and the minimum digital quantity; determining a target digital quantity ratio value according to a division value of the real-time digital quantity difference value and a preset digital quantity difference value, and obtaining the real-time angle according to a multiplication value of the target digital quantity ratio value and a preset angle value; generating a target PWM waveform according to the real-time angle, the target angle and the target PID parameters.
[0068] The AD module refers to an AD conditioning and analog-to-digital conversion circuit, which can perform signal conditioning on the analog voltage signal fed back by the potentiometer built in the steering engine, and convert the conditioned analog voltage signal into a digital quantity signal and transmit it to the main control chip, so as to generate a target PWM waveform.
[0069] The real-time digital quantity refers to a real-time digital quantity signal generated by the AD module after conditioning and analog-to-digital conversion on the current potentiometer output voltage of the target steering engine. In actual application, there is a corresponding relationship between the real-time digital quantity and the real-time angle of the target steering engine, for example, steering engine 0° corresponds to digital quantity 0, and 90° corresponds to digital quantity 4095.
[0070] The minimum digital quantity refers to the minimum value of the digital quantity corresponding to the minimum mechanical angle (such as 0°) of the steering engine, for example, the steering engine 0° corresponds to the digital quantity 0.
[0071] The preset digital quantity difference value refers to the difference between the digital quantity corresponding to the maximum mechanical angle of the steering engine and the minimum digital quantity corresponding to the minimum mechanical angle, that is, the total digital quantity range of the full stroke rotation of the steering engine; for example, the maximum angle of the steering engine is 90°, the minimum digital quantity is 0, and the maximum digital quantity is 4095, so the preset digital quantity difference value is 4095-0=4095.
[0072] The preset angle value is the maximum mechanical angle value of the target steering engine, which is generally 180 degrees.
[0073] Based on this, in actual application, the steering engine usually has a potentiometer (i.e. variable resistor) inside, the rotating shaft of which is mechanically linked with the output shaft of the steering engine, that is, the output shaft of the steering engine rotates by how many degrees, the rotating shaft of the potentiometer also rotates by how many degrees, the steering system provides a reference voltage (for example, 5V) to the potentiometer, the potentiometer outputs a specific voltage value between 0V and 5V according to the angle of its rotating shaft, for example, the voltage value corresponding to 0° of the steering engine is 0, and the AD module is used to convert the voltage value of the potentiometer into digital quantity, that is, each specific position of the steering engine corresponds to a unique digital code, for example, the voltage value of 0 corresponds to the digital quantity of 0. That is to say, there is a direct linear relationship between the real-time angle of the steering engine and the digital quantity output by the AD module, so the host chip can calculate the real-time angle of the steering engine according to the real-time digital quantity.
[0074] On the basis of the above feasible implementation manner of S130, the application further provides generating a target PWM waveform according to the real-time angle, the target angle and the target PID parameter, comprising: According to the target angle and the real-time angle, the corresponding angle difference value is calculated, and the angle difference value and the target PID parameter are substituted into the target PID rule for calculation to obtain a target adjustment analog quantity; According to the target adjustment analog quantity, the corresponding waveform duty ratio and waveform pulse are determined to obtain the target PWM waveform.
[0075] Wherein, the target PID rule refers to the parameter calculation rule based on the PID control algorithm, so as to combine the angle difference value with the target PID parameter (proportional coefficient Kp, integral coefficient Ki and differential coefficient Kd) to calculate the adjustment quantity through a fixed formula; in actual application, the PID control algorithm is generally: Target adjustment analog quantity = Kp x angle difference value + Ki x ∫ angle difference value dt + Kd x d (angle difference value) / dt; ∫ represents integration, and d / dt represents differentiation.
[0076] The target adjustment analog quantity refers to a continuous analog quantity signal used to reflect the driving strength and direction required by the steering engine, and the target adjustment analog quantity directly reflects the driving demand of the steering engine, for example, a larger target adjustment analog quantity corresponds to the requirement of rapid rotation of the steering engine, which requires a larger PWM duty ratio; a smaller target adjustment analog quantity corresponds to the requirement of fine adjustment of the angle, which requires a smaller duty ratio; if there is no such analog quantity, the host chip cannot associate the angle difference value with the PWM waveform, and cannot generate an adaptive driving signal.
[0077] Based on this, by calculating the angle difference corresponding to the target angle and the real-time angle, and substituting the angle difference and the target PID parameter into the target PID rule for calculation, the target adjustment analog quantity is obtained, so as to determine the duty ratio and pulse corresponding to the PWM waveform according to the target adjustment analog quantity, and obtain the target PWM waveform.
[0078] Please refer to Figure 4 , Figure 4 The scene schematic diagram of the control switching method of the electric rudder provided by the embodiment of the application is shown in Figure 4 The upper computer and the rudder controller communicate through the CAN or RS232 serial communication circuit, so that the rudder controller determines the corresponding target rudder from a plurality of electric rudders and drives the target rudder according to the instruction sent by the upper computer.
[0079] Please refer to Figure 5 , Figure 5 The hardware architecture schematic diagram of the control switching method of the electric rudder provided by the embodiment of the application is shown in Figure 5 The electric rudder system is composed of a rudder controller and a rudder, the rudder controller is composed of hardware and software, and the hardware of the rudder controller is mainly composed of a main control chip and its peripheral circuit, an AD conditioning and analog-digital conversion circuit, a CAN and RS232 serial communication circuit, a data storage circuit, a rudder driving circuit and the like.
[0080] Please refer to Figure 6 , Figure 6 The software architecture schematic diagram of the control switching method of the electric rudder provided by the embodiment of the application is shown in Figure 6 The software of the rudder controller mainly includes a CAN bus and RS232 serial communication module, an AD module, a storage module, a motor control module and the like.
[0081] Please refer to Figure 7 , Figure 7 The flowchart of another control switching method of the electric rudder provided by the embodiment of the application is shown in Figure 7 First, it is judged whether the parameters have been configured; if not, the upper computer sends a parameter configuration instruction through the CAN bus or the RS232 serial port, processes the to-be-configured parameters, writes them into the corresponding address, and then reads the parameters in the address to participate in the rudder control; if the parameters have been configured or the parameter configuration is completed, the upper computer sends a control instruction, finally realizes the action of the rudder, and completes the switching and driving of different types of rudders.
[0082] In some embodiments of the present application, by receiving the to-be-judged instruction according to the target communication interface, and determining the corresponding instruction type according to the type field carried by the to-be-judged instruction, if the instruction type is a configuration instruction, the rudder parameters are stored to the storage module according to the storage address, and the preset storage relationship record table is recorded and updated according to the rudder identifier; the storage address, the rudder parameters and the rudder identifier are information carried by the configuration instruction; if the instruction type is a control instruction, the target rudder identifier and the target angle carried by the control instruction are determined, and the corresponding target rudder parameters are read according to the target rudder identifier and the preset storage relationship record table; the target rudder parameters include the target rudder and its corresponding target PID parameters; the target PWM waveform is generated according to the real-time angle of the target rudder, the target angle and the target PID parameters, and the target rudder is driven according to the target PWM waveform.
[0083] In this way, the reception of the to-be-judged instruction is realized through the target communication interface, and the instruction type is determined based on the type field, so as to ensure that the system can adapt to the interfaces of different communication modes, such as different communication links of CAN bus or RS232, and can distinguish the configuration instruction from the control instruction according to the type field, avoiding confusion in instruction analysis, thereby improving the accuracy; when the instruction is a configuration instruction, the storage address carried thereby is used to store the rudder parameters, realizing the accurate binding of the parameters and the hardware storage unit, ensuring the orderly storage of the core parameters such as the type and PID of different rudders, and updating the storage relationship record table according to the rudder identifier, thereby establishing the mapping relationship between the specific electric rudder and the storage address, so as to enable subsequent quick calling of the stored rudder parameters, solving the problems of easy confusion and difficult management of multiple rudder parameters; when the instruction is a control instruction, the corresponding parameters are read according to the target rudder identifier and the storage relationship record table, the parameter calling efficiency is greatly improved through index-based query, avoiding the time loss of blind search, and the PWM waveform is generated in combination with the real-time angle, the target angle and the PID parameters, and the closed-loop control algorithm is used to ensure the accuracy and stability of the rudder action, effectively offsetting the interference of load changes, mechanical friction and the like, so as to drive the target electric rudder meeting the user's demand, realizing the replaceable control of different types of rudders, and adopting the configurable PID control parameters to control different types of rudders, without the need to change the hardware, but only to change the PID control parameters, so as to realize the control of different types of rudders, and the user can select the required type of rudder according to his own demand, thereby improving the accuracy, efficiency of rudder switching and the applicability of the rudder system.
[0084] Figure 8 A structural schematic diagram of a control switching device 800 of an electric rudder provided by an embodiment of the present application is shown in FIG. 8. Figure 8 As shown in the figure, the control switching device 800 of the electric rudder includes a receiving module 810, a storage module 820 and a reading module 830. The receiving module 810 is configured to receive a to-be-judged instruction according to a target communication interface, and determine a corresponding instruction type according to a type field carried by the to-be-judged instruction. The storage module 820 is configured to, if the instruction type is a configuration instruction, store a servo parameter to the storage module according to a storage address, and record and update a preset storage relationship record table according to a servo identifier; the storage address, the servo parameter, and the servo identifier are information carried by the configuration instruction. The reading module 830 is configured to, if the instruction type is a control instruction, determine a target servo identifier and a target angle carried by the control instruction, read a corresponding target servo parameter according to the target servo identifier and the preset storage relationship record table; the target servo parameter includes a target servo and a corresponding target PID parameter; generate a target PWM waveform according to a real-time angle of the target servo, the target angle, and the target PID parameter, and drive the target servo according to the target PWM waveform.
[0085] In the embodiment of the application, the receiving module 810 can also be specifically configured to: receive an instruction sent by a terminal device, and determine whether the instruction is a communication instruction according to a corresponding type byte; if yes, determine a corresponding target communication interface from preset communication interfaces according to an interface type byte carried by the communication instruction; if no, do not determine the target communication interface.
[0086] In the embodiment of the application, the receiving module 810 can also be specifically configured to: determine a configuration type field corresponding to the configuration instruction and a control type field corresponding to the control instruction, and compare the type field with the configuration type field and the control type field to obtain a comparison result; if the comparison result is that the type field is consistent with the configuration type field, it is determined that the to-be-judged instruction is the configuration instruction; if the comparison result is that the type field is consistent with the control type field, it is determined that the to-be-judged instruction is the control instruction; if the comparison result is that the type field is inconsistent with the configuration type field and the control type field, it is determined that the to-be-judged instruction is other instructions.
[0087] In the embodiment of the application, the storage module 820 can also be specifically configured to: determine a storage address carried by the configuration instruction according to a preset storage field, and determine a servo parameter carried by the configuration instruction according to a preset parameter field; determine a corresponding storage area in the storage module according to the storage address, and store the servo parameter to the storage area.
[0088] In the embodiments of the present application, the reading module 830 can be specifically used for: reading a preset storage relationship record table to obtain a plurality of rudder identifiers and a storage corresponding relationship of storage areas, and determining a target storage area corresponding to a target rudder identifier according to the storage corresponding relationship; reading a rudder parameter stored in the target storage area to obtain a target rudder parameter.
[0089] In the embodiments of the present application, the reading module 830 can be specifically used for: determining a real-time digital quantity corresponding to the target rudder according to the AD module, and determining a real-time digital quantity difference value according to a difference value between the real-time digital quantity and the minimum digital quantity; determining a target digital quantity ratio value according to a division value of the real-time digital quantity difference value and a preset digital quantity difference value, and obtaining a real-time angle according to a multiplication value of the target digital quantity ratio value and a preset angle value; generating a target PWM waveform according to the real-time angle, the target angle and the target PID parameter.
[0090] In the embodiments of the present application, the reading module 830 can be specifically used for: calculating a corresponding angle difference value according to the target angle and the real-time angle, and substituting the angle difference value and the target PID parameter into a target PID rule to obtain a target adjustment analog quantity; determining a corresponding waveform duty ratio and waveform pulse according to the target adjustment analog quantity to obtain the target PWM waveform.
[0091] Figure 9 A structural schematic diagram of an apparatus for performing a control switching method of an electric rudder according to an embodiment of the present application is provided. As shown in the figure, the apparatus 900 includes: Figure 9 The apparatus 900 can include a processor 901 with one or more processing cores, a memory 902 with one or more computer readable storage media, a communication component 903, and the like. The processor 901, the memory 902 and the communication component 903 are connected through a bus 904.
[0092] In the specific implementation process, the at least one processor 901 executes computer execution instructions stored in the memory 902, so that the at least one processor 901 executes the control switching method of the electric rudder as described above.
[0093] The specific implementation process of the processor 901 can refer to the above method embodiments, which have similar implementation principles and technical effects, and will not be described here in detail.
[0094] Further, the processor can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or the like. The general-purpose processor can be a microprocessor or the like, or can also be any conventional processor. The steps of the method disclosed in the present application can be directly embodied as the execution of the hardware processor, or can be executed by the combination of hardware and software modules in the processor.
[0095] The memory can include a random access memory (RAM), and can also include a non-volatile memory (NVM), such as at least one disk memory.
[0096] The bus can be an industry standard architecture (ISA) bus, a peripheral component (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, or the like. For the convenience of representation, the bus in the drawings of the present application does not limit to only one bus or one type of bus.
[0097] In some embodiments, a computer program product is also provided, which includes a computer program or instructions, and the computer program or instructions, when executed by a processor, implement the steps in the control switching method of any of the electric rudders.
[0098] The specific implementation of the above operations can refer to the previous embodiments, which will not be repeated here.
[0099] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by relevant hardware controlled by the instructions, and the instructions can be stored in a computer readable storage medium and loaded and executed by a processor.
[0100] Therefore, the embodiments of the present application provide a computer readable storage medium, which stores a plurality of program codes. The program codes can be loaded by a processor to execute the steps in the control switching method of any of the electric rudders provided by the embodiments of the present application.
[0101] The storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0102] According to an aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium.
[0103] The steps in the control switching method of the electric rudder provided by the embodiments of the present application can be executed due to the instructions stored in the storage medium, thus the beneficial effects of the control switching method of the electric rudder provided by the embodiments of the present application can be achieved, which will be described in detail in the foregoing embodiments and will not be repeated here.
[0104] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The application is intended to cover any variations, uses or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the application pertains. The specification and examples are to be regarded as illustrative only, and the true scope and spirit of the application are indicated by the appended claims.
[0105] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application.
Claims
1. A control switching method of an electric rudder, characterized by, The method is applied to a control unit and comprises the following steps: According to a target communication interface, a to-be-judged instruction is received, and according to a type field carried by the to-be-judged instruction, a corresponding instruction type is determined. If the instruction type is a configuration instruction, a steering engine parameter is stored into a storage module according to a storage address, and a preset storage relationship record table is recorded and updated according to a steering engine identifier; the storage address, the steering engine parameter and the steering engine identifier are information carried by the configuration instruction. If the instruction type is a control instruction, a target steering engine identifier and a target angle carried by the control instruction are determined, and corresponding target steering engine parameters are read according to the target steering engine identifier and the preset storage relationship record table; the target steering engine parameters include a target steering engine and corresponding target PID parameters; a target PWM waveform is generated according to a real-time angle of the target steering engine, the target angle and the target PID parameters, and the target steering engine is driven according to the target PWM waveform.
2. The method of claim 1, wherein, The to-be-judged instruction is received according to the target communication interface, and comprises the following steps: An instruction sent by a terminal device is received, and whether the instruction is a communication instruction is judged according to a corresponding type byte. If yes, a target communication interface corresponding to the target communication interface is determined from a preset communication interface according to an interface type byte carried by the communication instruction. If no, the target communication interface is not determined.
3. The method of claim 1, wherein, The type field carried by the to-be-judged instruction is determined, and comprises the following steps: A configuration type field corresponding to the configuration instruction and a control type field corresponding to the control instruction are determined, and a comparison result is obtained by comparing the type field with the configuration type field and the control type field. If the comparison result is that the type field is consistent with the configuration type field, it is determined that the to-be-judged instruction is the configuration instruction. If the comparison result is that the type field is consistent with the control type field, it is determined that the to-be-judged instruction is the control instruction. If the comparison result is that the type field is inconsistent with the configuration type field and the control type field, it is determined that the to-be-judged instruction is other instructions.
4. The method of claim 1, wherein, The steering engine parameter is stored into the storage module according to the storage address, and comprises the following steps: The storage address carried by the configuration instruction is determined according to a preset storage field, and the steering engine parameter carried is determined according to a preset parameter field. The storage module corresponding to the storage address is determined, and the steering engine parameter is stored into the storage module.
5. The method of claim 1, wherein, The target steering engine parameter is read according to the target steering engine identifier and the preset storage relationship record table, and comprises the following steps: The preset storage relationship record table is read to obtain a storage corresponding relationship between a plurality of steering engine identifiers and storage areas, and a target storage area corresponding to the target steering engine identifier is determined according to the storage corresponding relationship. The steering engine parameter stored in the target storage area is read to obtain the target steering engine parameter.
6. The method of claim 1, wherein, The target PWM waveform is generated according to the real-time angle of the target rudder, the target angle and the target PID parameter, and the target PWM waveform includes: According to the AD module, the real-time digital quantity corresponding to the target rudder is determined, and the real-time digital quantity difference is determined according to the difference between the real-time digital quantity and the minimum digital quantity; The target digital quantity ratio is determined according to the division value of the real-time digital quantity difference and the preset digital quantity difference, and the real-time angle is obtained according to the multiplication value of the target digital quantity ratio and the preset angle value; The target PWM waveform is generated according to the real-time angle, the target angle and the target PID parameter.
7. The method of claim 6, wherein, The target PWM waveform is generated according to the real-time angle, the target angle and the target PID parameter, and the target PWM waveform includes: According to the target angle and the real-time angle, the corresponding angle difference is calculated, and the angle difference and the target PID parameter are substituted into the target PID rule to obtain the target adjustment analog quantity; According to the target adjustment analog quantity, the corresponding waveform duty cycle and waveform pulse are determined to obtain the target PWM waveform.
8. A control switching device of an electric rudder, characterized by comprising: The device includes: The receiving module is configured to receive a to-be-judged instruction according to a target communication interface, and determine a corresponding instruction type according to a type field carried by the to-be-judged instruction; The storage module is configured to, if the instruction type is a configuration instruction, store a rudder parameter to the storage module according to a storage address, and record and update a preset storage relationship record table according to a rudder identifier; the storage address, the rudder parameter and the rudder identifier are information carried by the configuration instruction; The reading module is configured to, if the instruction type is a control instruction, determine a target rudder identifier and a target angle carried by the control instruction, read a corresponding target rudder parameter according to the target rudder identifier and the preset storage relationship record table; the target rudder parameter includes a target rudder and a corresponding target PID parameter thereof; a target PWM waveform is generated according to a real-time angle of the target rudder, the target angle and the target PID parameter, and the target rudder is driven according to the target PWM waveform.
9. A computer device, comprising: The device includes: One or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores program code, and the program code can be called and executed by the processor to execute the method of any one of claims 1 to 7.
Citation Information
Cited By
Intelligent cloud steering engine system
CN121879250A