## 3 Control Architecture
### Task Priority Framework and Definitions  
The KCL implements the task priority framework that is presented in [37]. In this task priority framework approach, objectives define a specific condition that needs to be satisfied. Consider a position dependent scalar variable \(x(\mathbf{\eta})\), then an equality control objective should satisfy \(x(\mathbf{\eta})=x_{0}\) as \(t\to\infty\) and, an inequality control objective should satisfy \(x(\mathbf{\eta})\leq x_{max}\) or \(x(\mathbf{\eta})\geq x_{min}\) as \(t\to\infty\). To satisfy this control objective, the time derivative of the variable \(x(\mathbf{\eta})\) should allow it to converge to the desired region or value. For ensuring a closed-loop convergence, a desired feedback reference rate \(\hat{x}\) is defined as [42]  
\[\hat{x}(x)\triangleq\kappa(x^{*}-x),\kappa>0, \tag{8}\]  
where \(x^{*}\) denotes an arbitrary point that satisfies the objective. \(\kappa\) is a positive gain proportional to the desired rate of convergence of the variable in consideration. The Jacobian relationship linking the variables \(x\) to the system velocity vector \(\hat{\mathbf{v}}\) is  
\[\hat{x}=\mathbf{g}^{\top}\dot{\mathbf{v}}, \tag{9}\]  
where the vector \(\mathbf{g}\in\mathbb{R}^{n}\) denotes the Jacobian for the task. A task will track the desired feedback reference rate \(\hat{x}\), to drive the associated variable \(x(\mathbf{\eta})\) towards its corresponding objective. Thus, the task will ensure that the derivative \(\hat{x}\) is as close as possible to the reference rate \(\hat{x}\). Another key element of the task priority framework are the activation functions \(a^{i}(x)\). These are continuous sigmoid functions of the scalar variable \(x(\mathbf{\eta})\) and are in the range \([0,1]\). The function assumes \(0\) in the valid region of the objective. The value of the activation function is non-zero until the associated objective is achieved. The function is used to activate or deactivate the control tasks. It avoids over-constraining the system and also  
Figure 2: Control architecture depicting the Planning Layer, the Control Layer, and the Simulated System. allows a smooth transition between the activation and deactivation phases to prevent chattering around the transition values. The activation function is given as  
\[a^{i}(x)\triangleq\left\{ \begin{array}{ll}1,&x(\mathbf{\eta})<x_{\min}\\ s(x),&x_{\min}\leq x(\mathbf{\eta})\leq x_{\min}+\Delta\\ 0,&x(\mathbf{\eta})>x_{\min}+\Delta\end{array} \right., \tag{10}\]  
where \(\Delta\) is the size of the transition zone, allowing for a smooth activation/deactivation of the task itself, and \(s(x)\) is a sigmoid function joining the two extrema with continuity. After the tasks are defined, an action can be simply put as a prioritized order of active control tasks in a certain hierarchy (priority level) that needs to be managed concurrently by the system. In the task priority based approach, the lower priority tasks do not interfere with the higher priority tasks. However, whenever a task is deactivated, it will not use any degree of freedom, eliminating the problem of over-constraining the system. By defining various actions, a lower priority task can be easily made a higher priority one. This allows us to define multiple actions having same objectives but with different priorities. We use a finite state machine to encapsulate each set of actions and their functions. Transition between various actions also means a transition between the states that represent them.