CN117527472A - Multi-motor servo system initialization configuration method based on CANOPEN - Google Patents

Multi-motor servo system initialization configuration method based on CANOPEN Download PDF

Info

Publication number
CN117527472A
CN117527472A CN202311500021.5A CN202311500021A CN117527472A CN 117527472 A CN117527472 A CN 117527472A CN 202311500021 A CN202311500021 A CN 202311500021A CN 117527472 A CN117527472 A CN 117527472A
Authority
CN
China
Prior art keywords
configuration
servo
node
state
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311500021.5A
Other languages
Chinese (zh)
Inventor
王雨龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Jinhang Computing Technology Research Institute
Original Assignee
Tianjin Jinhang Computing Technology Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Jinhang Computing Technology Research Institute filed Critical Tianjin Jinhang Computing Technology Research Institute
Priority to CN202311500021.5A priority Critical patent/CN117527472A/en
Publication of CN117527472A publication Critical patent/CN117527472A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40169Flexible bus arrangements
    • H04L12/40176Flexible bus arrangements involving redundancy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention discloses a CANOPEN-based multi-motor servo system initialization configuration method, which comprises the following steps: s1, defining a SERVO configuration management structure SERVO_CONFIG_STATE; s2, defining a SERVO configuration array variable servo_conf to record N SERVO node STATEs, wherein the array element is a SERVO configuration management structure SERVO_CONFIG_STATE in S1; s3, configuring a node nodeId; s4, defining a node online function sloveBootupoHdl parameter as a node number; s5, configuring a servo driver of the node number nodeId; and S6, acquiring a node configuration result by using a getWriteResultNetworkDict function, transmitting parameters into a node number nodeId, acquiring a fault code abortCode, and judging the acquired node configuration result. The configuration process of the plurality of secondary stations performs process protection through the semaphore and the mutual exclusion lock, thereby ensuring the configuration time sequence and enhancing the reliability.

Description

