from ca.nengo.model.impl import FunctionInput from ca.nengo.model import Units from nengoros.modules.impl.vivae import VivaeNeuralModule as NeuralModule from nengoros.comm.nodeFactory import NodeGroup as NodeGroup from nengoros.comm.rosutils import RosUtils as RosUtils from nengoros.modules.impl.vivae.impl import SimulationControls as Controls #from vivae.ros import Simulator as Simulator # creates nef network and adds it to nengo (this must be first in the script) net=nef.Network('Vivae tests') net.add_to_nengo() # here: delete old (toplevel) network and replace it with the newly CREATED one ################################## ################# setup the ROS utils (optional) #RosUtils.setAutorun(False) # Do we want to autorun roscore and rxgraph? (tru by default) RosUtils.prefferJroscore(False) # Turlte prefers roscore before jroscore (don't know why..) ################################## ################# define the group and start it modem = "nengoros.comm.nodeFactory.modem.impl.DefaultModem"; # custom modem here # this is launch command which calls the RosRun with name of ControlsServer as parameter #vvv = ["./sb/../../../../simulators/vivae/build/install/vivae/bin/vivae","vivae.ros.simulatorControlsServer.ControlsServer"] vvv = "vivae.ros.simulatorControlsServer.ControlsServer" # actual Vivae simulator, provies services # create group of nodes g = NodeGroup("vivae", True); # create default group of nodes g.addNC(vvv, "vivaeSimulator", "java"); # run the simulator.. g.addNC(modem,"modem","modem") # add default modem.. g.startGroup() # start group normally
net.add_to_nengo() # here: delete old (toplevel) network and replace it with the newly CREATED one # some default imports copied from nef from ca.nengo.util import VisiblyMutableUtils import java import inspect import warnings # import my custom classes here: from nengoros.modules.impl import DefaultNeuralModule as NeuralModule from nengoros.comm.nodeFactory import NodeGroup as NodeGroup from nengoros.comm.rosutils import RosUtils as RosUtils ##################################################################### # setup the ROS utils (optional, takes effect only if ROS found) RosUtils.setAutorun(True) RosUtils.prefferJroscore(False) # define nodes I want to use turtlesim = "../testnodes/turtlesim/turtlesim_node" # turtle under this project act = "resender.turtle.Controller"; sense = "resender.turtle.PositionSensor"; # create group for turtle g = NodeGroup("zelvicka", True); # True menas that group is independent, can be pushed into namespace g.addNC(turtlesim, "zelva", "native"); g.addNC(act, "actuators", "java"); g.addNC(sense, "sensors", "java"); # create identical group for another turtle g2 = NodeGroup("zelvicka", True); g2.addNC(turtlesim, "zelva", "native");
from nengoros.comm.rosutils import RosUtils as RosUtils from design.ea.matrix.ann import WMatrixEA as EA from design.ea.matrix.ann.impl import Ind as Ind from hanns import inFactory import modules from modules import mathNodes from modules import routing from hanns import spiketofloat from hanns import floattospike import inspect import os from ca.nengo.model.impl import NetworkImpl, NoiseFactory, FunctionInput, NetworkArrayImpl RosUtils.prefferJroscore(False) actualIn=0; actualOut=0; # how to read input and output weights from individual in java def setInW(w): useDesigned = True if (useDesigned): w = ind.getMatrixEncoder().get2DInMatrixNo(actualIn); else: for i in range(len(w)): for j in range(len(w[i])): w[i][j]=0.2 return w; def setOutW(w): # TODO: support for multidimensional outputs useDesigned=True