ARM-Cortex M 3-Based Two-Wheel Robot for Assessing Grid Cell Model of Medial Entorhinal Cortex : Progress towards Building Robots with Biologically Inspired Navigation-Cognitive Maps

This article presents the implementation and use of a two-wheel autonomous robot and its effectiveness as a tool for studying the recently discovered use of grid cells as part of mammalian’s brains space-mapping circuitry (specifically the medial entorhinal cortex). A proposed discrete-time algorithm that emulates the medial entorhinal cortex is programed into the robot. The robot freely explores a limited laboratory area in the manner of a rat or mouse and reports information to a PC, thus enabling research without the use of live individuals. Position coordinate neural maps are achieved as mathematically predicted although for a reduced number of implemented neurons (i.e., 200 neurons). However, this type of computational embedded system (robot’s microcontroller) is found to be insufficient for simulating huge numbers of neurons in real time (as in the medial entorhinal cortex). It is considered that the results of this work provide an insight into achieving an enhanced embedded systems design for emulating and understanding mathematical neural network models to be used as biologically inspired navigation system for robots.


Introduction
This article describes the design and use of an ARM-Cortex M3-based board two-wheel robot in which the neurons within the space-mapping system are named grid cells (GCs hereafter).The GCs were discovered in 2005 by M.-B.Moser and E. I. Moser, who received the Nobel Prize for Medicine in 2014 [1].The GCs have periodic triangular arrays and are hypothesized to function as the mammalian (e.g., rats and mice, possibly also humans) positioning-metric navigation system [2][3][4].They are place-modulated neurons positioned on the medial entorhinal cortex (MEC hereafter).Multiple firing locations are found on these triangular arrays when an individual moves around a particular location.The firing information is then posted towards more structured neural networks to control movements (for instance, to place cells) [5].In this respect, research about GCs is addressed using extracellular action potentials recorded from MEC neurons by means of an array of electrodes placed on freely moving rodents.
Neurobiologically based robot navigation has been the subject of research for a considerable time as noted in [6].However, recent scientific interest has been focused on understanding the mechanisms by which these GCs create a cognitive map of the environment as this would enable the building of robots that mimic the mammalian biological navigation system.
Previous innovative studies are recognized with respect to this achievement.For example, [7,8] show a new architecture for generating GCs that was implemented into a real robot.These GCs are based on various modulo operators applied on the path integration field.However, there are drawbacks with this approach as it has a path integration error problem and the robot has a width and height of 40 cm and 1 m, respectively (the robot is the Robulab 10 from Robosoft [9]).Another example: the study by [10] implemented a GC model Table 1: Scaled variables and parameters values used for equations (3), (4), and (5).
based on a continuous attractor network of rate-coded cells, which encode the robot location and orientation (this robot is the Pioneer 2DXe mobile robot from Mobile Robots Inc. [11]).
In this work, we implement a novel discrete-time differential equation GC neuron model [12] onto a 32-bit ARM-Arduino Due based hardware-software platform.This work contributes to assessing the mathematically tractable and programmable model proposed by [12] and a set of suitable parameters are obtained for use (interested readers can see in advance (3), ( 4), (5), and Table 1).
On the other hand, previous works use commercial robot platforms.Instead, in this work the robot has nongeneralizable design; that is, the GC mathematical model requirements and hardware features were taken into account to accomplish the best performance.This robot is not intended to be able to be adapted to other purposes other than an effective configurable tool for studying GCs and MEC models and their dynamics.
In developing the robot, the following was achieved: (i) a suitable algorithm was obtained for the discrete-time model by using an Arduino hardware-software platform; (ii) input signals from the environment were used as input for the GCs; and (iii) the firing patterns generated by the algorithms were determined while the robot is freely moving.However, clear drawbacks were determined at a hardware level while achieving the above, and it was determined that only a reduced number of GCs can be implemented.Although this issue needs to be addressed in future work to overcome this hardware limitation and achieve a huge GCs network, this study demonstrates the mathematically tractable GC model proposed in [12] is programmable on RISC microcontrollers.In addition, parameters' values set was found for which the GCs worked as predicted.
This study therefore offers two benefits: (i) an assessment of an autonomous robot platform that mimics part of the mammalian biological navigation system (for this reason a PC is not used to simulate GCs, as the target is to develop robots using biologically inspired navigationcognitive maps); (ii) ensuring that the robot is an effective and configurable tool for studying and validating real biological navigation scenarios and that it enables experimental repeatability (in contrast to relying on the free and random moving of rodents).In other words, this robot is conceived to be a research tool for use by neuroscientists to study how the MEC of mammalians builds an environmental cognitiveneural map.
This paper is presented as follows: Section 2 describes the mathematical model of the GCs.Section 3 presents Figure 1: Grid cells in the MEC of a rat while moving in an arena (from [5]): (a) set of spikes (in red) that appears while the rat is moving around certain locations, (b) random walk trajectories in black.
implementation of GCs within the robot; Section 4 describes the mathematical model translation to code by scaling the discrete-time differential equations.Section 5 shows firing of the GCs which is achieved when the robot explores certain locations within the laboratory arena, and final conclusions are made in Section 6.

Grid Cell (GC) Neural Model
The GCs comprise the medial entorhinal cortex (MEC) of mammalian species.These cells provide the brain with a metric for the animal's local space (or geometric reference) so that it knows its position in relation to its environment; that is, they work as a cognitive map with firing fields dispersed over the entire environment.For example, when a mouse moves in a given space, the GCs show shots in a hexagonal firing pattern with equidistant nodes, as shown in Figure 1.
As a model, this work uses (1), as proposed in [12,13] and takes into account three dimensions of GC variation: scale, orientation, and phase.It is of note that the GCs model is too broad to be captured completely in this article, and thus only the base ideas are introduced to enable an understanding of how the GC and the robot work.th GC   (, ) function is the sum of three two-dimensional sinusoids and is characterized by its wave vector   , with 0, 60, and 120 degrees of angular difference (see (1)).The index  indicates the value variations of GC parameters that depend on the their position inside the MEC.The expression is given by (1); Figures 2 and  3 give examples of possible shapes, to provide an enhanced insight.
In addition the   () function uses the following parameters (depending on the GC position inside the MEC): angular phase shift that the environment produces on the grid (vi)   [rads] =  env +    (vii)  0, = (2N(0, 1), 2N(0, 1)) (horizontal and vertical offset of the cell): factor 2 is used because the robot will be used in an 2 × 2 m testing area The fire time-discrete nonlinear differential equation is proposed in [14], which describes the GC membrane potential; it is also implemented.The assessed model of th GC is then expressed by ( 3), (4), and (5) with the following parameters: (discrete-time value for numerical integration); (iv)  , is the synaptic excitation current model from   (, ) at the th timestep; (v) V ,off is the shifting value to enable all positive values to be achieved (for easy digital implementation), (vi) V ,peak is the maximum achievable membrane potential after firing, (vii) V , is the refractory membrane potential (unit mV), (viii) V ,th is the firing threshold (unit mV), (ix)  is the lowest recovery membrane after firing (unit mV), and finally (x) , , , and  are constants (interested readers can see in advance the model results obtained after the assessment in Table 1).
V , = V ,−1 After firing, the membrane potential V  (mV) and the recovering potential  , (unit mV) need to then be reset according to the following rule: if and  , =  , + .

