コード例 #1
0
def resetTool(toolName: str) -> None:
    data = openJson(PATH_2_TOOL_JSON)
    data[toolName]['TCP_coordinates'] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
    data[toolName]['calibrated_points'].clear()
    writeJson(PATH_2_TOOL_JSON, data)

    robotModel.setTool(
        toolName=toolName,
        tcpCoordinates=data[toolName]['TCP_coordinates'],
    )
コード例 #2
0
def updateTCPCoordinates(
        toolName: str,
        tcpCoordinates: list = point6f,
        calibratedPoints: dict = {}  ##################################
) -> None:
    if toolName != 'default':
        data = openJson(PATH_2_TOOL_JSON)
        data[toolName]['TCP_coordinates'] = tcpCoordinates
        data[toolName]['calibrated_points'] = calibratedPoints
        writeJson(PATH_2_TOOL_JSON, data)

        robotModel.setTool(
            toolName=toolName,
            tcpCoordinates=tcpCoordinates,
        )
    else:
        pass
コード例 #3
0
def addTool(toolNum: int = 0,
            toolName: str = 'TCP_',
            tcpCoordinates: list = point6f,
            calibratedPoints: dict = {}) -> str:
    "Add tool with default name like TCP_0"
    toolName = f'{toolName}{toolNum-1}'

    tcpInfo = {
        f"{toolName}": {
            "calibrated_points": calibratedPoints,
            "TCP_coordinates": tcpCoordinates
        }
    }
    data = openJson(PATH_2_TOOL_JSON)
    data.update(tcpInfo)
    writeJson(PATH_2_TOOL_JSON, data)
    return toolName
コード例 #4
0
 def deleteTCP(self) -> None:
     data = openJson(self.PATH_2_JSON)
     data.pop(self.name)
     writeJson(self.PATH_2_JSON, data)
コード例 #5
0
def calculateTCP(toolName: str) -> list:
    data = openJson(PATH_2_TOOL_JSON)
    points = data[toolName]['calibrated_points'].values()
    tcpCoordinates = cli.main(points)
    data[toolName]['TCP_coordinates'][:3] = tcpCoordinates
    writeJson(PATH_2_TOOL_JSON, data)
コード例 #6
0
def updateCalibratedPoints(toolName: str, key: str, value: list):
    data = openJson(PATH_2_TOOL_JSON)
    data[toolName]['calibrated_points'].update({key: value})
    writeJson(PATH_2_TOOL_JSON, data)
コード例 #7
0
def checkSimilarity(toolName: str) -> bool:
    toolsNames = openJson(PATH_2_TOOL_JSON).keys()
    if toolName in toolsNames:
        return True
    return False
コード例 #8
0
def getTCPCoordinates(toolName: str) -> list:
    if toolName != 'default':
        tools = openJson(PATH_2_TOOL_JSON)
        return tools[toolName]['TCP_coordinates']
    else:
        return [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
コード例 #9
0
def updateToolName(newName: str, currentName: str) -> None:
    data = openJson(PATH_2_TOOL_JSON)
    data[newName] = data.pop(currentName)
    writeJson(PATH_2_TOOL_JSON, data)
コード例 #10
0
def delTool(toolName: str) -> None:
    resetTool(toolName)
    data = openJson(PATH_2_TOOL_JSON)
    data.pop(toolName)
    writeJson(PATH_2_TOOL_JSON, data)
コード例 #11
0
def getToolsNames() -> str:
    toolsNames = openJson(PATH_2_TOOL_JSON).keys()
    return toolsNames