def SharedVarUpdated(sv):

    s = '(BB_sv_updated "' + sv.varName + '" '
    if sv.svType in [
            BB.SharedVarTypes.INT, BB.SharedVarTypes.LONG,
            BB.SharedVarTypes.DOUBLE
    ]:
        s += str(sv.data)
    elif sv.svType in [
            BB.SharedVarTypes.INT_ARRAY, BB.SharedVarTypes.LONG_ARRAY,
            BB.SharedVarTypes.DOUBLE_ARRAY, BB.SharedVarTypes.BYTE_ARRAY
    ]:
        s += str(sv.size) + ' ' + ' '.join([str(x) for x in sv.data])
    elif sv.svType == BB.SharedVarTypes.STRING:
        s += '"' + sv.data + '"'
    elif sv.svType == BB.SharedVarTypes.RECOGNIZED_SPEECH:
        s += str(len(sv.data)) + ' ' + ' '.join(
            ['"' + x + '" ' + str(y) for x, y in sv.data])
    elif sv.svType == BB.SharedVarTypes.VAR:
        s += str(sv.data)
    elif sv.svType == BB.SharedVarTypes.MATRIX:
        s += str(len(sv.data)) + ' ' + str(len(sv.data[0])) + ' '
        for r in sv.data:
            for c in r:
                s += ' ' + str(c)
    else:
        print 'ERROR: Parsing shared var: "{0}" failed'.format(sv.varName)
        return

    s += ')'
    clipsFunctions.Assert(s)
    clipsFunctions.PrintOutput()
Esempio n. 2
0
def callbackCommandResponse(data):
    print "callbackCommandResponse name command:" + data.name
    rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.name)
    clipsFunctions.Assert('(BB_received "{0}" {1} {2} "{3}")'.format(data.name, data.id, data.successful, data.params))
    clipsFunctions.PrintOutput()
    clipsFunctions.Run(BBFunctions.gui.getRunTimes())
    clipsFunctions.PrintOutput()
def RunCommand(c):
    clipsFunctions.Assert('(BB_cmd "{0}" {1} "{2}")'.format(
        c.name, c._id, c.params))
    clipsFunctions.PrintOutput()
    clipsFunctions.Run()
    clipsFunctions.PrintOutput()
    time.sleep(1)
    return Response.FromCommandObject(
        c, False, 'CLIPS was busy or not able to handle the command.')
Esempio n. 4
0
def callbackCommandResponse(data):
    print "callbackCommandResponse name command:" + data.name
    rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.name)
    clipsFunctions.Assert('(BB_received "{0}" {1} {2} "{3}")'.format(
        data.name, data.id, data.successful, data.params))
    clipsFunctions.PrintOutput()
    clipsFunctions.Run(
        ''
    )  # aqui se manda el numero de pasos que ejecutara CLIPS con [''] se ejecutan todos los pasos sin detenerse
    clipsFunctions.PrintOutput()
Esempio n. 5
0
def timerThread(t, sym):
    time.sleep(t/1000)
    clipsFunctions.Assert('(BB_timer {0})'.format(sym))
    clipsFunctions.PrintOutput()
Esempio n. 6
0
def cmdTimerThread(t, cmd, cmdId):
    time.sleep(t/1000)
    clipsFunctions.Assert('(BB_timer "{0}" {1})'.format(cmd, cmdId))
    clipsFunctions.PrintOutput()
def ResponseReceived(r):
    clipsFunctions.Assert('(BB_received "{0}" {1} {2} "{3}")'.format(
        r.name, r._id, r.successful, r.params))
    clipsFunctions.PrintOutput()
    clipsFunctions.Run(gui.getRunTimes())
    clipsFunctions.PrintOutput()