Multi-motor servo system initialization configuration method based on CANOPEN
Technical Field
The invention belongs to the technical field of industrial control, and relates to a CANOPEN-based multi-motor servo system initialization configuration method.
Background
CANopen communication is a form of communication established over the CAN data link layer, which provides for the application layer to be concerned. The CANopen device model includes a communication section, an object dictionary, and an application section. The communication part comprises a PDO object, an SDO object and an NMT object. The object dictionary includes data types, communication objects, and application objects.
After the servo motor is powered on, parameters in the object dictionary are required to be configured, an SDO mode is generally used as a configuration mode, the configuration mode of the SDO is a request response mode, and the parameter configuration success is only indicated by the master station receiving a response of the slave station. Conventionally, parameter configuration generally only sends an SDO request, and does not process a response, and a mode of adding an SDO message command is generally adopted for configuring a plurality of motors, so that the configuration efficiency is low, a reliable judging mechanism is not provided under the condition of encountering a transmission data error with poor communication quality, and the transmission reliability is further reduced along with the increase of the number of nodes.
Disclosure of Invention
Object of the invention
The purpose of the invention is that: the initialization configuration method of the servo system based on the CANOPEN comprises the step of realizing the configuration flow of a single node in a state machine mode by adopting the state machine mode. Only when the parameter configuration is issued in the current state and the response of the slave station is received, the slave station jumps to the next state, if the state fails in receiving the response, the slave station retransmits for at most three times, and in the configuration process, configuration process protection is carried out through the semaphore and the mutual exclusion lock; and after one node configuration is completed, the next node configuration is performed.
(II) technical scheme
In order to solve the technical problems, the invention provides a CANOPEN-based multi-motor servo system initialization configuration method, which comprises the following steps:
s1, defining a SERVO configuration management structure SERVO_CONFIG_STATE;
s2, defining a SERVO configuration array variable servo_conf to record N SERVO node STATEs, wherein the array element is a SERVO configuration management structure SERVO_CONFIG_STATE in S1;
s3, configuring a node nodeId;
s4, defining a node online function sloveBootupoHdl parameter as a node number;
s5, configuring a servo driver of the node number nodeId;
and S6, acquiring a node configuration result by using a getWriteResultNetworkDict function, transmitting parameters into a node number nodeId, acquiring a fault code abortCode, and judging the acquired node configuration result.
In step S1, the variables of the structure servo_config_state include: (1) a configuration state, (2) a current configuration number try_cnt, and (3) a configuration completion semaphore finish_sem.
In step S3, the nodes nodeId are numbered from 1, the current configuration state in the element in the array is set to 0, the current configuration number of times try_cnt is set to 0, and the binary semaphore creation function semBCreate is used to create the semaphore, and the parameters are sem_q_fifo and sem_empty, respectively.
In step S3, the node nodeId is locked using pthread_mutex_lock.
In step S4, a function pointer of the node online function is assigned to a post_SlaveBooteup function pointer of the CANOPEN protocol station object dictionary.
In step S4, a task is created in the node online function, and the node number nodeId is transmitted to the task for execution in step S5.
In step S5, when the servo driver is configured, the input data is the current state, and the configuration function contains N states, and the state magnitude is from 0 to N-1.
In step S5, when the state value matches the first N-1 states of the N states, the parameter is configured, the configuration data variable is data, the byte number is N, the variable type byte_type is configured by using a node configuration function writenetworkDictccallback, the node number is nodeId, the parameter address Addr, the parameter sub-address sub Addr, the byte number N and the variable type byte_type are filled; when the state value matches to the last of the N states, then the configuration completion semaphore finish_sim is released using the semaphore release function semtive.
In step S5, the variable type byte_type includes: boolean, signed character type int8, signed short integer int16, signed integer int32, unsigned character type uint8, unsigned short integer uint16, unsigned integer uint32, floating point type real32.
In step S6, if the configuration result is successful, adding an operation to the current configuration state in the element in the array; the current configuration times try_cnt are set to 0, and the next state configuration is carried out in S4;
if the configuration result fails, adding an operation to the configuration times try_cnt;
judging whether the try_cnt is smaller than 3, if so, turning to S4 to perform configuration of the next configuration state; if the judgment fails, releasing the signal quantity finish_sem by using a signal quantity release function semtive; zero clearing operation is carried out on the configuration times try_cnt; configuring a configuration state to be 0; the SDO transfer shutdown function close transfer is used to shutdown the current transfer SDO.
(III) beneficial effects
According to the CANOPEN-based multi-motor servo system initialization configuration method provided by the technical scheme, the configuration process is orderly and reliable under the condition that the master station controls the application of a plurality of nodes by adopting the state machine type parameter configuration method, the configuration errors encountered in the configuration process are retransmitted for at most three times, and the configuration reliability of a plurality of slave stations is ensured. Meanwhile, the configuration process of the plurality of secondary stations performs process protection through the semaphore and the mutual exclusion lock, so that the configuration time sequence is ensured, and the reliability is enhanced.
Drawings
FIG. 1 is a flowchart of a CANOPEN-based multi-motor servo system initialization configuration method according to an embodiment of the present invention.
Detailed Description
To make the objects, contents and advantages of the present invention more apparent, the following detailed description of the present invention will be given with reference to the accompanying drawings and examples.
Referring to fig. 1, the initialization configuration method of the multi-motor servo system based on the CANOPEN of the present embodiment includes the following steps:
s1 defines a SERVO configuration management structure SERVO_CONFIG_STATE
The structural variables include: (1) a configuration state, (2) a current configuration number try_cnt, (3) a configuration completion semaphore finish_sem;
s2 defines a SERVO configuration array variable servo_conf to record N SERVO node STATEs, and the array element is a SERVO configuration management structure SERVO_CONFIG_STATE in S1.
S3, configuring node nodeId, numbering from 1, firstly setting the current configuration state in the element in the array to 0, setting the current configuration times try_cnt to 0, and creating a semaphore by using a binary semaphore creation function semBCreate, wherein parameters are SEM_Q_FIFO and SEM_EMPTY respectively; locking is performed using pthread_mutex_lock.
S4, defining a node online function sloveBooteHdl parameter as a node number, and assigning a function pointer of the function to a post_SlaveBooteup function pointer of the CANOPEN protocol station object dictionary.
Creating a task in a sloveBootuphdl function, and transmitting a node number value nodeId into the task, wherein the task running function is S5;
s5, configuring a servo driver of the node number nodeId, wherein the input data is a current state, and the configuration function contains N states in total, and the state magnitude is from 0 to N-1.
When the state value matches the first N-1 states (0 to N-2) of the N states, the parameter is configured, the configuration data variable is data, the number of bytes is N (one byte, two bytes, four bytes), the variable type byte_type (boolean, signed character type int8, signed short integer int16, signed integer int32, unsigned character type ui 8, unsigned short integer ui 16, unsigned integer ui 32, floating point type real 32) is configured using the node configuration function writenetworkDictccall back, the node number is nodeId, the parameter address Addr, the parameter sub-address SubAddr, the number of bytes N, and the variable type byte_type are filled. Each time the state configuration is performed, the process goes to S5 to process the configuration result
When the state value matches to the last of the N states (N-1), then the configuration completion semaphore finish_sem is released using the semaphore release function semgo.
And S6, acquiring a node configuration result by using a getWriteResultNetworkDict function, transmitting parameters into a node number nodeId, acquiring a fault code abortCode, and judging the acquired node configuration result.
If the configuration result is successful, the current configuration state in the element in the array is added with one operation. The current configuration number try_cnt is set to 0, and the process goes to S4 to perform the next state configuration.
If the configuration result fails, adding one operation to the configuration times try_cnt.
Judging whether the try_cnt is smaller than 3, and if so, judging success. And then, turning to S4 to perform the next configuration state for configuration. If the judgment fails, the signal quantity finish_sem is released by using a signal quantity release function semtive. And carrying out zero clearing operation on the configuration times try_cnt. The configuration state is configured to 0.
The SDO transfer shutdown function close transfer is used to shutdown the current transfer SDO.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and variations could be made by those skilled in the art without departing from the technical principles of the present invention, and such modifications and variations should also be regarded as being within the scope of the invention.

