本文整理汇总了Python中nengoros.comm.rosutils.RosUtils类的典型用法代码示例。如果您正苦于以下问题:Python RosUtils类的具体用法?Python RosUtils怎么用?Python RosUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RosUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: old
net=nef.Network('Random Turtle Control Demo')
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);
示例2: TurnGenerator
import nef
import time
import random
from ca.nengo.math.impl import FourierFunction
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
import simplemodule
import util
from vivaeLauncher import oneAgent
RosUtils.setAutorun(False)
# this generates signal which turns the agent left
class TurnGenerator(simplemodule.SimpleModule):
# .......... 9 2 1 [all sensors, two speeds, turning duration]
def init(self,inputdims,outputdims,numpars):
self.inputdims = inputdims;
self.outputdims = outputdims;
self.numpars = numpars;
self.l = 0.1;
self.r = 0.38;
self.duration = 0;
self.maxdur = 30;
示例3: setInW
from ca.nengo.model import Units
from nengoros.neurons.impl.test import SecondOne as SmartNeuron
from nengoros.comm.nodeFactory import NodeGroup as NodeGroup
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 routing
import inspect
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 = False
if (useDesigned):
w = ind.getMatrix().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=False
示例4: nengo
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