A lookup table based servo system configuration method

CN117560239BActive Publication Date: 2026-10-16TIANJIN JINHANG COMP TECH RES INST
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311500216.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2026-10-16
Estimated Expiration
2043-11-13

AI Technical Summary

Technical Problem

而对于多个电机参数配置采用增加SDO报文命令的方式,这种配置效率低,遇到通信质量不好传输数据错误的情况下没有可靠的判断机制,随着节点数量的增加,传输可靠性进一步降低

Benefits of technology

[0096] The servo system configuration method based on lookup tables provided by the above technical solution ensures the reliability of configuration parameters and minimizes configuration intervals when the master station controls multiple nodes, by employing parameter lookup tables and data validity tables for configuration. This configuration method enables dynamic parameter configuration, and configuration errors encountered during the process are resent up to three times, ensuring the reliability of configuration for multiple slave stations. Furthermore, the configuration process for multiple slave stations is protected by semaphores and mutexes, ensuring the timing of configuration and enhancing reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117560239B_ABST
    Figure CN117560239B_ABST
Patent Text Reader

Abstract

The application discloses a servo system configuration method based on a lookup table, which comprises the following steps: S1, defining a structure variable; S2, defining a data information structure; S3, defining an array parameter table of servo startup configuration, the number of configured data in the parameter table is NUM, and the parameter content is the structure defined in S1; S4, defining a parameter validity flag array; S5, defining a servo configuration management structure; S6, defining a servo configuration array variable to record the states of N servo nodes, and the array element is the servo configuration management structure in S1; S7, configuring a node; S8, defining a node online function parameter as a node number; S9, configuring a servo driver of the node number; and S10, acquiring a node configuration result by using a getWriteResultNetworkDict function, inputting the node number as a parameter, acquiring a fault code, and judging the acquired node configuration result. The application guarantees the time sequence of configuration and enhances reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of industrial control technology and relates to a servo system configuration method based on lookup tables. Background Technology

[0002] CANopen communication is a communication method built on top of the CAN data link layer, and this communication method specifies relevant requirements for the application layer. The CANopen device model includes a communication section, an object dictionary, and an application section. The communication section includes PDO objects, SDO objects, and NMT objects. The object dictionary includes data types, communication objects, and application objects.

[0003] PDOs primarily provide direct access to application objects within a device, enabling high-priority real-time data transmission and allowing producers and consumers to share real-time process data. Each PDO uses two objects in its object dictionary to describe communication parameters and mapping parameters. The PDO communication parameters include the COB-ID used by the PDO, the transmission type, the disable time, and the timer period. The PDO mapping parameters include a list of objects in the object dictionary and the data length. The address range for receiving PDO (RPDO) communication parameters is 1400h to 15FFh, and the address range for mapping parameters is 1600h to 17FFh. The address range for sending PDO (RPDO) communication parameters is 1800h to 19FFh, and the address range for mapping parameters is 1A00h to 1BFFh.

[0004] After a servo motor is powered on, object dictionary parameters need to be configured. The configuration method is typically SDO (Request-and-Response), which is a request-and-response mechanism; the parameter configuration is considered successful only when the master station receives a response from the slave station. Due to the large number of parameters, parameter configuration usually only sends SDO requests without processing the responses. The timing of SDO configurations for different parameters is controlled by delays. Furthermore, configuring multiple motor parameters using additional SDO message commands is inefficient. In cases of poor communication quality or data transmission errors, there is no reliable mechanism for error detection. As the number of nodes increases, transmission reliability further decreases. Summary of the Invention

[0005] (I) Purpose of the Invention

[0006] The purpose of this invention is to provide a servo system configuration method based on a lookup table, thereby improving configuration efficiency and transmission reliability.

[0007] (II) Technical Solution

[0008] To address the aforementioned technical problems, this invention provides a servo system configuration method based on a lookup table, comprising the following steps:

[0009] S1: Define a structure variable Config_Para_Struct, which includes the communication parameters and mapping parameters for sending PDO (TPDO) and receiving PDO (RPDO). The number of mapping parameters required is NUM.