Claims (10)

1. The initialization configuration method of the servo system based on the CANOPEN is characterized by comprising the following steps of:
s1, defining a SERVO configuration management structure SERVO_CONFIG_STATE;
s2, defining a SERVO configuration array variable servo_conf to record N SERVO node STATEs, wherein the array element is a SERVO configuration management structure SERVO_CONFIG_STATE in S1;
s3, configuring a node nodeId;
s4, defining a node online function sloveBootupoHdl parameter as a node number;
s5, configuring a servo driver of the node number nodeId;
and S6, acquiring a node configuration result by using a getWriteResultNetworkDict function, transmitting parameters into a node number nodeId, acquiring a fault code abortCode, and judging the acquired node configuration result.
2. The CANOPEN-based multi-motor SERVO system initialization configuration method according to claim 1, wherein in step S1, the variables of the structure body servo_config_state include: (1) a configuration state, (2) a current configuration number try_cnt, and (3) a configuration completion semaphore finish_sem.
3. The initialization configuration method of claim 2, wherein in step S3, nodes nodeId are numbered from 1, first, the current configuration state in the element in the array is set to 0, the current configuration number try_cnt is set to 0, and the binary semaphore creation function semBCreate is used to create semaphores, the parameters are sem_q_fifo and sem_empty, respectively.
4. The CANOPEN-based multi-motor servo system initialization configuration method of claim 3, wherein in step S3, node nodeId is locked using pthread_mutex_lock.
5. The method for initializing and configuring a servo system based on CANOPEN multiple motors according to claim 4, wherein in step S4, a function pointer of a node on-line function is assigned to a post_slavebootup function pointer of a CANOPEN protocol station object dictionary.
6. The method for initializing configuration of a CANOPEN-based multi-motor servo system according to claim 5, wherein in step S4, a task is created in the node on-line function, and the node number nodeId is transferred into the task for execution in step S5.
7. The method of claim 6, wherein in step S5, the servo driver is configured with the incoming data being a current state, and the configuration function includes N states, and the state value is from 0 to N-1.
8. The initialization configuration method of claim 7, wherein in step S5, when the state value matches the first N-1 states of the N states, parameters are configured, the configuration data variable is data, the byte number is N, the variable type byte_type is configured using a node configuration function writenetworkdialcallback, the node number is nodeId, the parameter address Addr, the parameter sub-address SubAddr, the byte number N, and the variable type byte_type; when the state value matches to the last of the N states, then the configuration completion semaphore finish_sim is released using the semaphore release function semtive.
9. The CANOPEN-based multi-motor servo system initialization configuration method according to claim 8, wherein in step S5, variable type byte_type comprises: boolean, signed character type int8, signed short integer int16, signed integer int32, unsigned character type uint8, unsigned short integer uint16, unsigned integer uint32, floating point type real32.
10. The method for initializing and configuring a servo system based on CANOPEN according to claim 9, wherein in step S6, if the configuration result is successful, the current configuration state in the element in the array is added with one; the current configuration times try_cnt are set to 0, and the next state configuration is carried out in S4;
if the configuration result fails, adding an operation to the configuration times try_cnt;
judging whether the try_cnt is smaller than 3, if so, turning to S4 to perform configuration of the next configuration state; if the judgment fails, releasing the signal quantity finish_sem by using a signal quantity release function semtive; zero clearing operation is carried out on the configuration times try_cnt; configuring a configuration state to be 0; the SDO transfer shutdown function close transfer is used to shutdown the current transfer SDO.
CN202311500021.5A 2023-11-13 2023-11-13 Multi-motor servo system initialization configuration method based on CANOPEN Pending CN117527472A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311500021.5A CN117527472A (en) 2023-11-13 2023-11-13 Multi-motor servo system initialization configuration method based on CANOPEN

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311500021.5A CN117527472A (en) 2023-11-13 2023-11-13 Multi-motor servo system initialization configuration method based on CANOPEN

