# A Synthetic Nervous System Controls
## 2 Methods
### Neural Network as Control System  
#### 2.4.1 Overview of Synthetic Nervous System  
The SNS used to control SimRoach2 is a distributed network made up of functional subnetworks [26; 40] (Figure 3). In short, the network functions as follows. A high-level network (gray, Figure 3) sends commands to the thoracic ganglia to stand or walk, and in which direction to walk. Each leg joint control network in each ganglion interprets this signal to decode the direction and amplitude of joint rotation in stance phase (brown, Figure 3). Each joint in the leg has a central pattern generator (CPG) that generates alternating neural activity (red, Figure 3). These have no direct neural connections between them [2]. The descending commands and CPG together establish a commanded position for each joint. Each low level joint controller (green, Figure 3) receives the commanded position signal, moves the joint to that position, and signals its position back to the intermediate (i.e., inter-joint and intra-leg) network. This intermediate network controls the transitions between stance and swing phase, by causing CTr (joints act between the coxa and the trochanter) levation when the other leg joints have reached their posterior extreme position (PEP), and causing CTr depression when the other leg joints have reached their anterior extreme position (AEP).  
Additional networks are included to coordinate the walking of multiple legs. Inter-leg reflexes (purple, Figure 3) coordinate the legs for stable walking. Height control networks (blue, Figure 3) are included to control the height of the thorax by adjusting CTr depression while in stance phase. When the leg is in stance and loaded, the tarsus is \"stuck\" to the ground (yellow, Figure 3).  
Each leg in SimRoach2 is controlled by a network like that in Figure 3. The neural implementation of joint position control and inter-leg reflexes are provided in this article. The neural implementation used for the upper level, height control, and for freezing the tarsus in stance phase are provided in the Supplementary Materials (Section: Methods Explained). The neural implementation used in the intermediate level is published in [26], and the CPG network is published in [31]. One can download the AnimatLab 2 file to see the specifics on how the sub-networks are connected to each  
\begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{3}{c}{**Actuated Joints**} \\ \hline Front Leg & Middle Leg & Hind Leg \\ ThC2 & ThC2 & ThC2 \\ ThC1 & ThC1 & ThC1 \\ ThC3 & CTr & CTr \\ CTr & TrF & TrF \\ FTi & FTi & FTi \\ \hline \hline \end{tabular}
\end{table}
Table 1: Actuated joints in each leg starting from the joint closest to the body and moving distally outward. Thorax-coxa (ThC) joints act between the thorax and the coxa. Coxa-trochanter (CTr) joints act between the coxa and the trochanter. Trochanter-feumr (TrF) joints act between the trochanter and the femur. Femur-tibia (FTi) joints act between the femur and the tibia.  
Figure 2: Physical model of the cockroach _Blaberus discoidalis_. (**a**) Picture of SimRoach2 in AnimatLab2; (**b**) each joint consists of a flexor muscle, extensor muscle and a passive spring and damper attached at the same points as the flexor muscle; (**c**) each tarsus (foot) is attached to the tibia with a free ball and socket joint that “sticks” when in contact with the ground.  
other (Supplementary Materials File S2). Specific parameters values of the neurons and synapses are available in the Supplementary Materials (Section: Parameter Values) and in the AnimatLab 2 source file.