The Fuzzy Feedback Scheduling of Real-Time Middleware in Cyber-Physical Systems for Robot Control

Cyber-physical systems for robot control integrate the computing units and physical devices, which are real-time systems with periodic events. This work focuses on CPS task scheduling in order to solve the problem of slow response and packet loss caused by the interaction between each service. The two-level fuzzy feedback scheduling scheme is designed to adjust the task priority and period according to the combined effects of the response time and packet loss. Empirical results verify the rationality of the cyber-physical system architecture for robot control and illustrate the feasibility of the fuzzy feedback scheduling method.


Introduction
Cyber-physical systems (CPSs) are integrations of the physical world, computation, communication, and control designs [1].Many cyber-physical systems are equipped with distributed computing units that communicate with each other through the network [2].As [3,4] propose, application architecture, control technique, and resource allocation are important research topics in CPSs.One representative CPSs application architecture is stated in [5].Another application of CPSs for neutrally controlled artificial legs is put forward in [6].Reference [7] outlines the architecture of passive control CPSs.All these systems embody the features of CPS like distributed computing.
Distributed robot control systems consist of many computing nodes, actuators, sensing devices, and network topologies [8][9][10].These are typical applications of distributed CPSs that must handle many aperiodic and periodic events.The computing nodes or devices have different interfaces.Applying middleware can realize network interconnection, data integration, and integrated application, which accounts for the increasing significance of middleware technologies with respect to distributed robot control CPSs.Real-time CORBA [11] is a vital real-time middleware frequently used in distributed systems.A reconfigurable real-time middleware is proposed in [12], which provides a flexible software platform for CPSs with timing constraints.
The scheduling models of traditional real-time CORBA are completely independent of each node [13].That is to say, the scheduling in each node is independent.The scheduling method does not take nodal performance into account; therefore, it fails to guarantee global optimum.For that, the fuzzy feedback scheduling, a global scheduling framework based on end-to-end real-time CORBA scheduling model, is proposed in this paper.According to the nodal performance index, this method adjusts the task priority and period to improve the overall performance of CPSs for robot control and enhance the performance of the end-to-end real-time system.

Systems Architecture of CPSs for Robot Control Based on Real-Time Middleware
As the core mechanism of CORBA, ORB (Object Request Broker) realizes transparent interaction between objects residing at various computing nodes in heterogeneous environments.Using naming service of CORBA, the clients and the CRRBA objects are connected according to the objects' names.This method facilitates programming and establishes seamless connection between objective systems.Figure 1 shows the architecture of CPSs for robot control, which mainly consists of actuators, sensors, server nodes, and global scheduling server.These components communicate with each other via ORB.The tasks that travel along the servers compete for network resources of ORB soft bus.Once the requests are received, global scheduling server schedules the tasks to control multiple actuators, which can be regarded as a task management.Be they aperiodic or periodic events, the control tasks are assigned to server nodes by global scheduling server, resulting in competition for computing resources of global scheduling server.Moreover, implemented in different server nodes, the tasks in one server node compete for computing resources within their own server node while the monitor in charge of this server node monitors performance of this node.Then feedback information is sent to global scheduling server.The global scheduling server decides on the task priority and period according to the feedback information and assigns the tasks to server nodes in the light of priority.Server nodes map task priority to local operating system.This work focuses on resource scheduling and two-level scheduling method is illustrated later in the article.