Publications (1)

Publication Number Publication Date
CN117527472A true CN117527472A (en) 2024-02-06

Family

ID=89741304

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311500021.5A Pending CN117527472A (en) 2023-11-13 2023-11-13 Multi-motor servo system initialization configuration method based on CANOPEN

Country Status (1)

Country Link
CN (1) CN117527472A (en)

Similar Documents

Publication Publication Date Title
EP1004062B1 (en) System and methods for achieving heterogeneous data flow between algorithm blocks in a distributed control system
CN101305551B (en) Method, system, network node and device for the construction and execution of a distributed workflow in a communication system
US9667699B2 (en) Method for transmitting data via a CANopen bus
CN109768970B (en) Configurable universal protocol generation method
CN112104538B (en) DDS middleware communication method based on CAN bus data transmission
JP2888642B2 (en) Communication system with network including management package
CN111897300A (en) OPC-UA (OLE for process control-user agent) -based software/hardware combined simulation system and self-adaptive cooperation method thereof
US6574744B1 (en) Method of determining a uniform global view of the system status of a distributed computer network
CN117527472A (en) Multi-motor servo system initialization configuration method based on CANOPEN
CN109862445A (en) A kind of communication system and its communication means of distributed charging pile
CN112751752B (en) Route convergence method, device, communication equipment and storage medium
CN115827285B (en) Cross-platform communication method, system, device, equipment and medium
CN115567501A (en) Web3Dapp cross-chain system and method based on PoS consensus
CN108334094A (en) A kind of CAN bus communication means for omni-directional mobile robots kinetic control system
JP2002259126A (en) Software constituent for distributed control system, and method for designing control system
CN117560239A (en) Servo system configuration method based on lookup table
CN114040149A (en) Service digital intelligent evolution equipment monitoring method
Saleh et al. Communications software reverse engineering: a semi-automatic approach
CN115509146B (en) Distributed communication resource integration method for flight maintenance simulator
CN114338265B (en) Program downloading system and method based on TTP/C bus
CN115857420B (en) IO mutual control method between industrial control equipment
Cornwell Factors affecting the realiability of real time distributed control systems
CN117811917A (en) High-speed magnetic levitation transport control message self-adaptive conversion method, equipment and medium
CN105022636B (en) A kind of programming language system towards intelligence member
JPH0438175B2 (en)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination