modem = g.getModem() simulator = NeuralModule("VivaeTest", modem) # create NeuralModule which is able to add/remove agents Controls = simulator.getControls() # this starts the control services.. many = net.add(simulator) # add it to the Nengo network time.sleep(2) # give it some time to init services # Controls.loadMap('data/scenarios/arena2.svg') # Controls.loadMap('data/scenarios/ushape.svg') # Controls.loadMap('data/scenarios/arena1.svg') Controls.loadMap("data/scenarios/arena1.svg") Controls.addAgent("a", 4) Controls.addAgent("b", 18) Controls.addAgent("c", 18, 30, 50) Controls.addAgent("d") # adding more agents than is in the simulation Controls.addAgent("e", 8) # will result just in error message in console 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
################################## modem = g.getModem() time.sleep(3) # if the process is native, it takes longer time to init the services !! simulator = NeuralModule('VivaeTest',modem) # create NeuralModule which is able to add/remove agents Controls = simulator.getControls(); # this starts the control services.. Controls.setVisible(False); many=net.add(simulator) # add it to the Nengo network #Controls.loadMap('data/scenarios/arena2.svg') #Controls.loadMap('data/scenarios/ushape.svg') Controls.loadMap('data/scenarios/arena1.svg') #Controls.loadMap('data/scenarios/manyAgents.svg') Controls.addAgent('a',4) Controls.addAgent('b',18) Controls.addAgent('c',18,30,50) """ Controls.addAgent('d') Controls.addAgent('e',8) Controls.addAgent('f',20,10,50) Controls.addAgent('g') Controls.addAgent('h',39) Controls.addAgent('i',22,30,1) Controls.addAgent('j') """ #time.sleep(1); # concurent modification exception Controls.start()
""" Notes about agents: (see screenshot to this script) Friction sensor [dots] -measures [binary] presence of ANY OBJECT (including grass) -black and blue lines gere -road=0, everything other=1 Distance sensor [lines] -measures [continuous] distance to the nearest OBSTACLE (not grass, not road) Note: value 0 to sensor properties should add 0 sendors now """ #addAgent(name,numSensors, maxDistance, frictionSensor) Controls.addAgent('a',4, 70 ,0) Controls.start() #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('a').getTermination())
################# get modem, create smart neuron with inputs/outputs modem = g.getModem() simulator = NeuralModule('VivaeTest',modem) # create NeuralModule which is able to add/remove agents Controls = simulator.getControls(); # this starts the control services.. many=net.add(simulator) # add it to the Nengo network time.sleep(2) # give it some time to init services #Controls.loadMap('data/scenarios/arena2.svg') #Controls.loadMap('data/scenarios/ushape.svg') #Controls.loadMap('data/scenarios/arena1.svg') Controls.loadMap('data/scenarios/manyAgents.svg') Controls.addAgent('a',4) Controls.addAgent('b',18) Controls.addAgent('c',18,30,50) Controls.addAgent('d') Controls.addAgent('e',8) Controls.addAgent('f',20,10,50) Controls.addAgent('g') Controls.addAgent('h',39) Controls.addAgent('i',22,30,1) Controls.addAgent('j') Controls.start() ################################## ################# wire the network
""" Notes about agents: (see screenshot to this script) Friction sensor [dots] -measures [binary] presence of ANY OBJECT (including grass) -black and blue lines gere -road=0, everything other=1 Distance sensor [lines] -measures [continuous] distance to the nearest OBSTACLE (not grass, not road) Note: value 0 to sensor properties should add 0 sendors now """ #addAgent(name,numSensors, maxDistance, frictionSensor) Controls.addAgent('a',12, 0 ,40) Controls.start() #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('a').getTermination())
from nengoros.comm.rosutils import RosUtils as RosUtils from nengoros.modules.impl.vivae.impl import SimulationControls as Controls Controls = simulator.getControls(); # this starts the control services.. Controls.stop() Controls.destroy() #Controls.loadMap('data/scenarios/arena2.svg') Controls.loadMap('data/scenarios/ushape.svg') #Controls.loadMap('data/scenarios/arena1.svg') #Controls.loadMap('data/scenarios/manyAgents.svg') Controls.init() """ Controls.addAgent('a',4) Controls.addAgent('b',18) Controls.addAgent('c',18,30,50) Controls.addAgent('d') Controls.addAgent('e',8) Controls.addAgent('f',20,10,50) Controls.addAgent('g') Controls.addAgent('h',39) Controls.addAgent('i',22,30,1) Controls.addAgent('j') """ #time.sleep(1); # concurent modification exception Controls.start()
# run vivae g = NodeGroup("vivae", True); # create default independent group of nodes g.addNC(vv, "vivaeSimulator", "native");# add vivae ControlsServer (node which handles the simulation) g.addNC(modemCl,"modem","modem") # add a default modem.. g.startGroup() # start group normally time.sleep(2) # give it some time to init services modem = g.getModem() simulator = VivaeNeuron('VivaeTest',modem) # create NeuralModule which is able to add/remove agents Controls = simulator.getControls(); # this starts the control services.. many=net.add(simulator) # add it to the Nengo network 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