예제 #1
0
파일: 07model.py 프로젝트: jvitku/nengo_1.4
Controls.addAgent("f", 20, 10, 50)  # these agents are not created
Controls.addAgent("g")
Controls.addAgent("h", 39)
Controls.addAgent("i", 22, 30, 1)
Controls.addAgent("j")

Controls.start()

##################################
################# wire the network

# Create a white noise input function with parameters: baseFreq, maxFreq (rad/s), RMS, Seed
input = FunctionInput("Randomized input", [FourierFunction(0.5, 10, 6, 12), FourierFunction(2, 11, 5, 17)], Units.UNK)

# Add the input node to the network and connect it to the smart enuron
net.add(input)

# make neural network and connect it to the smart neuron
A = net.make("PositionData", neurons=10, dimensions=2, radius=20)

net.connect(input, simulator.getAgent("b").getTermination())
net.connect(A, simulator.getAgent("c").getTermination())

net.connect(simulator.getAgent("a").getOrigin(), A)
net.connect(A, simulator.getAgent("a").getTermination())

print "OK, configuration done."
print "-Agents have custom sensors"
print "-Aget can be cotrolled from arbitrary source, there are some restriction on IO dimension"
print "-Agent also does not have to be controlled at all."
예제 #2
0
################################## 
################# wire the network


#Create a white noise input function with parameters: baseFreq, maxFreq (rad/s), RMS, Seed
input=FunctionInput('Randomized input', [FourierFunction(.5, 10, 6, 12),
    FourierFunction(2, 11, 5, 17)],
    Units.UNK) 

# Add the input node to the network and connect it to the smart enuron
net.add(input)  

# make neural network and connect it to the smart neuron 
A=net.make('PositionData',neurons=10,dimensions=2,radius=20)

net.connect(input,simulator.getAgent('b').getTermination())
net.connect(A,simulator.getAgent('c').getTermination())

net.connect(simulator.getAgent('a').getOrigin(), A)
net.connect(A,simulator.getAgent('a').getTermination())

print "OK, configuration done. Simulating.."

t=0.5;
dt=0.001;
net.reset()
net.run(t,dt)

print "Simulaiton done, calling reset.."

Controls.reset();
예제 #3
0
Controls.loadMap('data/scenarios/arena2.svg') 
Controls.addAgent('a',4)
Controls.start()

# run minMax node
g = NodeGroup('minMaxFinder', True);# create independent group called..
g.addNC(minmax, "MinMax","java");       # start java node and name it finder
g.addNC(modemCl,"Modem", "modem")       # add modem to the group
g.startGroup()

modem = g.getModem()
neuron = NeuralModule('MinMaxFinder',    modem)      # construct the smart neuron 
neuron.createEncoder("ann2rosFloatArr", "float",4)  # termination = input of neuron (4xfloat)
neuron.createDecoder("ros2annFloatArr", "float",2)  # origin = output of neuron (min and max)
minmaxN=net.add(neuron)                    # add it into the network

# make neural ensemble 
A=net.make('Controls',neurons=50,dimensions=2,radius=2)

net.connect(simulator.getAgent('a').getOrigin(), minmaxN.getTermination('ann2rosFloatArr'))
net.connect(minmaxN.getOrigin('ros2annFloatArr'),A)
net.connect(A,simulator.getAgent('a').getTermination())

print "OK, configuration done.  -- Open the network in GUI to see hot the controls are wired."
print "-one agent created inside the vivae simulator. Agent holds his origins/terminations"
print "-agent publishes vector of 4 variables (each for one sensor) and subscribes to two values for motor velocities"
print "-smart neuron called MinMax finds the min and max value from sensory data, these values sends to neural ensemble"