## 3 The Robots and the Communication
### The Robot's Controller  
Continuous-Time Recurrent Neural Networks (CTRNN), see [6], are used as robot's controllers in order to map sensed stimuli to actions. The neurons of the CTRNN are modelled as firing rate neuron models (see Chapter 11 in [41]), as a simplification of spiking neuron models assuming rate coding schemes. Firing rate model can be described as in Equations (3) and (4). \[\tau\frac{dv(t)}{dt}=-v(t)+\mathrm{I}(t) \tag{3}\]  
\[u(t)=\sigma(g(v(t)+\beta)) \tag{4}\]  
Inspired from biological neuronal dynamics, \(v(t)\) represents the time varying membrane potential of the neuron and \(\mathrm{I}(t)\) is the instantaneous somatic current injected in the neuron as the contribution from all presynaptic neurons. Say, that the \(n\)-th neuron is connected to \(N_{pre}\) presynaptic neurons and \(N_{in}\) input nodes. Then, the somatic current injected to the \(n\)-th neuron is defined in Equation (5). \[\mathrm{I}_{n}(t)=\sum_{j=1}^{N_{pre}}w_{nj}u_{j}(t)+\sum_{i=1}^{N_{in}}w_{ ni}^{\phi}\phi_{i}(t) \tag{5}\]  
where \(w_{nj}\) is the strength of the synapse with \(j\)-th presynaptic neuron and \(n\)-th postsynaptic neuron and \(w_{ni}^{\phi}\) is the strength of the synapse connecting input \(i\) to the \(n\)-th neuron model. Moreover, \(\phi_{i}(t)\) is the corresponding input stimulus signal. Additionally, \(\tau\) is the membrane decaying time constant governing how rapidly \(v(t)\) reaches stable fixed points in response to \(\mathrm{I}(t)\). The second equation exposes the transformation of the membrane voltage into the variable \(u(t)\) representing the neuron firing rate or activity. \(\sigma\) is the sigmoid function (see Equation (6)) that maps membrane voltages into neuron activities. \[\sigma(z)=\frac{1}{1+e^{-z}} \tag{6}\]  
Besides, \(\beta\) and \(g\) are constants that define neuron dynamical properties. In the case of \(\beta\), it establishes the maximum voltage threshold that must be surpassed in order to produce non-zero firing rate \(u(t)\). The constant \(g\) states how fast a neuron can switch from resting activity (null or scarce activity) to maximum firing rate. Note that large values will increase the slope of the sigmoid function within the linear region, producing a fast transition between minimum and maximum activities. The precise CTRNN architecture used in this manuscript is presented in Figure 1. It is composed by a set of input nodes representing the stimuli vector, two hidden layers of 10 neurons each and a series of motor neuron ensembles, whose activities are decoded into actions. In swarm robotics, it is a common practice to design CTRNN controllers with 1 or, at most, 2 hidden layers (see e.g., [7; 8; 9; 10]). This configuration is a good tradeoff between processing capabilities and simplicity of the robot's controllers. It should be noticed that the latter property is critical in swarm robotics systems. Besides, adding more hidden layers would drastically increase the dimension of the search space and, consequently, it would highly complexify the optimization problem. Moreover, as demonstrated in [42], an artificial neural network with a single hidden layer and with sigmoid activations can approximate any continuous function in \([0,1]^{n}\), provided that the weights are correctly adjusted. The input stimuli vector is composed by the readings of the communication receiver, namely, the message \(\mathbf{m}_{RX}\in\mathcal{C}\), the communication state (\(MODE\in\{0,1\}\), 0 representing the relay mode and 1 denoting send mode) and the encoded reception orientation \(\theta_{RX}\). The actions decoded from motor neurons' activities are \(a_{LED}\in\{0,1\}\), for turning on or off the robot's LED, the new communication state (\(MODE\in\{0,1\}\), with the same meaning as the input) and the elaborated message (\(\mathbf{m}_{TX}\in[0,1]^{2}\)). As it can be observed, the actions corresponding to \(a_{LED}\) and \(MODE\) are decoded using the Heaviside function \(\mathcal{H}\) with discontinuity at 0.5, while the message decoding is the identity function (no decoding).