CN119675813B - Network load optimization method for robot operating system based on time-sensitive network - Google Patents
Network load optimization method for robot operating system based on time-sensitive network Download PDFInfo
- Publication number
- CN119675813B CN119675813B CN202411849064.9A CN202411849064A CN119675813B CN 119675813 B CN119675813 B CN 119675813B CN 202411849064 A CN202411849064 A CN 202411849064A CN 119675813 B CN119675813 B CN 119675813B
- Authority
- CN
- China
- Prior art keywords
- time
- network
- data
- clock
- master clock
- 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.)
- Active
Links
Landscapes
- Synchronisation In Digital Transmission Systems (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention provides a network load optimization method of a robot operating system based on a time sensitive network, which relates to the technical field of network transmission, and comprises the steps of acquiring time data between a previous master clock and each slave clock when a master clock in the robot operating system periodically sends a declaration message to each slave clock to exchange clock information, wherein the time data is time data in the time setting process between the master clock and each slave clock; the method comprises the steps of obtaining corresponding time deviation and network delay according to time data, obtaining current network load data of a local area network according to all the time deviation and the network delay, comparing the current network load data with a preset threshold value to obtain a comparison result, adjusting port parameters of a master clock according to the comparison result, and intelligently adjusting the port parameters of the master clock in a robot operating system to reduce unnecessary time synchronization message transmission, so that occupation of network bandwidth is reduced, and transmission efficiency of the whole network is improved.
Description
Technical Field
The invention relates to the technical field of network transmission, in particular to a network load optimization method of a robot operating system based on a time-sensitive network.
Background
Time sensitive networks (Time-SENSITIVE NETWORK, TSNs) are a set of IEEE standards aimed at providing deterministic services to users over Local Area Networks (LANs), ensuring that Time critical data streams can be transmitted within a specified Time. At present, with the development of robot technology, the requirements on real-time communication control of robots are higher and higher, so that a robot operating system is required to ensure real-time transmission of control information on the basis of ensuring distributed control of the robots, and a time sensitive network can provide a unified data link layer for real-time communication of the robots and simultaneously allow fusion of flow and real-time communication.
The precise time protocol (Precision Time Protocol, PTP) is the basis for implementing TSNs, responsible for high precision time synchronization between network devices. The PTP can provide microsecond-level and even nanosecond-level time synchronization precision, which is important to the application scenes such as motor control, key sensor data synchronization and the like requiring strict time synchronization in robot control. In the working process of the PTP protocol, a master clock periodically sends a Sync message and a Follow_up message to a slave clock, the slave clock carries time stamp information, the slave clock periodically feeds back with the master clock, and finally, the slave clock calculates and adjusts the local clock to synchronize with the master clock according to the received time, so that the synchronization of the master clock and the slave clock is realized.
However, the smaller the period of the master clock sending Sync messages, the more frequent the time correction of the robotic network device. Although this may improve the time accuracy in the lan, frequent message transmission may also result, thereby increasing the occupation of the network bandwidth and affecting the transmission efficiency of other data streams.
Disclosure of Invention
The invention solves the problem of how to solve the problem that the frequently sent time-setting information which is caused by the time-setting method and applied to the time-sensitive network of the robot operating system occupies the network bandwidth of the local area network, thereby influencing the transmission efficiency of other data streams.
In order to solve the problems, the invention provides a method and a system for optimizing network load of a robot operating system based on a time-sensitive network.
In a first aspect, the present invention provides a method for optimizing network load of a time sensitive network-based robot operating system, which is applied to a local area network under the robot operating system, wherein the local area network includes a time synchronization system constructed based on a master clock and a plurality of slave clocks, and the method for optimizing network load of the time sensitive network-based robot operating system includes:
when the master clock periodically transmits a declaration message to each of the slave clocks to exchange clock information,
Acquiring time data between the master clock and each slave clock in the previous time, wherein the time data is time data in the time synchronization process between the master clock and each slave clock;
Obtaining corresponding time deviation and network delay according to each time data, and obtaining current network load data of the local area network according to all the time deviation and the network delay;
based on a preset threshold value, comparing the current network load data with the current network load data to obtain a comparison result, and adjusting the port parameters of the master clock according to the comparison result.
Optionally, the port parameter includes an internal synchronization period, the comparing with the current network load data based on a preset threshold value to obtain a comparison result, and adjusting the port parameter of the master clock according to the comparison result, including:
When the current network load data is larger than the preset threshold value, the corresponding internal synchronization period is adjusted according to a first preset period;
when the current network load data is smaller than or equal to the preset threshold value, the corresponding internal synchronization period is adjusted according to a second preset period;
and the internal synchronous period is a synchronous message sending period corresponding to the port of the master clock.
Optionally, the time data includes first time data, second time data, third time data and fourth time data, and when the master clock periodically sends a declaration message to each slave clock to exchange clock information, acquiring the time data between the master clock and each slave clock the last time, including:
sending a synchronous message to each slave clock through the master clock, and sending the time when the corresponding synchronous message leaves the master clock to the corresponding slave clock as the corresponding first time data;
when the slave clock receives the corresponding synchronous message, recording the arrival time of the synchronous message, and taking the arrival time of the synchronous message as the second time data;
sending a delay request message to the master clock through each slave clock, and taking the time when the corresponding delay request message leaves the slave clock as the corresponding third time data;
when the master clock receives the delay request messages, the arrival time of each delay request message is recorded, the arrival time of the delay request message is used as the fourth time data, and the delay reply message is sent to the corresponding slave clock.
Optionally, the obtaining the corresponding time deviation and the network delay according to each time data includes:
Obtaining the corresponding time deviation and the network delay through a formula I and a formula II according to the corresponding first time data, second time data, third time data and fourth time data;
Wherein, the formula one is:
;
The formula II is as follows:
;
Wherein, the For the first time data,For the second time data,For the third time data to be used,And for the fourth time data, offset is the time offset, delay is the network delay.
Optionally, the delay request message structure includes a transmission time stamp, a corresponding previous time deviation of the slave clock, and the network delay.
Optionally, the obtaining the current network load data of the local area network according to all the time offsets and the network delays includes:
Acquiring an initialization weight of each node in the local area network;
and obtaining the current network load data based on the corresponding initialization weight according to all the time deviations and the network delay.
Optionally, the obtaining the current network load data according to the time deviation and the network delay in all previous time and based on the corresponding initialization weight includes:
obtaining the current network load data through a third method based on the corresponding initialization weight according to all the time deviations and the network delay;
Wherein, the formula III is:
;
Wherein, the For the current network load data to be used,An initialization weight for node i, n is the number of nodes,For the previous time offset between node i and the master node,A and b are respectively time deviation and preset duty ratio of network delay under load condition, and a+b=1, 0 is less than or equal to a and less than or equal to 1, and 0 is less than or equal to b and less than or equal to 1.
Optionally, the robot operating system network load optimization based on the time sensitive network further comprises:
And corresponding to the time deviation and the network delay obtained by calculation of the slave clock, and adjusting the current corresponding local clock according to the time deviation and the network delay so as to synchronize with the master clock.
In a second aspect, the present invention provides a time-sensitive network-based network load optimization system of a robot operating system, which is applied to a local area network under the robot operating system, wherein the local area network includes a time synchronization system constructed based on a master clock and a plurality of slave clocks, and the time-sensitive network-based network load optimization system of the robot operating system includes:
The acquisition unit is used for acquiring time data between the master clock and each slave clock before when the master clock periodically sends an declaration message to each slave clock to exchange clock information, wherein the time data is time data in the time synchronization process between the master clock and each slave clock;
The processing unit is used for obtaining corresponding time deviation and network delay according to the time data, obtaining current network load data of the local area network according to all the time deviation and the network delay, comparing the current network load data with a preset threshold value based on the preset threshold value to obtain a comparison result, and adjusting port parameters of the master clock according to the comparison result.
In a third aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method for optimizing network load of a time sensitive network based robotic operating system according to the first aspect.
The method and the device for optimizing the network load of the robot operating system based on the time sensitive network have the beneficial effects that:
In a local area network under the framework of a robot operating system, first, a master clock periodically sends a declarative message to all slave clocks to exchange clock information and keep time synchronization. During each time tick, time data between the previous time and each slave clock is collected. These time data generally include the sending moment of Sync messages sent by the master clock, the arrival moment of Sync messages recorded by the slave clock, the sending moment of delay_req messages, and the arrival moment of delay_resp to the master clock, and from the collected time data, the time offset between the master clock and each slave clock (i.e. the degree of clock asynchronization) and the network Delay (i.e. the time required for the transmission of the data packets in the network) are calculated.
And comprehensively obtaining the current network load data of the local area network by utilizing the time deviation and the network delay of all the slave clocks. This data reflects the load situation of the network in the current state. The current network load data is generally calculated by the corresponding time deviation and network delay of the previous time, and the current network load data is compared with a preset threshold value. If the current load exceeds the threshold, it is stated that the network may be at risk of congestion or overload. According to the comparison result, the port parameters of the master clock (for example, the sending frequency of the Sync message is adjusted or the priority of the data stream is changed) are adjusted so as to optimize the network load.
By intelligently adjusting the port parameters of the master clock in the robot operating system, unnecessary time synchronization message transmission is reduced, thereby reducing the occupation of network bandwidth and improving the transmission efficiency of the whole network. The method can dynamically adapt to different network load conditions while ensuring time synchronization precision, and avoid network congestion caused by frequent sending of time synchronization information. Meanwhile, by monitoring and adjusting the network load in real time, time synchronization failure caused by network overload can be effectively avoided, and the stability and reliability of the system are enhanced.
In summary, the invention can dynamically adjust according to the actual network state in the robot operating system, has strong adaptability, and is suitable for local area networks with various loads and application scenes. And by optimizing network load and improving system stability, faults and maintenance requirements caused by network problems are reduced, so that the overall maintenance cost is reduced. The network load optimization method not only solves the problems of bandwidth occupation and time error in the prior art, but also improves the performance and reliability of the local area network, and has good application prospect.
Drawings
Fig. 1 is a flow chart of a network load optimization method of a robot operating system based on a time sensitive network according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an interaction process of messages during master-slave clock synchronization and dynamic adjustment according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a Delay_Req message structure according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a method for optimizing network load of a robot operating system based on a time-sensitive network under the framework of the robot operating system according to an embodiment of the present invention;
Fig. 5 is a schematic structural diagram of a network load optimization system of a robot operating system based on a time-sensitive network according to an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the invention will be readily understood, a more particular description of the invention will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings. While the invention is susceptible of embodiment in the drawings, it is to be understood that the invention may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided to provide a more thorough and complete understanding of the invention. It should be understood that the drawings and embodiments of the invention are for illustration purposes only and are not intended to limit the scope of the present invention.
It should be understood that the various steps recited in the method embodiments of the present invention may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the invention is not limited in this respect.
The term "comprising" and variations thereof as used herein is meant to be open-ended, i.e., "including but not limited to," based at least in part on, "one embodiment" means "at least one embodiment," another embodiment "means" at least one additional embodiment, "some embodiments" means "at least some embodiments," and "optional" means "optional embodiment. Related definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish between different devices, modules or units, and are not intended to limit the order or interdependence of functions performed by these devices, modules or units.
It should be noted that references to "a" and "an" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of such messages or information.
In the prior art, in the working process of the PTP protocol, a master clock periodically sends a Sync message and a Follow_up message to a slave clock to carry time stamp information, so that the synchronization of the clocks is realized. The method comprises the following steps of sending a Sync message, wherein a master clock periodically sends the Sync message and carries a time estimation value (originTimestamp). And (3) the Follow_up message is sent, namely, immediately after the Follow_up message is sent by the main clock, the precise sending moment (preciseOriginTimestamp) of the Sync message is carried. The slave clock records time, namely, the arrival time of the Sync message and the accurate sending time of the Follow_up message are recorded by the slave clock. Delay request, slave clock send delay_req message and record send time. The master clock responds to the time when the master clock records the received delay_req message and sends a delay_resp message carrying the time information. Clock bias calculation, namely calculating clock bias between the local clock and the master clock according to the received time information by the slave clock, and adjusting the local clock to keep synchronization. Through the above steps, clock synchronization between the master clock and the slave clock is achieved. However, the smaller the period of the main clock sending the Sync message, the more frequent the time correction of the network device, and although the time accuracy in the local area network can be improved, frequent message transmission can be caused, so as to increase the occupation of the network bandwidth and affect the transmission efficiency of other data streams.
Namely, 1, frequently sending Sync messages occupies the bandwidth of the local area network, so that the transmission of other data streams is affected, network congestion is possibly caused, and the overall network performance is reduced. 2. How to optimize the sending frequency of the Sync message while ensuring the time synchronization precision so as to reduce the network load is a problem to be solved urgently. 3. Under high load conditions, how to manage and reduce delay and jitter caused by frequent message transmission to ensure real-time performance of critical applications is a great challenge in technical implementation. 4. The existing scheme lacks a dynamic adjustment mechanism for the Sync message sending period, and can not optimize the sending frequency in real time according to network load and clock deviation, so that the performance under different network conditions is poor. 5. Frequent time setting processes increase the complexity of the system, possibly resulting in difficulty in troubleshooting and maintenance, and affecting the stability and reliability of the system.
In summary, although PTP and TSN provide high-precision time synchronization mechanisms, in practical applications, how to balance the accuracy of time synchronization with the problems of occupation of network bandwidth, delay, and complexity of the system, etc. remain technical challenges that need to be studied and solved.
Based on this, as shown in fig. 1, the method for optimizing the network load of the robot operating system based on the time-sensitive network according to the embodiment of the present invention is applied to a local area network under the robot operating system, where the local area network includes a time synchronization system constructed based on a master clock and a plurality of slave clocks, and the method for optimizing the network load of the robot operating system based on the time-sensitive network includes:
S100, when the master clock periodically sends a declaration message to each slave clock to exchange clock information, acquiring time data between the master clock and each slave clock in the previous time, wherein the time data is time data in the time synchronization process between the master clock and each slave clock;
Specifically, the master clock periodically sends an announcement message to all the slave clocks. This message contains the current time information of the master clock, usually transmitted in a specific format, to ensure that the slave clock is able to resolve accurately.
When the master clock transmits the declaration message, a time stamp of the moment is recorded, which is called transmission time. At the same time, when each slave clock receives the declaration message, the timestamp of the message is also recorded, and the timestamp is called the receiving time. The master clock periodically sends an Announce message to the slave clocks and exchanges clock information with each other, meanwhile, the master clock periodically sends a Sync message, records the accurate sending time of the Sync message leaving the master clock, and after receiving the Sync message, the slave clock replies to the master clock according to a specified flow, typically by sending a response message (such as delay_req, delay request message) to confirm the receiving condition. When the master clock receives the response, the master clock records the receiving time and sends a delay_resp message to the corresponding slave clock. The recorded time stamp is utilized as a data basis for the subsequent process.
S200, obtaining corresponding time deviation and network delay according to each time data, and obtaining current network load data of the local area network according to all the time deviation and the network delay;
In particular, the master clock typically collects time offset and network delay data for a plurality of slave clocks over a period of time. And counting the data to form a record library, so that the subsequent analysis is convenient. Based on all collected time bias and network delay data, a statistical method can be used to calculate the current load of the local area network. It should be noted that, the current network load data is generally calculated by using the previous time deviation and the network delay data.
The analysis of the calculated average time deviation and network delay can help to evaluate the current network load situation. For example, if the network delay increases, it may mean that the network is being impacted by higher loads.
Meanwhile, the time deviation is calculated regularly, so that the time between the slave clock and the master clock can be kept consistent, and the overall time synchronization precision of the system is improved. And by monitoring the network load in real time, a network administrator can flexibly adjust the resource allocation to ensure the stable operation of the key application under the high load condition.
Through the above process, the master clock can obtain and analyze the time deviation and the network delay of the slave clock, thereby evaluating the current load of the local area network in real time. The analysis not only improves the precision of time synchronization and network performance, but also provides necessary data support for network management, and ensures the stability and efficient operation of the system.
S300, comparing the current network load data with the current network load data based on a preset threshold value to obtain a comparison result, and adjusting the port parameters of the master clock according to the comparison result.
Specifically, a set of preset thresholds may be set according to the requirements and load characteristics of the network operation. These thresholds typically include a load threshold that indicates the maximum load value allowed by the network beyond which performance of the network may be affected. Delay threshold-time acceptable limits reflecting network response.
For example, a maximum load threshold (e.g., 80%) and a maximum delay threshold (e.g., 100 ms). According to the method of the previous step, the current network load data is calculated, including the average time deviation and the average network delay. Comparing the calculated current network load data with a preset threshold value, wherein if the current network load exceeds the preset load threshold value or the network delay exceeds the delay threshold value, the network load is higher, and the application performance is possibly affected. Otherwise, if the value is lower than the threshold value, the network is indicated to be normal.
And determining whether to adjust the port parameters of the master clock according to the comparison result. After the parameters are adjusted, the network load and delay are continuously monitored to evaluate the effectiveness of the adjustment. If the load data improves, indicating that the adjustment was successful, if not, further analysis and optimization may be required.
By dynamically adjusting the parameters of the master clock port according to the network load, the network load change can be recognized and responded in time, the probability of system faults can be reduced, and the continuous availability of key application programs is ensured. And by comparing the monitored load data with a preset threshold value, a more scientific decision can be made based on the actual data, and single static configuration is not relied on any more.
Therefore, by comparing the current network load data with a preset threshold value and adjusting the main clock port parameter according to the comparison result, the effective monitoring and dynamic optimization of the network condition can be realized. The process not only improves the network performance and reliability, but also provides more efficient decision support for network management, and ensures the stable operation of the system under various loads.
In this embodiment, in the local area network under the frame of the robot operating system, the master clock periodically sends a declaration message to all the slave clocks to exchange clock information and keep time synchronization. During each time tick, time data between the previous time and each slave clock is collected. These time data generally include the sending moment of Sync messages sent by the master clock, the arrival moment of Sync messages recorded by the slave clock, the sending moment of delay_req messages, and the arrival moment of delay_resp to the master clock, and from the collected time data, the time offset between the master clock and each slave clock (i.e. the degree of clock asynchronization) and the network Delay (i.e. the time required for the transmission of the data packets in the network) are calculated.
And comprehensively obtaining the current network load data of the local area network by utilizing the time deviation and the network delay of all the slave clocks. This data reflects the load situation of the network in the current state. The current network load data is generally calculated by the corresponding time deviation and network delay of the previous time, and the current network load data is compared with a preset threshold value. If the current load exceeds the threshold, it is stated that the network may be at risk of congestion or overload. According to the comparison result, the port parameters of the master clock (for example, the sending frequency of the Sync message is adjusted or the priority of the data stream is changed) are adjusted so as to optimize the network load.
The port parameters of the whole master clock in the robot operating system are intelligently adjusted, so that unnecessary time synchronization message transmission is reduced, the occupation of network bandwidth is reduced, and the transmission efficiency of the whole network is improved. The method can dynamically adapt to different network load conditions while ensuring time synchronization precision, and avoid network congestion caused by frequent sending of time synchronization information. Meanwhile, by monitoring and adjusting the network load in real time, time synchronization failure caused by network overload can be effectively avoided, and the stability and reliability of the system are enhanced.
In summary, the invention can dynamically adjust according to the actual network state in the robot operating system, has strong adaptability, and is suitable for local area networks with various loads and application scenes. And by optimizing network load and improving system stability, faults and maintenance requirements caused by network problems are reduced, so that the overall maintenance cost is reduced. The network load optimization method not only solves the problems of bandwidth occupation and time error in the prior art, but also improves the performance and reliability of the local area network, and has good application prospect.
Optionally, the port parameter includes an internal synchronization period, the comparing with the current network load data based on a preset threshold value to obtain a comparison result, and adjusting the port parameter of the master clock according to the comparison result, including:
When the current network load data is larger than the preset threshold value, the corresponding internal synchronization period is adjusted according to a first preset period;
when the current network load data is smaller than or equal to the preset threshold value, the corresponding internal synchronization period is adjusted according to a second preset period;
and the internal synchronous period is a synchronous message sending period corresponding to the port of the master clock.
Specifically, a preset threshold is set, and the current network load data is determined based on the preset threshold to determine whether the port of the master clock needs to be adjusted at this time, and it should be noted that the preset threshold may be a range value.
For example, optionally, the preset threshold includes a first preset threshold and a second preset threshold, and the first preset threshold is greater than the second preset threshold;
when the current network load data is larger than the first preset threshold value, the corresponding internal synchronization period is adjusted according to a first preset period;
And when the current network load data is smaller than or equal to the second preset threshold value, adjusting the corresponding internal synchronization period according to the second preset period.
I.e. a first preset threshold value, for determining how to adjust the internal synchronization period when the current network load is above this value. For example, when the load exceeds 80% (a first preset threshold), it may be desirable to reduce the synchronization frequency. A second preset threshold for how to adjust the internal synchronization period when the current network load is lower than or equal to this value. For example, when the load is less than or equal to 60% (second preset threshold), the synchronization frequency may be increased to ensure timely data update.
According to the previous method, the master clock periodically calculates current network load data, including average time offset and network delay. These data will be used for subsequent comparisons and decisions.
Comparing the current network load data with a threshold value, wherein if the current network load data is larger than a first preset threshold value, the network is in a high load state, and the congestion risk possibly exists. If the current network load data is less than or equal to the second preset threshold value, the network load is in a normal or low load state, and the synchronous frequency can be increased.
When the current network load is greater than a first preset threshold, the master clock adjusts the internal synchronization period according to the first preset period. For example, the sending frequency of the synchronous message is reduced (e.g. from once every second to once every two seconds), so as to reduce the network load. I.e. the Sync message transmission period SYNCINTERNAL of the port parameters of the master clock is adjusted, for example, the parameters can be reduced by 10%.
When the current network load is smaller than or equal to a second preset threshold value, the master clock can improve the synchronous frequency according to the second preset period, and timeliness and accuracy of time data are ensured. For example, the sending frequency of the synchronous message is increased (e.g., from once every two seconds to once every second). I.e. the Sync message transmission period SYNCINTERNAL for adjusting the port parameters of the master clock, the parameters can be increased by 10%, for example.
After the internal synchronization period is adjusted, the master clock continues to monitor the network load, time offset, and delay data to evaluate the adjustment effect. If the network load continues to be high, a readjustment may be required, otherwise, the adjusted synchronization frequency is maintained.
By reasonably adjusting the synchronization period, unnecessary synchronous message transmission is reduced, the network resource consumption can be reduced, and the overall network utilization efficiency is improved. And the synchronous frequency is increased when the network load is low, so that higher time accuracy among all clocks can be ensured, and the frequency is reduced under the condition of high load so as to reduce risks. And meanwhile, when high load is detected, the synchronization period is reduced, so that the number of data packets in a network is reduced, the network pressure is reduced, and the transmission efficiency is improved. Therefore, the dynamic adjustment of the synchronization period enables the system to quickly respond to the change of the network state and more flexibly adapt to different operating environments. Meanwhile, through effectively managing the sending frequency of the synchronous message, network bottlenecks caused by overhigh load are reduced, and therefore the overall reliability and stability of the system are improved.
By comparing the current network load data with the set threshold value and adjusting the internal synchronization period of the master clock, the network performance can be effectively managed and optimized. The adjustment process not only improves the time synchronization precision and the use efficiency of network resources, but also enhances the flexibility and stability of the system, and ensures that the system can always keep effective operation and data synchronization under different network environments.
It should be noted that the Sync message transmission period of the master clock is defined in its port.
Optionally, the method is characterized in that the time data comprises first time data, second time data, third time data and fourth time data, and when the master clock periodically sends a declaration message to each slave clock to exchange clock information, the method comprises the steps of:
sending a synchronous message to each slave clock through the master clock, and sending the time when the corresponding synchronous message leaves the master clock to the corresponding slave clock as the corresponding first time data;
when the slave clock receives the corresponding synchronous message, recording the arrival time of the synchronous message, and taking the arrival time of the synchronous message as the second time data;
sending a delay request message to the master clock through each slave clock, and taking the time when the corresponding delay request message leaves the slave clock as the corresponding third time data;
when the master clock receives the delay request messages, the arrival time of each delay request message is recorded, the arrival time of the delay request message is used as the fourth time data, and the delay reply message is sent to the corresponding slave clock.
Optionally, the obtaining the corresponding time deviation and the network delay according to each time data includes:
Obtaining the corresponding time deviation and the network delay through a formula I and a formula II according to the corresponding first time data, second time data, third time data and fourth time data;
Wherein, the formula one is:
;
The formula II is as follows:
;
Wherein, the For the first time data,For the second time data,For the third time data to be used,And for the fourth time data, offset is the time offset, delay is the network delay.
In some embodiments, as shown in fig. 2, in the local area network, the time synchronization process of the master clock and the slave clock:
Step one, a master clock periodically transmits an Annouce message to slave clocks and exchanges clock information with each other, the master clock periodically transmits a synchronization (Sync) message, and records the accurate transmission time (first time data) when the message leaves the master clock ). The master clock sends an Announce message to exchange information such as priority, clock quality, clock ID and the like between the master clock and the slave clock. Messages sent by the master clock can be divided into two types, event type messages and general type messages. The event type messages include Sync, delay_Req, and Delay_Resp, while the generic type messages include Follow_up and Announce. In the process of receiving and transmitting event type messages, each node needs to record the receiving and transmitting time.
Step two, the master clock accurately transmits timeEncapsulated into a Follow-up message (Follow up) and sent to the slave clock.
Recording the accurate arrival time (second time data) of Sync message when it arrives at its device from clock)。
Step four, transmitting a Delay request (delay_req) message from the clock, and recording the accurate transmission time (third time data) of the message)。
Step five, the master clock records the accurate arrival time (fourth time data) when the delay_req message arrives at the device thereof)。
Step six, the master clock records the time informationEncapsulated into a Delay response (Delay Resp) message and sent to the slave clock.
Step seven, after receiving delay_resp message from clock, the slave clock is collected,,,Four precise times.
Step eight, each slave clock is according to the corresponding,,,Calculating four accurate times through a formula I and a formula II to obtain corresponding time offset and network delay;
step nine, gradually adjusting the current local clock by time deviation and network delay obtained by each slave clock, accumulating for a plurality of times, and finally adjusting the synchronization of the local clock and the master clock.
Optionally, the delay request message structure includes a transmission time stamp, a corresponding previous time deviation of the slave clock, and the network delay.
Specifically, as shown in fig. 3, the delay_req message structure is schematically shown. Including latestOffset (latest time offset) to carry the offset value calculated from the last time of the clock and LATESTDELAY (latest network delay) to carry the delay value calculated from the last time of the clock. The latest time deviation and the latest network delay refer to the previous time deviation and network delay. The system also comprises a header, a PTP message header, a originTimestamp sending time stamp and the like.
Optionally, the obtaining the current network load data of the local area network according to all the time offsets and the network delays includes:
Acquiring an initialization weight of each node in the local area network;
and obtaining the current network load data based on the corresponding initialization weight according to all the time deviations and the network delay.
The step of obtaining the current network load data based on the corresponding initialization weights according to all the previous time deviations and the network delays, including:
obtaining the current network load data through a third method based on the corresponding initialization weight according to all the time deviations and the network delay;
Wherein, the formula III is:
;
Wherein, the For the current network load data to be used,An initialization weight for node i, n is the number of nodes,For the previous time offset between node i and the master node,A and b are respectively time deviation and preset duty ratio of network delay under load condition, and a+b=1, 0 is less than or equal to a and less than or equal to 1, and 0 is less than or equal to b and less than or equal to 1.
It should be noted that, for the setting of a and b, the size depends on the importance of the node in the lan, and may be set according to practical situations.
Optionally, the robot operating system network load optimization based on the time sensitive network further comprises:
And when the slave clock calculates the corresponding time deviation and the network delay, adjusting the current corresponding local clock according to the time deviation and the network delay so as to synchronize with the master clock.
Specifically, after the slave clock receives the synchronization message sent by the master clock, the slave clock calculates the current time deviation and network delay. Specifically, the time offset refers to the difference between the local time of the slave clock and the master clock time, and the network delay refers to the time required for the synchronous message to be transmitted in the network.
By taking time deviation and network delay into consideration, the slave clock can more accurately adjust the local time of the slave clock and realize higher-precision synchronization with the master clock. And accurate time synchronization helps to improve system stability, especially in time-sensitive application scenarios such as financial transactions, industrial automation, and real-time data processing. Meanwhile, by reducing retransmission and additional communication caused by time asynchronization, the network load can be effectively reduced, and the utilization rate of network resources can be improved. When network conditions change, the slave clock can dynamically adjust the local time, so that accurate time synchronization can be maintained under different network states.
In summary, by adjusting the local clock based on the time deviation and the network delay, the accuracy of time synchronization and the overall performance of the system can be significantly improved.
It should be noted that, in the process of sending the synchronous message of the master clock and the slave clock, there is an influence of network delay. In practice, network latency may vary depending on the direction of data transmission and the current network state. Therefore, each time clock synchronization is performed, network delay needs to be recalculated to ensure the accuracy of the synchronization. And the sending time of the delay_req message is random, and the time interval between the continuous delay_req messages is generally smaller than the sending period of the Sync message. Thus, each time a delay_req message is sent, the slave clock needs to be recalculated.
In some embodiments, as shown in fig. 4, the method for optimizing the network load of the robot operating system based on the time sensitive network under the framework of the robot operating system is schematically shown in the structure. Namely, the network load optimization method based on the Time Sensitive Network (TSN) aims to improve the efficiency and accuracy of real-time communication in a master-slave system architecture. In the practical process of the method, in the application scenario shown in fig. 4, both the master end and the slave end comprise a robot operating system, a communication protocol and TSN software. The master terminal exchanges data with the slave terminal through the TSN network equipment, and ensures the real-time transmission of control information.
First, the system needs to classify the data streams and set priorities for the different types of data streams. Critical data streams, such as control signals and sensor data, should be given higher priority to ensure their preferential transmission in the network. Through a flow scheduling mechanism of a TSN (traffic control network), and in a master-slave system, a Precision Time Protocol (PTP) is used for realizing synchronization of master-slave clocks, the network load optimization method of the robot operating system based on a time sensitive network comprises the following steps:
The master clock periodically sends an Announce message, informs the slave clock and exchanges clock information. The master clock then periodically transmits the Sync message and records the time of transmission, and transmits the time to the slave clock via a Follow_up message.
The slave clock records the arrival time of the Sync message, and transmits the delay_Req message, and simultaneously records the transmission time.
The master clock records the arrival time of the delay_req message and encapsulates the arrival time into a delay_resp message to be sent to the slave clock.
The slave clock calculates the time deviation and network delay between the master clock and the slave clock, and adjusts the local clock.
In the new period, the master clock collects the time deviation and network Delay information of the slave clock through a delay_req message, calculates the network load condition, and compares the network load condition with a set threshold value. If the deviation is larger, the time setting period is shortened, otherwise, the time setting period is enlarged.
According to the embodiment, the time setting flow of the master clock is dynamically adjusted to be started and closed, so that occupation of PTP time setting information on network communication bandwidth is reduced, network load is reduced, and reliability of a system is improved. And secondly, the method only uses blank fields reserved in the Announce message, thereby facilitating the system to identify the message and reducing the system load. Finally, the method judges whether the local area network needs to continue to time by the message in the existing protocol, and does not need to increase additional expenditure while utilizing the existing resources. Whether to continue sending the time setting message next time is dynamically adjusted according to the time setting deviation condition of the current network, so that the overhead of network communication resources is reduced and the stability of a robot operating system is improved while the time consistency and accuracy in the local area network are ensured.
As shown in fig. 5, a network load optimization system 500 of a robot operating system based on a time-sensitive network according to an embodiment of the present invention includes:
An obtaining unit 510, configured to obtain time data between the master clock and each slave clock before when the master clock periodically sends an declaration packet to each slave clock to exchange clock information, where the time data is time data during a time synchronization process between the master clock and each slave clock;
The processing unit 520 is configured to obtain a corresponding time deviation and a network delay according to each time data, obtain current network load data of the local area network according to all the time deviations and the network delays, compare the current network load data with a preset threshold value based on the current network load data, obtain a comparison result, and adjust a port parameter of the master clock according to the comparison result.
The time-sensitive network-based network load optimization system of the robot operating system of the present embodiment is used to implement the time-sensitive network-based network load optimization method of the robot operating system, which has the same advantages as those of the prior art and the time-sensitive network-based network load optimization method of the robot operating system, and is not described herein.
Although the invention is disclosed above, the scope of the invention is not limited thereto. Various changes and modifications may be made by one skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications will fall within the scope of the invention.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411849064.9A CN119675813B (en) | 2024-12-16 | 2024-12-16 | Network load optimization method for robot operating system based on time-sensitive network |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411849064.9A CN119675813B (en) | 2024-12-16 | 2024-12-16 | Network load optimization method for robot operating system based on time-sensitive network |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN119675813A CN119675813A (en) | 2025-03-21 |
| CN119675813B true CN119675813B (en) | 2025-07-08 |
Family
ID=94995488
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411849064.9A Active CN119675813B (en) | 2024-12-16 | 2024-12-16 | Network load optimization method for robot operating system based on time-sensitive network |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119675813B (en) |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118802046A (en) * | 2023-08-17 | 2024-10-18 | 中国移动通信集团设计院有限公司 | Time synchronization method, device, electronic device and storage medium |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103298040B (en) * | 2012-02-24 | 2016-02-03 | 华为技术有限公司 | The method of radio network optimization, Apparatus and system |
| US12278771B2 (en) * | 2020-07-01 | 2025-04-15 | Telefonaktiebolaget Lm Ericsson (Publ) | Latency control for a communication network |
| CN111935027B (en) * | 2020-09-03 | 2022-03-25 | 北京经纬恒润科技股份有限公司 | Method and system for optimizing load of whole vehicle network |
| CN113037415B (en) * | 2021-02-25 | 2024-05-28 | 上海赫千电子科技有限公司 | TSN network clock synchronization method, system and equipment based on vehicle-mounted Ethernet transmission |
-
2024
- 2024-12-16 CN CN202411849064.9A patent/CN119675813B/en active Active
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118802046A (en) * | 2023-08-17 | 2024-10-18 | 中国移动通信集团设计院有限公司 | Time synchronization method, device, electronic device and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN119675813A (en) | 2025-03-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112671495B (en) | Method and system for adjusting deterministic time delay | |
| US20240214323A1 (en) | Packet transmission method and apparatus | |
| CN111585683A (en) | High-reliability clock synchronization system and method for time-sensitive network | |
| US20230068462A1 (en) | Time sensitive communication support information updating method and device in mobile communication system | |
| CN114827195B (en) | Power 5G low-delay jitter implementation method for distribution network stable protection | |
| US10334539B2 (en) | Metered interface | |
| CN102843390B (en) | The Ethernet deterministic data transmission method of data-oriented role | |
| WO2015196685A1 (en) | Clock synchronization method and apparatus | |
| US20230051166A1 (en) | Delay Sensitive Network Estimation System | |
| US12057930B2 (en) | Synchronizing a distributed application via a communication network | |
| CN116318506B (en) | Clock synchronization method for wireless time-sensitive network in spacecraft | |
| CN116723550A (en) | A user-mode based RDMA network QoS coordination method | |
| CN114070448B (en) | A Master Clock Selection Method Based on Multiple Attribute Decision Making | |
| Mohammadi et al. | Latency-aware topology discovery in SDN-based time-sensitive networks | |
| WO2024016175A1 (en) | Deterministic stream transmission method and system, and electronic device | |
| CN119675813B (en) | Network load optimization method for robot operating system based on time-sensitive network | |
| CN112751641B (en) | A TSN network time synchronization method, device and storage medium | |
| CN119582996A (en) | A multi-port PTP timing device and timing method thereof | |
| US9553828B1 (en) | System and method for collision detection and avoidance for network communications | |
| Anand et al. | EDA performance and clock synchronization over a wireless network: Analysis, experimentation and application to semiconductor manufacturing | |
| CN116566529A (en) | Time adjustment method, network equipment and system | |
| Zhang et al. | Precise Timing Based on Software-Defined Time-Sensitive Networking in Smart City | |
| CN119676177B (en) | A flow scheduling configuration method in time-sensitive network of robot operating system | |
| CN120371548B (en) | Intelligent load balancing scheduling system and method based on redundant micro-service | |
| EP4576715A1 (en) | Method of scheduling resources in a time sensitive network based on a quality of service information |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |