def __init__(self): self.nlp = spacy.load('en') self.word_vectors = sense2vec.load() self.handlers = { 'similar': Sense(self.nlp, self.word_vectors), 'parse': Parse(self.nlp), 'vector': Sense(self.nlp, self.word_vectors), #'intent': Intent(self.nlp, self.word_vectors) # 'converse': # 'person': # 'address': # 'date': # 'email': }
def _buildSenseAct(self, agent, sense_name): """Returns a sense-act object for the given name. @param agent: The agent to build the sense-act for. @type agent: L{POSH.strict.Agent} @param sense_name: The name of the sense-act. @type sense_name: string @return: The created sense-act object @rtype: L{POSH.strict.Sense} """ return Sense(agent, sense_name)
def proc_elem(this_elem): if type(this_elem) is ListType: return map(proc_elem, this_elem) elif (type(this_elem) is InstanceType) and \ isinstance(this_elem, Sense): return Sense(sensor=this_elem.sensor, sense_value=sense_value, sense_predicate=sense_predicate, drive_name=drive_name, agent=self.agent) else: return this_elem
def __init__(self): config = configparser.ConfigParser() config.read("config.ini") IN_1 = config.getint("car","IN1") IN_2 = config.getint("car","IN2") IN_3 = config.getint("car","IN3") IN_4 = config.getint("car","IN4") self.change_speed = ChangeSpeed() self.motor = Motor(IN_1, IN_2, IN_3, IN_4) self.sense = Sense() self.qaudio = QAudio(4000) self.led_light = LED_Light()
def _buildSense(self, agent, sense_struct): """Returns a sense object for the given structure. The structure is of the form (name, value, predicate), where the first is a string, and the other two elements are either a string or None. @param agent: The agent to build the sense for. @type agent: L{POSH.strict.Agent} @param sense_struct: The sense structure. @type sense_struct: described above @return: The created sense object @rtype: L{POSH.strict.Sense} @raise NameError: If the sense could not be found in the behaviour dictionary. """ return Sense(agent, sense_struct[0], sense_struct[1], sense_struct[2])
from motionModel import MotionModel from controller import Robot,Motor from particleFilter import particleFilter from sense import Sense from action import rotate import time robot = Robot() #load sensor model, motion model and map. s = SensorModel(SensorModelDir) m = Map(MapFile,EnvFile,OutputDirectory) l = MotionModel(linearMotionModelData,rotationalMotionModelData) #initialize sensors sonarSensors = Sense(robot) #initialize motors leftMotor = robot.getMotor('left wheel motor') rightMotor = robot.getMotor('right wheel motor') rightMotor.setPosition(float('inf')) leftMotor.setPosition(float('inf')) rightMotor.setVelocity(0.0) leftMotor.setVelocity(0.0) motors = {"left":leftMotor,"right":rightMotor} #initialize encoders leftPosiotionSensor = robot.getPositionSensor("left wheel sensor") rightPosiotionSensor = robot.getPositionSensor("right wheel sensor") leftPosiotionSensor.enable(TimeStep) rightPosiotionSensor.enable(TimeStep)