# A Synthetic Nervous System Controls
## 2 Methods
### Neural Network as Control System
#### 2.4.2 Joint Position Control  
The force and length of muscles are not easy to control, and the details of how animals control them are not known, although it is known that negative feedback reflexes play a role [41]. The primary challenge is that the muscles and exoskeleton possess many elastic elements that cancel out one another's tension. To overcome this, we designed a neural proportional-integral (PI) network to control a limb's position (Figure 4). We believe this is justified because arthropods have disproportionately slow muscle dynamics for their size [42], which means that their muscle membranes integrate individual spikes from excitatory motor neurons, functionally behaving as integrators [43]. The perceived position (PP) neuron receives an input current proportional to the joint's rotation (e.g., \(I_{app}=A\times\theta+B\)). The commanded position (CP) neuron uses the same relationship to specify the intended rotation of the joint. The CP and PP neuron voltages are subtracted from each other to create two \"error\" neurons [40] (green in Figure 4). One corresponds to the CP being greater than the PP (positive error); the other corresponds to the PP being greater than the CP (negative error). Only one of these neurons will be active at a time. Each error neuron excites the appropriate muscle's motor neuron via a synapse tuned using optimization explained in Section 2.5.6. Exciting the motor neuron increases the tension in the muscle, correcting the error in the limb's position and functioning as proportional negative feedback. Proportional feedback alone is not enough to guarantee that the joint will reach the CP, except in very specific cases [44]. Thus, we add an integral subnetwork (described in [31]) to eliminate the steady-state error of proportional feedback alone (orange, Figure 4). The purpose of the \"Zero\" neuron is to subtract out the steady state activation of the integrator. Just as with the proportional feedback, there are two integral feedback pathways (integral positive and integral negative), only one of which will be active at a time. Figure 3: Functional diagram of the synthetic nervous system used for one leg. Each leg consists of five joints. Descending commands from the higher level brain and load signals (gray) affect the intermediate network (brown). Central pattern generators (CPGs, red) generate the rhythmic movement and are present in each joint. The intermediate network and the CPGs establish a commanded position for each joint. Joint controllers (green) take the commanded position and move the joint to that position. Signals from other legs coordinate walking via inter-leg reflexes (purple). Height control networks (blue) are present in each leg. When the leg is loaded and in stance phase, the foot is frozen to the ground (yellow). Note that this is a simple functional diagram; each functional unit consists of dynamics neurons connected to each other via synapses. The importance of the integral part of the joint controller is shown in Figure 5. With only the proportional part, the joint does not move to its commanded position; there is always a steady state error. By adding the integral part, the steady state error is removed and the joint moves to its commanded position. Figure 4: Diagram of the joint control network. Joint angles are linearly mapped to neuron voltage. The commanded position (CP) neuron input signal comes from the intermediate network. The perceived position (PP) neuron input signal is mapped from the length of the extensor. The CP and PP neuron voltage’s are subtracted from each other to create two “error” neurons (green). Only one of these neurons can be active at a time. The error neurons excite the appropriate muscle motor-neuron, acting in a very similar way to the proportional part of a standard PID controller. The error neurons are also used as an input to the integral part (orange). The integral part continues to adjust the appropriate motor-neuron (MN) until the voltage of the CP and PP neurons match.