Implementation of Robot Hardware
The robot system block diagram (shown in Figure 4) features two microcontrollers interconnected by a tailored 32-bit parallel wired communication using IO ports A and C. One of the microcontrollers updates is the robot position relative to the starting location over time (odometry) from information obtained from the wheels' encoders.The  = (, ) position vector is sent to the other microcontroller, which solves discrete-time equations ( 3), (4), and (5).Both the embedded systems are Arduino Due boards [15] based on the 32-bit SAM3X8E ARM core Cortex-M3 architecture.
Each board features a 84 MHz clock, 54 digital input/output pins, and 12 analog inputs and the robot's wheels are driven by two 12 V DC motors with PWM H-bridge driver.The robot communicates to the outside using the PC, so that the GC spikes and the robot's position can be read by the researchers.
The robot constitutive parts are shown in Figures 5 and 6.The axles of its wheels have slotted disks to track rotation using optocouplers (the set disk-optocoupler is called the "encoder" and is used to estimate the wheel's angular rotation).The robot estimates its displacement and trajectory from the departure point using the information provided by such encoders (odometry) as suggested in literature [16] (pp.49-54).The position  = (, ) is estimated with an accuracy of 1 cm, which is sufficient for this first GC model assessment.The tilt sensors are resistors whose values vary with deformation.They are used to detect the proximity of obstacles and avoid collisions.Figure 6 shows a collision.The bumper has the same function but is connected to two lateral switches that have state change of ON/OFF which indicate possible frontal collisions with an object.The robot is power-supplied by an external unified DC voltage power supply of 12 V, 5 V, and 3.3 V.In addition the robot includes a camera OV5642 [17] for taking RGB photos, which will enable it in future research to identify different environments; however at this assessment level, the environment for the GC model is only provided in terms of the constant parameters as described.The robot also includes a Bluetooth HC-05 communication module [18] for code debugging messages during the early development stages as discussed in Section 5.This module enables communication to be established with the PC to obtain real time GCs spikes.

Implementation of Robot Software
The Arduino IDE [15] was used as the programming environment as it provides libraries built in C++ and thus reduces the time required to obtain a code prototype.The programs in each microcontroller were implemented using Round-Robin scheduling with interruptions; this preemptive process scheduling algorithm was selected because of its ability to handle the multiple sensors signals.In addition, it has the computational requirements to obtain numerical solutions of the GCs.The scheduling pseudocode of the Round-Robin for the navigation system is shown in Listing 1 to clarify its operation.The robot's motion occurs using a uniform random distribution function that generates random wheels motion (speed and direction for each wheel: both are updated independently periodically each 1 s).The motion simulates that of a rat exploring certain environments and while exploring the robot estimates its position relative to the starting point using the information provided by encoders (odometry-based model [16]).During this assessment stage, the error sources such as unequal wheel diameters, variation in the contact point of the wheels, and variable friction are neglected.A programing subroutine that we named RoutineAlert() was implemented using Arduino IDE libraries, which provide randomly generated values.The following two problems were then analyzed: (i) the need to determine limited speeds values achievable by each wheel gear to obtain bounded speed values and (ii) the need to radically reduce the total time consumed by the processor to perform the necessary tasks between consecutive RoutineAlert() calls.An important concept in dealing with the design is that the randomized values should not occur frequently (i.e., one RoutineAlert() calls inside the Round-Robin) as the robot speed would then tend to average the distribution and randomness would be lost.

Odometry and Robot Walk-Time: Avoiding Position Errors
of Significance.The odometry system performs tracking of the robot's position using the rotational angle of the wheels.The model used was proposed in [16] and is widely used for two-wheeled robots with differential traction.It uses the difference between wheel speeds to determine the direction of movement; as the wheels have a fixed axis, walking is achieved by imposing different speeds to each engine.The algorithm simply models the system and defines an axis of coordinates in the plane.The model is shown in Figure 7 and the equations used to update the robot position (, ) are described below: where   is the ratio of the number of pulses to the distance traveled (meter per encoder pulse),    and    are the amount of measured pulses on the right and left wheel up to time   ,  is the distance between the wheels' centers,  is the wheel radius, and   is the encoder resolution (counts per turn).Cumulative errors occur when updating the robot's position and the article [20] addresses the problem of measurements and correcting errors in systems such as this.According to these authors, among the multiple sources of error that could affect a system with two controlled wheels and odometry, two are more dominant than the others: (i) (systematic error) the radii of both wheels are not equal (wheels are coated with rubber to improve traction and it is very difficult to ensure that they are manufactured to be exactly the same); thus an encoder pulse can mean that different linear displacements occur with respect to each wheel and the assumed straight trajectory that should occur in the odometry model is thus actually curved; (ii) (random error) wheel slippage: this causes a change in the relation between the linear displacement of the wheel and the measured angle of rotation by the encoders.This source generates similar effects to those mentioned above but in rectilinear trajectories and such effects are mainly significant at angles of rotation.These sources of error modify the robot's actual position in relation to that of its estimated position.Although positional compensation has not been implemented in this preliminary work to avoid errors, it has been empirically found to be possible to avoid such error compensation as suggested in [20] and that an assessment of GCs is sufficiently accurate if the robot's walk-time is less than 5 min.Therefore, the odometry system has a limited useful life for each robot walk and for the surface in which it moves and the value of 5 min is used in this considered experimental setup.Each robot walk-time was thus only 5 min (we also reiterate this value in the results section to explain results shown in Figure 8).The starting point is defined inside the arena prior to the robot walking.The updated position is then used to compute each of GCs' states (i.e., to solve (3), (4), and ( 5)).In case of collision with obstacles, the robot randomly updates speed and rotates its wheels at different speeds to enable it to change course.

Scaling Equations.
One of the main issues requiring attention in software implementation is the need to ensure that the computation of each state for each time-step is very short.In this respect, using the selected Cortex M3 it is possible to solve (3), (4), and (5) with a reduced number of clock cycles (i.e., a small time-step).Therefore, it is necessary to solve them using integer values, and to achieve this, the equations need to be scaled because the processor uses its hardware multiplier module.This module enables product operation in just a few clock cycles, thereby reducing the computational time, and also by scaling, the overall computation time thus is reduced per GC from 40 S to 5 S.Scaling was performed ad hoc and according to the following reasoning (the function that describes the voltage membrane behavior is used here as an example); the variable V  was then multiplied by a factor in a way that was acceptable for truncation to integer values with respect to the error due to the floating point usage.A factor of 1000 achieves this condition (values 1000 times lower than the dimension on V  can be neglected).The scaled variables were then used for (3), (4), and (5) as shown in Table 1.This conclusion is extremely important for use as principle or rule in this class of bioinspired robot design.To give better insight, by scaling (3) it becomes Thus, the scaled equation with new names of variables that the program into the microcontroller resolves is the following:

Results of Assessment
A testing stage was conducted to evaluate the platform performance and its effectiveness in assessing GCs models.This was achieved by computing a maximum of 200 GCs in a time-step of 1 ms and reporting the spikes events to the PC using the mentioned Bluetooth module.The transmitted data frame format is shown in (9), in which each field is a byte.Data were processed using a Python written script and the GCs spikes and robot trajectories are plotted as shown in Figure 8.
0 ,  0 , spike GC It was important to ensure that the number of GCs spikes sent to the PC for analysis is  = 56 in (9): this number was empirically determined as the maximum number of GCs spikes and positions that could be sent every 1 ms at 115200 BPS without errors.When the Arduino library is used to access a Bluetooth Serial port it may produce an overhead and the implemented Round-Robin software architecture with interruptions is then not able to properly handle the information at the required time.For example, data have been lost when  > 56.For the data obtained using a set of suitable parameters values for (3), (4), and (5) (please see Table 1) a map can be found of the firing distribution of each GC for every location within the explored area in addition to the appearance of firing frequency.With the model proposed in [12] ((3), (4), and ( 5)), a unified and mathematically tractable and programmable model was achieved (but still partially tested) and further research can now continue.To generate the case study shown in this work, several repetitions of the above-mentioned procedure were conducted and files of the format given by (9) were obtained when the robot was placed in a laboratory arena, from a starting point chosen as ( 0 ,  0 ) = (40, 40) cm and  0 = 0.The robot then began to move randomly, while simultaneously sending generated data to the PC.The procedure ended at 5 min after it began and Figure 8 shows superposition of three experiments (each with a duration of 5 min) for a given GC with two different  values.Table 1 shows the suitable scaled variables and the suitable parameters values used for (3), (4), and (5).

Conclusion
This article shows the use of a two-wheel autonomous robot and confirms its effectiveness as a configurable tool for studying GCs models.A computational maximum of 200 GCs was achieved with a time-step of 1 ms; however this number of GCs is not yet representative of an actual mammalian MEC and thus more computational resources will be required in future developments.The main limitation of this study is related to data communication, and it will thus be necessary to use high speed wireless or wired communications, probably embedded systems with Ethernet communications, such as the well-known Raspberry Pi board.The assessment shows that the GC model works as predicted and a mathematically tractable and programmable model with parameters set was obtained.

Figure 6 :
Figure 6: Constitutive parts of robot: (a, b) left and right sides views; (c) top view of the robot: observe the left tilt sensor that indicates wall collision.

Figure 8 :
Figure 8: (a) Experimental map showing firing rate distribution for same grid cell with  = 2.69 m −1 (spike locations of grid cell are superimposed on robot's trajectory), (b) with  = 2.74 m −1 ; (c) an example of numerical integration of grid cell potential-membrane spikes (see (3)) for a given static robot position.Please, observe the triangular array of spikes.