Fuzzy Feedback Scheduling Method
The CPSs for robot control are an evolution of the realtime networked control systems [14,15].The tasks scheduling of CPSs can be based on the involved research results.Scheduling strategy can be divided into static scheduling and dynamic scheduling according to the implementation method.Liu and Layland proposed RM (Rate Monotonic) scheduling algorithm and EDF (Earliest Deadline First) real-time scheduling algorithm [16].They are the most representative of the research results in scheduling algorithm.At present, they have become the research foundation of scheduling algorithm.RM algorithm is a static priority assignment algorithm which assigns priorities to tasks according to their request rates; the more frequent the task is, the higher in priority the task is.Reference [16] proves that the RM algorithm is the best one in the static scheduling algorithm.EDF scheduling algorithm is a dynamic priority scheduling algorithm.it assigns priorities to tasks according to their absolute deadline.A task will be assigned the highest priority if the deadline of its current request is the nearest and will be assigned the lowest priority if the deadline of its current request is the furthest.In the EDF scheduling algorithm, tasks with the highest priority level are always to be executed first, while the lower-priority tasks are to be preempted.
Because the robot control system environment is complex, RM scheduling algorithm has poor environment suitability [16].Reference [17] makes it clear that dynamic scheduling algorithm outperforms static scheduling algorithm in changeable environments.Therefore, this work centers on EDF real-time scheduling algorithm.Reference [18] presents an improved dynamic EDF scheduling method for the network control systems, where task priority is changed according to the control error.References [19][20][21] demonstrate similar scheduling methods to set the task priority and reduce packet loss.
Studies have shown that feedback scheduling can better utilize resources and improve control performance in the distributed systems [22].So both EDF dynamic scheduling and feedback schedule are taken into consideration.Reference [23] illustrates a fuzzy feedback scheduler that makes better use of resources according to the system performance while [24] shows an online feedback scheduling algorithm for the sake of error reduction by optimizing the object function for a robot manipulator.
3.1.The Fuzzy Feedback Scheduling Framework.Figure 2 presents the fuzzy feedback scheduling framework.Twolevel fuzzy feedback scheduling method is designed in this paper where the object function of the method includes the response time and transmission error.
The effect of the first level scheduling is setting priority.An EDF dynamic scheduling algorithm is designed at this level.First of all, requirements of resource utilization   for each close-loop by fuzzy feedback controller are estimated.Then, the priority configurator computes the task priority in consideration of deadline, importance, and requirements of resource utilization.Lastly, tasks are transferred in the light of priority order and mapped to the operating system.
Figure 2: The fuzzy feedback scheduling framework.
The effect of the second level scheduling is adjusting period.Firstly, the total resource utilization  is computed by fuzzy feedback controller, and then period manager module adjusts the task period according to the total resource utilization.This method can address network congestion and achieve better resource utilization.
The feedback performance criteria function of the th control loop is shown as follows:   () =   () +   (),   () = (  ()−  ())/  ().  () representing all packets of the th control loop at the th cycle is computed by the monitor of the global scheduling server.  () referring to the packets that have been transmitted successfully is calculated by the monitor of the server nodes and sent to the global scheduling server.  () represents the response time ratio and follows the equation   () =   ()/ max .  () is the execution time of the th task.Global scheduling server computes the execution time via the starting time and terminal time that are reported from the actuators. max is the maximum execution time, while  and  are the weight of the packet loss ratio and response time ratio following the equation of  +  = 1.
The deviation of performance indicator of the th control loop is described as follows:   () =   −  () = (  −  ()) +(  −   ()).  represents the desired performance criteria and follows the equation   =   +   .The differential of performance criteria follows the formula   () =   () −  ( − 1), which echoes the direction of change for performance criteria.
In this paper, the fuzzy feedback scheduling framework adjusts the task priority and period according to the feedback performance.The greater the priority is, the sooner the task should be handled.The worse the performance of the control loops is, the more resources they receive.When the total resource utilization  is great, it implies network congestion and the period should be shortened, and vice versa.

Fuzzy Feedback Control.
The deviation of performance indicators   (),   () and the differential of performance criteria   (),   () are the inputs into the fuzzy feedback controller.Total resource utilization  and the th resource utilization   are accessible through fuzzy feedback control.The relations between inputs and outputs are illustrated in the following equations:  = (  (),   ()),   = (  (),   ()).
There are four steps in fuzzy feedback control: (1) fuzzification; (2) establishing fuzzy control rules; (3) fuzzy composition; and (4) fuzzy judgment.The th resource utilization   is taken as an example to illustrate these processes.1 and 2. The fuzzy set of the output variable   is expressed as {PS, PM, PB}, which, respectively, denotes small, medium, and big values.The fuzzy set is quantified as {0.2, 0.4, 0.6}, whose subordinate degree values are shown in Table 3.

Establishing Fuzzy Control
Rules.The basic idea of fuzzy control rules is shown in Table 4.When the performance criteria and its differential value both are positives or negatives and their absolute values are relatively big, the system's performance is diverging from the calibrated value with a tendency of continuous deviation.Under such circumstance, the system performs poorly.So a bigger value should be assigned to the requirement of resource utilization   .

Fuzzy Judgment.
There are mainly two judgment methods: weighted average method and max membership function.The weighted average method is expressed as follows: In this paper, weighted average method is adopted to determine the requirements of resource utilization   , while the max membership function is used to study the total resource utilization .For example, if   = [0 0.5 1], then   is calculated by the weighted average method as follows: If  = [0 0.5 1], then  is figured out by the max membership function as follows: Since (0.2) = 1 is the largest of all subordinates,  = 0.2 is selected.

Priority Assignment Algorithm.
Once the requests are received, the global scheduling server will schedule the tasks.Priority is given to each task according to the following scheduling algorithm: the task message (including the priority attributes such as the task's arrival time and deadline) is arranged to the ready task queue according to the priority and then it is distributed to trigger execution of each task in server node.The priority attributes of each task and its subtasks should be consistent within task cycle ℎ  .
The traditional EDF algorithm cannot promptly adjust the task priority in an uncertain operation environment.In the meanwhile, the feedback scheduling fails to dispatch in time as a result of an introduced feedback mechanism (scheduling period should not be too short so as to avoid frequent switching task priority)."The fuzzy feedback improved EDF scheduling policy" proposed in this work is aimed at assigning the priority of each task and sorting the task messages in the ready task queue in progressive priority order.The basic idea is described as follows (Figure 3): (1) When a task message arrives, its schedulability is analyzed at first to judge whether it applies to the deadline or not.
(2) When the scheduling sampling period comes, the fuzzy scheduling method as Section 3.2 shows is adopted to calculate the requirement of resource utilization   according to the feedback information (  (),   ()).Then   is used to compute the priority as the next step proposes.
Resource utilization   is introduced as one of the metrics to determine the priority of task   together with the task's importance im  and residual deadline de  .The task priority is expressed in the following equation: If there comes a periodic task, the initial value of the resource utilization   is set at 0.3.As for an aperiodic task,   is set at 0.6.The adjustment coefficient  needs to be determined by an experimental method.It is possible that multiple tasks share the same priority.In this case, the tasks can be sorted according to the feedback performance or deadline.All in all, the shorter the deadline lasts, the greater resource utilization and task importance it embodies, and therefore the greater the priority is, and vice versa.This method excels itself in the full consideration of multifaceted attributes of the task and the presence of multiple parameters in the priorities.This method bridges the gap of traditional EDF algorithm which only takes deadline into account.

Period Adjustment Strategy.
Too frequent periodic adjustment makes the system complicated and unstable.Therefore, three kinds of period ( = 4, 8, 16) are developed.To judge the total resource utilization , the max membership function is employed to produce the fuzzy feedback controller outputs of  = 0.2, 0.4, 0.6.The period manager module computes the period P according to the mapping relations between resource utilization and task period which is presented in Table 5 and then writes the period to the task messages and transfers the message to related services.Finally, the services adjust the period according to the received message.      of TrueTime Kernel contributes to this integrated model.The global scheduling server separately controls the three actuators; each close-loop control system represents a task as   .Sensors send the outputs of actuators to the global scheduling server which then computes the priority and adjusts the period according to the feedback information.

Algorithm Simulation
A comparison study of using and not using fuzzy feedback scheduling is conducted.Suppose the interpolation period of three control loops is 4 ms.The three tasks cannot be scheduled without using fuzzy feedback scheduling.The task execution is shown in Figure 6(a) and the output curve of three actuators and controller in Figure 6(b).By using fuzzy feedback scheduling, the interpolation period of three control loops is adjusted to 8 ms.The three tasks can be scheduled.The task execution is presented in Figure 7(a) and the output curve of three actuators and controller in Figure 7(b).Obviously, the fuzzy feedback scheduling method improves task schedulability and reduces the error of robot control system.

Experimental Results
There is one global scheduling server and two server nodes.They control two 6-DOF mechanical arms under such operating environment: YANXIANG EC3-1711CLDNA IPC; CPU: Genuine Intel(R) processor 600 Mhz; Memory: 599 Mhz, 480 MB; Hard Disk: 60 G; Operating System: Windows XP, Ardence RTX 8.1.The experimental operation object (Figure 8) is six-degree-of-freedom robot arm of Googol Tech (GRB3016).

Real-Time Test and Analysis.
After testing a dozen sets of data, the response time of the control tasks is recorded in Figure 9.As Figure 9 shows, the average response time of control task is 8.323 ms with the presence of fuzzy feedback scheduling method and 10.2387 ms with the absence of the scheduling method.The average response time is much shorter when the scheduler is in place.It implies that the scheduling module can, to some extent, mitigate delay Using the fuzzy feedback scheduling method Without using the fuzzy feedback scheduling method Using the fuzzy feedback scheduling method Without using the fuzzy feedback scheduling method between tasks caused by transmission congestion and ensures the real-time performance of the system.

Packet Loss Ratio
Test.The deadline of the tasks is set at 20 ms and a test program for interference is available.Figure 10 shows a total packet loss ratio of 3.69% without using the scheduling method and 0.76% with the use of the scheduling method.The latter is significantly lower than the former.The experiment proves that the scheduling method not only ensures lower packet loss ratio but also effectively improves the utilization.trajectory of circular interpolation is described in Figure 11.From the error graph (Figure 12), it is learned that the maximum error is 1.86 mm with the use of the fuzzy feedback scheduler.The manipulator can accord to the predetermined path in a smaller error range.On the contrary, not using the fuzzy feedback scheduler results in the maximum error of 5.879 mm.Evidently, the fuzzy feedback scheduling method can reduce the error of robot control system and improve the system's performance.

Conclusion
The fuzzy feedback scheduling method in this paper can be applied to the cyber-physical systems for robot control.
The proposed two-level scheduling framework dynamically adjusts the priority and period.Priority is adjusted according to the task's deadline, its importance, and performance feedback, while the period is adjusted according to the total resource utilization.The method controls the traffic of the tasks to ensure schedulability, reduce packet loss and delay, and realize sounder performance compared with the system with a fixed period.The experimental results indicate that the method can effectively handle slow response and high packet loss caused by the introduction of bus into the network.

Figure 1 :
Figure 1: Systems architecture of CPSs for robot control.

4. 1 .
Priority Assignment Examples.A scheduling example is shown in Figure5; the arrangement of tasks on ready task queue before scheduling stands at the upper part of Figure4.To be specific the tasks ID are 16202, 30186, 7363, 8679, 12856, and 9832.The lower part of this figure is the arrangement of tasks after scheduling.It shows that task 1 and task 3 embrace

Figure 5 :
Figure 5: Simulation model for the scheduling system.
The output curve of the actuators and controller

Figure 6 :
Figure 6: Simulation results without using fuzzy feedback scheduling.

Figure 7 :
Figure 7: Simulation results using fuzzy feedback scheduling.

Figure 9 :
Figure 9: The response time of the control task.

Figure 10 :
Figure 10: Packet loss rate test without using the scheduling module.

Figure 11 (
a) depicits the experimental results without using fuzzy feedback scheduling method and Figure with use of of scheduling method.The dashed line refers to the theoretical value while the full line represents the actual operating point.

Table 3 :
Subordinate degree value for   .

Table 4 :
Fuzzy control rules.system's performance is close to the calibrated value, which means the system performs well.In this case, a smaller value should be assigned to   .When the performance criteria and its differential are valued one positive and another negative, the system's performance is approaching to the calibrated value with a tendency of improvement.A medium value should be assigned to   .Fuzzy control rules can be expressed in fuzzy conditional statements, for example, [25] () = NB or NM or NS,   () = NB or NM or NS then   = PS.(1)3.2.3.Fuzzy Composition.Compositional rule of fuzzy inference expresses a fuzzy relation by means of the Cartesian product.For instance, "if  and  then " is expressed as  = ( ∩ ) → .According to the rule of Mamdani inference, the following expressions are concluded, where   refers to the transpose of [25]:

Table 5 :
Mapping relations between resource utilization and tasks period.