[0010] S2: Define the data information structure Map_Para_Struct;

[0011] S3: Define the array parameter table ParaMap for servo startup configuration. The number of data configured in the parameter table is NUM, and the parameter content is the structure defined in S1.

[0012] S4: Define the parameter validity flag array ValidFlag;

[0013] S5: Define the servo configuration management structure SERVO_CONFIG_STATE;

[0014] S6 defines a servo configuration array variable servo_conf to record the status of N servo nodes. The array elements are the servo configuration management structure SERVO_CONFIG_STATE in S1.

[0015] Configure nodeId in S7;

[0016] S8 defines the node booting function slaveBootupHdl with the node number as the parameter;

[0017] S9 configures the servo driver for node number nodeId;

[0018] S10: Use the getWriteResultNetworkDict function to obtain the node configuration result, pass the node number nodeId as a parameter, obtain the fault code abortCode, and judge the obtained node configuration result.

[0019] In step S1, the communication parameters and mapping parameters of RPDO are defined as follows:

[0020] RPDO1 uses the trans_type_1400 transmission method, with the default parameter being synchronous transmission;

[0021] RPDO1 mapping parameter 1pdo_map_val_1600_1;

[0022] RPDO1 mapping parameter 2pdo_map_val_1600_2;

[0023] RPDO1 mapping parameter 3pdo_map_val_1600_3;

[0024] RPDO1 mapping parameter 4pdo_map_val_1600_4;

[0025] The number of RPDO1 mapping parameters is pdo_map_cnt_1600;

[0026] RPDO1 frame ID value: RPDO_COBId_1400;

[0027] RPDO2 uses the trans_type_1401 transmission method, with the default parameter being synchronous transmission;

[0028] RPDO2 mapping parameter 1pdo_map_val_1601_1;

[0029] RPDO2 mapping parameter 2pdo_map_val_1601_2;

[0030] RPDO2 mapping parameter 3pdo_map_val_1601_3;

[0031] RPDO2 mapping parameter 4pdo_map_val_1601_4;

[0032] The number of RPDO2 mapping parameters is pdo_map_cnt_1601;

[0033] The RPDO2 frame ID value is RPDO_COBId_1401.

[0034] In step S1, the communication parameters and mapping parameters of TPDO are as follows:

[0035] TPDO1 uses the trans_type_1800 transmission method, with the default parameter being synchronous transmission;

[0036] TPDO1 mapping parameter 1pdo_map_val_1A00_1;

[0037] TPDO1 mapping parameter 2pdo_map_val_1A00_2;

[0038] TPDO1 mapping parameter 3pdo_map_val_1A00_3;

[0039] TPDO1 mapping parameter 4pdo_map_val_1A00_4;

[0040] The number of TPDO1 mapping parameters is pdo_map_cnt_1A00;

[0041] TPDO1 frame ID value RPDO_COBId_1800;

[0042] TPDO2 uses the trans_type_1801 transmission method, with the default parameter being synchronous transmission;

[0043] TPDO2 mapping parameter 1pdo_map_val_1A01_1;

[0044] TPDO2 mapping parameter 2pdo_map_val_1A01_2;

[0045] TPDO2 mapping parameter 3pdo_map_val_1A01_3;

[0046] TPDO2 mapping parameter 4pdo_map_val_1A01_4;

[0047] The number of TPDO2 mapping parameters is pdo_map_cnt_1A01;

[0048] TPDO2 frame ID value RPDO_COBId_1801.

[0049] In step S2, the data information structure Map_Para_Struct includes: (1) index number, which corresponds to the index of the object dictionary; (2) sub-index number, which corresponds to the sub-index of the object dictionary; (3) parameter number of bytes count, which is of type unsigned integer; (4) data type dataType, which is of type unsigned character; and (5) data pointer data, which is of type unsigned pointer.

[0050] In step S3, the number of data configured in the array parameter table ParaMap is NUM, and the parameter content is the structure defined in S1.

[0051] In step S3, the initial contents of the configuration parameter table are as follows:

[0052] Index value 0x1400, sub-index number 2, data length 1, type is uint8, variable is trans_type_1400;

[0053] Index value 0x1600, sub-index number 1, data length 4, type is uint32, variable is pdo_map_val_1600_1;

[0054] Index value 0x1600, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1600_2;

[0055] Index value 0x1600, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1600_3;

[0056] Index value 0x1600, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1600_4;

[0057] Index value 0x1600, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1600;

[0058] Index value 0x1400, sub-index number 1, data length 4, type is uint32, variable is RPDO_COBId_1400;

[0059] Index value 0x1401, sub-index number 2, data length 1, type is uint8, variable is trans_type_1401;

[0060] Index value 0x1601, sub-index number 1, data length 4, type is uint32, variable is pdo_map_val_1601_1;

[0061] Index value 0x1601, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1601_2;

[0062] Index value 0x1601, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1601_3;

[0063] Index value 0x1601, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1601_4;

[0064] Index value 0x1601, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1601;

[0065] Index value 0x1401, sub-index number 1, data length 4, type uint32, variable RPDO_COBId_1401;

[0066] Index value 0x1800, sub-index number 2, data length 1, type is uint8, variable is trans_type_1800;

[0067] Index value 0x1A00, sub-index number 1, data length 4, type uint32, variable pdo_map_val_1A00_1;

[0068] Index value 0x1A00, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1A00_2;

[0069] Index value 0x1A00, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1A00_3;

[0070] Index value 0x1A00, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1A00_4;

[0071] Index value 0x1A00, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1A00;

[0072] Index value 0x1800, sub-index number 1, data length 4, type is uint32, variable is RPDO_COBId_1800;

[0073] Index value 0x1801, sub-index number 2, data length 1, type is uint8, variable is trans_type_1801;

[0074] Index value 0x1A01, sub-index number 1, data length 4, type uint32, variable pdo_map_val_1A01_1;

[0075] Index value 0x1A01, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1A01_2;

[0076] Index value 0x1A01, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1A01_3;

[0077] Index value 0x1A01, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1A01_4;

[0078] Index value 0x1A01, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1A01;

[0079] Index value 0x1801, sub-index number 1, data length 4, type uint32, variable RPDO_COBId_1801.

[0080] In step S4, the valid flag array ValidFlag has boolean elements and a length of NUM. An array element with a value of 1 indicates that the data with the corresponding index is configured, while an array element with a value of 0 indicates that the data with the corresponding index does not need to be configured.

[0081] In step S5, the servo configuration management structure SERVO_CONFIG_STATE variable includes: (1) configuration status state, (2) current configuration count try_cnt, and (3) configuration completion semaphore finish_sem.

[0082] In step S7, the nodeId is numbered starting from 1. First, the current configuration state in this element of the array is set to 0, the current configuration count try_cnt is set to 0, the binary semaphore creation function semBCreate is used to create the semaphore, and pthread_mutex_lock is used to lock it.

[0083] In step S8, the function pointer of the node online function is assigned to the post_SlaveBootup function pointer in the CANOPEN protocol station object dictionary; a task is created in the slaveBootupHdl function, and the node number value nodeId is passed into the task. The function to run this task is step S9.

[0084] In step S9, the servo driver with node number nodeId is configured, and the current state (state) is passed in; the configuration process is as follows:

[0085] S9_1 first checks if the state value is less than NUM; if the check is successful, proceed to S9_2; otherwise, use the semaphore release function semGive to release the configured semaphore finish_sem, indicating that there is no more data to be configured.

[0086] S9_2 uses the node configuration function writeNetworkDictCallBack for configuration. The node number is nodeId, the parameter address Addr is the value of index in the element with index state in the parameter table ParaMap, the parameter subaddr is the value of subIndex in the element with index state in the parameter table ParaMap, the number of bytes N is the value of count in the element with index state in the parameter table ParaMap, and the variable type byte_type is the data pointed to by the data pointer data in the element with index state in the parameter table ParaMap.

[0087] In step S10, the process of judging the obtained node configuration result is as follows:

[0088] If the configuration is successful, proceed to S10_1;

[0089] S10_1: Then increment the current configuration state in this element of the array by one;

[0090] If the value of state is NUM, then go to S10_2;

[0091] Determine the flag bit corresponding to the element at index 'state' in the ValidFlag array. If the bit is 0, continue executing S10_1; if the bit is 1, proceed to S10_2.

[0092] S10_2: The current configuration count try_cnt is set to 0, and the process moves to S5 to configure the next state.

[0093] If the configuration fails, increment the configuration count try_cnt by one;

[0094] Check if try_cnt is less than 3. If the check is successful, proceed to S5 to configure the next configuration state. If the check fails, use the semaphore release function semGive to release the semaphore finish_sem, clear the configuration count try_cnt to zero, set the configuration state to 0, and use the SDO transfer close function closeSDOtransfer to close the current transfer SDO.

[0095] (III) Beneficial Effects

[0096] The servo system configuration method based on lookup tables provided by the above technical solution ensures the reliability of configuration parameters and minimizes configuration intervals when the master station controls multiple nodes, by employing parameter lookup tables and data validity tables for configuration. This configuration method enables dynamic parameter configuration, and configuration errors encountered during the process are resent up to three times, ensuring the reliability of configuration for multiple slave stations. Furthermore, the configuration process for multiple slave stations is protected by semaphores and mutexes, ensuring the timing of configuration and enhancing reliability. Attached Figure Description

[0097] Figure 1 This is a flowchart of a servo system configuration method based on a lookup table according to an embodiment of the present invention. Detailed Implementation

[0098] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.

[0099] Reference Figure 1 As shown, the servo system configuration method based on lookup tables in this embodiment includes the following steps:

[0100] S1: Define a structure variable Config_Para_Struct, which includes the communication parameters and mapping parameters for sending PDO (TPDO) and receiving PDO (RPDO). The number of mapping parameters required is NUM.

[0101] The communication parameters and mapping parameters for RPDO are as follows:

[0102] RPDO1 uses the trans_type_1400 transmission method, with the default parameter being synchronous transmission;

[0103] RPDO1 mapping parameter 1pdo_map_val_1600_1;

[0104] RPDO1 mapping parameter 2pdo_map_val_1600_2;

[0105] RPDO1 mapping parameter 3pdo_map_val_1600_3;

[0106] RPDO1 mapping parameter 4pdo_map_val_1600_4;

[0107] The number of RPDO1 mapping parameters is pdo_map_cnt_1600;

[0108] RPDO1 frame ID value: RPDO_COBId_1400;

[0109] RPDO2 uses the trans_type_1401 transmission method, with the default parameter being synchronous transmission;

[0110] RPDO2 mapping parameter 1pdo_map_val_1601_1;

[0111] RPDO2 mapping parameter 2pdo_map_val_1601_2;

[0112] RPDO2 mapping parameter 3pdo_map_val_1601_3;

[0113] RPDO2 mapping parameter 4pdo_map_val_1601_4;

[0114] The number of RPDO2 mapping parameters is pdo_map_cnt_1601;

[0115] The RPDO2 frame ID value is RPDO_COBId_1401.

[0116] The communication parameters and mapping parameters for TPDO are as follows:

[0117] TPDO1 uses the trans_type_1800 transmission method, with the default parameter being synchronous transmission.

[0118] TPDO1 mapping parameter 1pdo_map_val_1A00_1

[0119] TPDO1 mapping parameter 2pdo_map_val_1A00_2

[0120] TPDO1 mapping parameter 3pdo_map_val_1A00_3

[0121] TPDO1 mapping parameter 4pdo_map_val_1A00_4

[0122] The number of TPDO1 mapping parameters: pdo_map_cnt_1A00

[0123] TPDO1 frame ID value RPDO_COBId_1800

[0124] TPDO2 uses the trans_type_1801 transmission method, with the default parameter being synchronous transmission.

[0125] TPDO2 mapping parameter 1pdo_map_val_1A01_1

[0126] TPDO2 mapping parameter 2pdo_map_val_1A01_2

[0127] TPDO2 mapping parameter 3pdo_map_val_1A01_3

[0128] TPDO2 mapping parameter 4pdo_map_val_1A01_4

[0129] Number of TPDO2 mapping parameters pdo_map_cnt_1A01

[0130] TPDO2 frame ID value RPDO_COBId_1801

[0131] S2: Define the data information structure Map_Para_Struct

[0132] The structure includes: (1) index number, which corresponds to the index of the object dictionary; (2) sub-index number, which corresponds to the sub-index of the object dictionary; (3) parameter number of bytes count, which is of type unsigned integer; (4) data type dataType, which is of type unsigned character; and (5) data pointer data, which is of type unsigned pointer.

[0133] S3: Defines the array parameter table ParaMap for servo startup configuration. The number of data configured in the parameter table is NUM, and the parameter content is the structure defined in S1.

[0134] The initial contents of the configuration parameter table are as follows:

[0135] Index value 0x1400, sub-index number 2, data length 1, type is uint8, variable is trans_type_1400;

[0136] Index value 0x1600, sub-index number 1, data length 4, type is uint32, variable is pdo_map_val_1600_1;

[0137] Index value 0x1600, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1600_2;

[0138] Index value 0x1600, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1600_3;

[0139] Index value 0x1600, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1600_4;

[0140] Index value 0x1600, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1600;

[0141] Index value 0x1400, sub-index number 1, data length 4, type is uint32, variable is RPDO_COBId_1400;

[0142] Index value 0x1401, sub-index number 2, data length 1, type is uint8, variable is trans_type_1401;

[0143] Index value 0x1601, sub-index number 1, data length 4, type is uint32, variable is pdo_map_val_1601_1;

[0144] Index value 0x1601, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1601_2;

[0145] Index value 0x1601, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1601_3;

[0146] Index value 0x1601, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1601_4;

[0147] Index value 0x1601, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1601;

[0148] Index value 0x1401, sub-index number 1, data length 4, type uint32, variable RPDO_COBId_1401;

[0149] Index value 0x1800, sub-index number 2, data length 1, type is uint8, variable is trans_type_1800;

[0150] Index value 0x1A00, sub-index number 1, data length 4, type uint32, variable pdo_map_val_1A00_1;

[0151] Index value 0x1A00, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1A00_2;

[0152] Index value 0x1A00, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1A00_3;

[0153] Index value 0x1A00, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1A00_4;

[0154] Index value 0x1A00, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1A00;

[0155] Index value 0x1800, sub-index number 1, data length 4, type is uint32, variable is RPDO_COBId_1800;

[0156] Index value 0x1801, sub-index number 2, data length 1, type is uint8, variable is trans_type_1801;

[0157] Index value 0x1A01, sub-index number 1, data length 4, type uint32, variable pdo_map_val_1A01_1;

[0158] Index value 0x1A01, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1A01_2;

[0159] Index value 0x1A01, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1A01_3;

[0160] Index value 0x1A01, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1A01_4;

[0161] Index value 0x1A01, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1A01;

[0162] Index value 0x1801, sub-index number 1, data length 4, type uint32, variable RPDO_COBId_1801.

[0163] S4: Define a valid flag array ValidFlag. The array elements are of boolean type and the array length is NUM. An array element with a value of 1 indicates that the data with the corresponding index is configured, and an array element with a value of 0 indicates that the data with the corresponding index does not need to be configured.

[0164] S5: Define the servo configuration management structure SERVO_CONFIG_STATE. The structure variables include: (1) configuration status state, (2) current configuration count try_cnt, and (3) configuration completion semaphore finish_sem.

[0165] S6 defines a servo configuration array variable servo_conf to record the status of N servo nodes. The array elements are the servo configuration management structure SERVO_CONFIG_STATE in S1.

[0166] The S7 configuration node (nodes are numbered starting from 1) first sets the current configuration state (state) and the current configuration count (try_cnt) in this element of the array to 0. Then, a semaphore is created using the binary semaphore creation function semBCreate (with parameters SEM_Q_FIFO and SEM_EMPTY). Finally, pthread_mutex_lock is used for locking.

[0167] S8 defines the node online function slaveBootupHdl with the node number as the parameter, and assigns the function pointer of this function to the post_SlaveBootup function pointer in the CANOPEN protocol station object dictionary.

[0168] In the slaveBootupHdl function, a task is created and the node number value nodeId is passed into the task. The function to run this task is S9.

[0169] S9 configures the servo driver with node number nodeId, and the input data is the current state.

[0170] S9_1 first checks if the state value is less than NUM. If successful, proceed to S9_2. Otherwise, use the semaphore release function semGive to release the configured semaphore finish_sem, indicating that there is no more data to configure.

[0171] S9_2 uses the node configuration function `writeNetworkDictCallBack` for configuration. The node number is `nodeId`, the parameter address `Addr` is filled in, and the data is the index number `index` in the element with index `state` in the parameter table `ParaMap`. The parameter sub-addr is filled in, and the data is the sub-index number `subIndex` in the element with index `state` in the parameter table `ParaMap`. The data for the number of bytes `N` is the number of bytes `count` in the element with index `state` in the parameter table `ParaMap`. The variable type `byte_type` is the data pointed to by the data pointer `data` in the element with index `state` in the parameter table `ParaMap`.

[0172] Each time a state configuration is performed, the process switches to S9 to process the configuration result.

[0173] S10: Use the getWriteResultNetworkDict function to obtain the node configuration result, pass the node number nodeId as a parameter, obtain the fault code abortCode, and judge the obtained node configuration result.

[0174] If the configuration is successful, proceed to S10_1;

[0175] S10_1: This increments the current configuration state (state) in this element of the array by one.

[0176] If the value of state is NUM, then go to S10_2;

[0177] Check the flag bit corresponding to the element at index 'state' in the ValidFlag array. If the bit is 0, continue executing S10_1. If the bit is 1, go to S10_2.

[0178] S10_2 sets the current configuration count try_cnt to 0, and then proceeds to S5 to configure the next state.

[0179] If the configuration fails, increment the configuration count try_cnt by one.

[0180] Check if try_cnt is less than 3. If successful, proceed to S5 to configure the next configuration state. If the check fails, release the semaphore finish_sem using the semaphore release function semGive. Clear the configuration count try_cnt. Set the configuration state to 0. Close the current SDO transfer using the SDO transfer close function closeSDOtransfer.

[0181] As can be seen from the above technical solution, this invention uses a lookup table to record data that cannot be saved when power is off. The transmit PDO and receive PDO are configured into two groups, each consisting of a maximum of four data items. The actual configuration transmission data is determined by the data configuration validity table. During the configuration process, only these two tables need to be traversed. Each group of data configuration is sent and a response is received from the slave station before the next group of data configuration is performed. The delay between different messages is controlled by the configuration status. If receiving the response status fails repeatedly during the configuration process, a maximum of three retransmissions are performed. The configuration process is protected by semaphores and mutexes. When multiple nodes exist, the configuration of one node is completed before proceeding to the next node.

[0182] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A servo system configuration method based on a lookup table, characterized in that, Includes the following steps: S1: Define a structure variable Config_Para_Struct, which includes the communication parameters and mapping parameters for sending PDO (TPDO) and receiving PDO (RPDO). The number of mapping parameters required is NUM. S2: Define the data information structure Map_Para_Struct; S3: Define the array parameter table ParaMap for servo startup configuration. The number of data configured in the parameter table is NUM, and the parameter content is the structure defined in S1. S4: Define the parameter validity flag array ValidFlag; S5: Define the servo configuration management structure SERVO_CONFIG_STATE; S6: Define a servo configuration array variable servo_conf to record the status of N servo nodes. The array elements are the servo configuration management structure SERVO_CONFIG_STATE in S5. S7: Configure the nodeId; S8: Define the node booting function slaveBootupHdl with the node number as the parameter; S9: Configure the servo driver for node number nodeId; S10: Use the getWriteResultNetworkDict function to obtain the node configuration result, pass the node number nodeId as a parameter, obtain the fault code abortCode, and judge the obtained node configuration result; In step S8, the function pointer of the node online function is assigned to the post_SlaveBootup function pointer in the CANOPEN protocol station object dictionary; a task is created in the slaveBootupHdl function, and the node number value nodeId is passed into the task. The function to run this task is step S9. In step S9, the servo driver with node number nodeId is configured, and the current state (state) is passed in; the configuration process is as follows: S9_1 first checks if the state value is less than NUM; if the check is successful, proceed to S9_2; otherwise, use the semaphore release function semGive to release the configured semaphore finish_sem, indicating that there is no more data to be configured. S9_2 uses the node configuration function writeNetworkDictCallBack for configuration. The node number is nodeId, the parameter address Addr is the value of index in the element with index state in the parameter table ParaMap, the parameter subaddr is the value of subIndex in the element with index state in the parameter table ParaMap, the number of bytes N is the value of count in the element with index state in the parameter table ParaMap, and the variable type byte_type is the data pointed to by the data pointer data in the element with index state in the parameter table ParaMap. In step S10, the process of judging the obtained node configuration result is as follows: If the configuration is successful, proceed to S10_1; S10_1: Then increment the current configuration state in this element of the array by one; If the value of state is NUM, then go to S10_2; Determine the flag corresponding to the element at index 'state' in the ValidFlag array. If it is 0, continue executing S10_1; if it is 1, proceed to S10_2. S10_2: The current configuration count try_cnt is set to 0, and the process moves to S5 to configure the next state. If the configuration fails, increment the configuration count try_cnt by one; Check if try_cnt is less than 3. If the check is successful, proceed to S5 to configure the next configuration state. If the check fails, use the semaphore release function semGive to release the semaphore finish_sem, clear the configuration count try_cnt to zero, set the configuration state to 0, and use the SDO transfer close function closeSDOtransfer to close the current transfer SDO.

2. The servo system configuration method based on lookup table as described in claim 1, characterized in that, In step S1, the communication parameters and mapping parameters of RPDO are defined as follows: RPDO1 uses the trans_type_1400 transmission method, with the default parameter being synchronous transmission; RPDO1 mapping parameter 1 pdo_map_val_1600_1; RPDO1 mapping parameter 2 pdo_map_val_1600_2; RPDO1 mapping parameter 3 pdo_map_val_1600_3; RPDO1 mapping parameter 4: pdo_map_val_1600_4; The number of RPDO1 mapping parameters is pdo_map_cnt_1600; RPDO1 frame ID value RPDO_COBId_1400; RPDO2 uses the trans_type_1401 transmission method, with the default parameter being synchronous transmission; RPDO2 mapping parameter 1 pdo_map_val_1601_1; RPDO2 mapping parameter 2 pdo_map_val_1601_2; RPDO2 mapping parameter 3: pdo_map_val_1601_3; RPDO2 mapping parameter 4 pdo_map_val_1601_4; The number of RPDO2 mapping parameters is pdo_map_cnt_1601; RPDO2 frame ID value RPDO_COBId_1401.

3. The servo system configuration method based on lookup table as described in claim 2, characterized in that, In step S1, the communication parameters and mapping parameters of TPDO are as follows: TPDO1 uses the trans_type_1800 transmission method, with the default parameter being synchronous transmission; TPDO1 mapping parameter 1 pdo_map_val_1A00_1; TPDO1 mapping parameter 2 pdo_map_val_1A00_2; TPDO1 mapping parameter 3 pdo_map_val_1A00_3; TPDO1 mapping parameter 4 pdo_map_val_1A00_4; The number of TPDO1 mapping parameters is pdo_map_cnt_1A00; TPDO1 frame ID value RPDO_COBId_1800; TPDO2 uses the trans_type_1801 transmission method, with the default parameter being synchronous transmission; TPDO2 mapping parameter 1 pdo_map_val_1A01_1; TPDO2 mapping parameter 2 pdo_map_val_1A01_2; TPDO2 mapping parameter 3 pdo_map_val_1A01_3; TPDO2 mapping parameter 4 pdo_map_val_1A01_4; The number of TPDO2 mapping parameters is pdo_map_cnt_1A01; TPDO2 frame ID value RPDO_COBId_1801.

4. The servo system configuration method based on lookup table as described in claim 3, characterized in that, In step S2, the data information structure Map_Para_Struct includes: (1) index number, which corresponds to the index of the object dictionary; (2) sub-index number, which corresponds to the sub-index of the object dictionary; (3) parameter number of bytes count, which is of type unsigned integer; (4) data type dataType, which is of type unsigned character; and (5) data pointer data, which is of type unsigned pointer.

5. The servo system configuration method based on a lookup table as described in claim 4, characterized in that, In step S3, the number of data configured in the array parameter table ParaMap is NUM, and the parameter content is the structure defined in S1.

6. The servo system configuration method based on a lookup table as described in claim 5, characterized in that, In step S3, the initial contents of the configuration parameter table are: Index value 0x1400, sub-index number 2, data length 1, type is uint8, variable is trans_type_1400; Index value 0x1600, sub-index number 1, data length 4, type is uint32, variable is pdo_map_val_1600_1; Index value 0x1600, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1600_2; Index value 0x1600, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1600_3; Index value 0x1600, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1600_4; Index value 0x1600, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1600; Index value 0x1400, sub-index number 1, data length 4, type is uint32, variable is RPDO_COBId_1400; Index value 0x1401, sub-index number 2, data length 1, type is uint8, variable is trans_type_1401; Index value 0x1601, sub-index number 1, data length 4, type is uint32, variable is pdo_map_val_1601_1; Index value 0x1601, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1601_2; Index value 0x1601, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1601_3; Index value 0x1601, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1601_4; Index value 0x1601, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1601; Index value 0x1401, sub-index number 1, data length 4, type uint32, variable RPDO_COBId_1401; Index value 0x1800, sub-index number 2, data length 1, type is uint8, variable is trans_type_1800; Index value 0x1A00, sub-index number 1, data length 4, type uint32, variable pdo_map_val_1A00_1; Index value 0x1A00, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1A00_2; Index value 0x1A00, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1A00_3; Index value 0x1A00, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1A00_4; Index value 0x1A00, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1A00; Index value 0x1800, sub-index number 1, data length 4, type is uint32, variable is RPDO_COBId_1800; Index value 0x1801, sub-index number 2, data length 1, type is uint8, variable is trans_type_1801; Index value 0x1A01, sub-index number 1, data length 4, type uint32, variable pdo_map_val_1A01_1; Index value 0x1A01, sub-index number 2, data length 4, type is uint32, variable is pdo_map_val_1A01_2; Index value 0x1A01, sub-index number 3, data length 4, type is uint32, variable is pdo_map_val_1A01_3; Index value 0x1A01, sub-index number 4, data length 4, type is uint32, variable is pdo_map_val_1A01_4; Index value 0x1A01, sub-index number 0, data length 1, type uint8, variable pdo_map_cnt_1A01; Index value 0x1801, sub-index number 1, data length 4, type uint32, variable RPDO_COBId_1801.

7. The servo system configuration method based on a lookup table as described in claim 6, characterized in that, In step S4, the elements of the valid flag array ValidFlag are of boolean type and the array length is NUM. An array element with a value of 1 indicates that the data with the corresponding index is configured, and an array element with a value of 0 indicates that the data with the corresponding index does not need to be configured.

8. The servo system configuration method based on a lookup table as described in claim 7, characterized in that, In step S5, the servo configuration management structure SERVO_CONFIG_STATE variable includes: (1) configuration status state, (2) current configuration count try_cnt, and (3) configuration completion semaphore finish_sem.

9. The servo system configuration method based on a lookup table as described in claim 8, characterized in that, In step S7, the nodeId is numbered starting from 1. First, the current configuration state in this element of the array is set to 0, the current configuration count try_cnt is set to 0, the binary semaphore creation function semBCreate is used to create the semaphore, and pthread_mutex_lock is used to lock it.

Citation Information

Patent Citations

  • CANOPEN-based multi-motor servo system initialization configuration method

    CN117527472A