def operationCallback(id, type):
    global flag
    flag = type
    if flag == OperationFlags['Recognize_Finished']:
        result = actuatorController.getActuatorIdArray()
        print("Number of connected actuators:%d" % (len(result)))
        actuatorController.launchAllActuators()
Ejemplo n.º 2
0
def operationCallback(id, type):
    global flag
    flag = type
    # flag 自动识别完成
    if flag == 0:
        result = actuatorController.getActuatorIdArray()
        print("Number of connected actuators:%d" % (len(result)))
def char_to_directive(directive, value):
    result = actuatorController.getActuatorIdArray()
    if directive == 'v':
        actuatorController.setVelocity(int(result[0]), float(value))
    elif directive == 'c':
        actuatorController.setCurrent(int(result[0]), float(value))
    elif directive == 'p':
        actuatorController.setPosition(int(result[0]), float(value))
    elif directive == 'a':
        actuatorController.activeActuatorMode(int(value))
    elif directive == 'l':
        actuatorController.launchAllActuators()
    elif directive == 's':
        actuatorController.closeAllActuators()
def operationCallback(id, type):
    global flag
    flag = type
    if flag == 0:
        actuatorController.launchAllActuators()
    elif flag == 1:
        result = actuatorController.getActuatorIdArray()
        print("Number of connected actuators:%d" % (len(result)))
        if actuatorController.getActuatorAttribute(
                result[0], ActuatorAttribute['ACTUATOR_SWITCH']) == 1:
            global bSetLimitation
            actuatorController.setHomingPosition(
                id,
                actuatorController.getActuatorAttribute(
                    id, ActuatorAttribute['ACTUAL_POSITION']))
            actuatorController.setMinPosLimitValue(id, -10)
            actuatorController.setMaxPosLimitValue(id, 10)
            actuatorController.setActuatorAttribute(
                id, ActuatorAttribute['POS_OFFSET'], 0.5)
            bSetLimitation = True
def operationCallback(id, type):
    global flag
    flag = type
    if flag == 0:

        actuatorController.launchAllActuators()
    elif flag == 1:
        result = actuatorController.getActuatorIdArray()
        if actuatorController.getActuatorAttribute(
                result[0], ActuatorAttribute['ACTUATOR_SWITCH']) == 1:
            # 调整执行器速度环最小电流输出
            actuatorController.setMinOutputCurrent(result[0], -10)
            # 调整执行器速度环最大电流输出
            actuatorController.setMaxOutputCurrent(result[0], 10)
            # 调整执行器位置环最小速度输出
            actuatorController.setMinOutputVelocity(result[0], -2000)
            # 调整执行器位置环最大速度输出,最大值要大于最小值
            actuatorController.setMaxOutputVelocity(result[0], 2000)
            # 调整执行器Mode_Profile_Pos的最大速度(RPM)
            actuatorController.setActuatorAttribute(
                result[0], ActuatorAttribute['PROFILE_POS_MAX_SPEED'], 1000)