# Switched Control of Motor Assistance and Functional Electrical Stimulation for Bieps Curls +
## Materials and Methods
### Switched Muscle Subsystem  
As in [19; 20; 21], \(w\in\mathbb{N}\) distinct electrode channels that are placed along the biceps brachii receive stimulation when the forearm angle is at predefined ranges of \(Q\), where \(w\) is a predetermined constant and each combination of channels comprises a subsystem. Let \(i\in S\) denote the \(i^{\text{th}}\) electrode channel and denote a finite indexed set of all channels. To predetermine regions of \(Q\), an initial protocol is performed as in [22], where the normalized isometric torque produced by the \(i^{\text{th}}\) channel, \(\tau_{i}\in\mathbb{R}\), is measured a priori every 10 degrees throughout a range of angles defining a biceps curl. The portion of the dynamic biceps curl trajectory over which a particular electrode channel is stimulated is denoted by \(Q_{i}\subset Q\), and defined as  
\[Q_{i}\triangleq\left\{q\in Q\,|\,\max\left(\tau_{i}\left(q\right),\,\tau_{i} \left(q+10\right),\,\tau_{i}\left(q-10\right)\right)>\varepsilon\right\}, \tag{2}\]  
where \(\underset{i\in S}{\cup}Q_{i}=Q\) and the threshold, \(\varepsilon\in\left[0,1\right],\) is a design constant. The torque due to muscle contractions in (1) is generated by applying an electric potential field across the biceps brachii muscle and is defined as  
\[\tau_{m}\left(q,\dot{q},t\right) \triangleq \sum_{i\in S}B_{i}\left(q,\,\dot{q}\right)u_{i}\left(q,\dot{q},t \right),\,i\in S, \tag{3}\]  
where \(B_{i}:Q\,\times\mathbb{R}\rightarrow\mathbb{R}_{>0}\) denotes an unknown, nonlinear, auxiliary function relating the stimulation intensity applied to the \(i^{\text{th}}\) stimulation channel to the torque produced by the activated sensory-motor structures; \(u_{i}:Q\times\mathbb{R}\times\mathbb{R}_{\geq 0}\rightarrow\mathbb{R}\) denotes the control input and the electrical stimulation intensity applied to the \(i^{\text{th}}\) electrode, defined as  
\[u_{i}\left(q,\,\dot{q},\,t\right)\triangleq\sigma_{i}\left(q\right)T_{i}\left( q\right)u_{m}\left(q,\dot{q},t\right),\,i\in S, \tag{4}\]  
where \(\sigma_{i}\left(q\right)\in\left\{0,\,1\right\}\) is a piecewise switching signal for each channel such that  
\[\sigma_{i}\triangleq\left\{ \begin{array}{ll}1,&\text{if}\,\,\left(q\in Q_{ i}\right)\,\wedge\,\left(\dot{q}_{d}>0\right)\\ 0&\text{otherwise}\end{array} \right.,\,i\in S,\]  
where \(q_{d}\,:\,\mathbb{R}_{\geq 0}\rightarrow\mathbb{R}\) is the desired elbow angle trajectory, designed so its first and second derivatives exist and are bounded. Since FES is used on the biceps brachii, the switching signals \(\sigma_{i}\) ensure that FES is only applied during regions of desired elbow flexion (i.e., positive rotation). Note that \(\sigma_{i}\) is based on desired velocity, rather than the actual velocity because it cannot be guaranteed that the actual velocity is positive throughout flexion and negative throughout extension (i.e., during flexion, we cannot guarantee that the forearm will not momentarily \"fall back\" in the negative direction due to gravity). A known function of the elbow angle, \(T_{i}\,:\,Q\rightarrow\mathbb{R}_{>0}\), is calculated a priori as in [19] and is based on the \(i^{\text{th}}\) channel's effectiveness in producing torque at the given angle. The control input to the FES on the biceps brachii, denoted by \(u_{m}\,:\,Q\times\mathbb{R}\times\mathbb{R}_{\geq 0}\rightarrow\mathbb{R}\), is distributed amongst all electrodes along the biceps brachii according to \(\sigma_{i}\) and \(T_{i}\,:\,Q\rightarrow\mathbb{R}\). The torque produced by the motor is defined as  
\[\tau_{e}(q,\dot{q},t)\triangleq B_{e}u_{e}(q,\dot{q},t), \tag{5}\]  
where the current input applied to the motor is denoted as \(u_{e}\,:\,Q\times\mathbb{R}\times\mathbb{R}_{\geq 0}\rightarrow\mathbb{R}\) and \(B_{e}\in\mathbb{R}_{>0}\) is the known electric motor control constant relating input current to output torque.