Skip to content
Snippets Groups Projects
Commit 6ead42be authored by Evan Eames's avatar Evan Eames Committed by Ugo Albanese
Browse files

Merged in NRRPLT-7271-choose-and-view-brain-type (pull request #61)

[NRRPLT-7271] Add default braitenberg Nengo brain model

Approved-by: Ugo Albanese
parent 86c33356
No related branches found
No related tags found
No related merge requests found
import nengo
circuit = nengo.Network()
with circuit:
# Now we create an Ensembles of 1000 neurons. These 1000 neurons are
# configured to form a distributed representation of three values for
# sensation, and two values for actuation (i.e.
# each neuron gets an input current that is some random combination
# of those three values). The actors population simply redirects the
# neurally encoded value to the connected motors of the husky robot.
sensors = nengo.Ensemble(n_neurons=1000, dimensions=3)
actors = nengo.Ensemble(n_neurons=2, dimensions=2, neuron_type=nengo.Direct())
# Now we tell Nengo what computation we want the neurons to
# approximate. Nengo will use this to find connection weights
# between 'sensors' (the perception ensemble) and 'actors' (the output ensemble)
# that will best approximate the function we give it.
#
# It should be noted that we can do anything we want
# here in this function. We could do some complex algorithm
# involving trig functions, multiple branching if statements,
# or whatever. Nengo will attempt to approximate that function
# using the neurons.
#
# The synapse=0.1 parameter indicates that the connections
# defined here have a synapse that is an exponential low-pass
# filter with a time constant of 100ms.
def control(x):
rl, rr, gb = x
forward = min(1.0, max(-0.01, (min(rl, rr)) * 100000))
turn = max(min((rl - rr) * 100, 1), -1)
if max(rl, rr) < 0.1:
forward = -0.001
turn = 0.5
return forward, turn
nengo.Connection(sensors, actors, function=control, synapse=0.1)
<?xml version='1.0'?>
<model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.humanbrainproject.eu/SP10/2017/brain_model_config" xsi:schemaLocation="http://schemas.humanbrainproject.eu/SP10/2017/brain_model_config ../brain_model_configuration.xsd">
<name>braitenberg_nengo</name>
<version>1.0</version>
<maturity>production</maturity>
<brain>braitenberg_nengo.py</brain>
<sdf version="1.6">model.sdf</sdf>
<author>
<name>Lazar Mateev</name>
</author>
<author>
<name>Georg Hinkel</name>
</author>
<description>
This file contains the setup of the neuronal network running the Husky experiment with neuronal image recognition.
</description>
</model>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment