def sampleAvgCurrent(): global totalSamplesTaken_c totalSamplesTaken_c = totalSamplesTaken_c + 1.0 global totalCurrent global AvgCurrent if (outPutTxt_c): for node in range(1, 7): measuredCurrent = xjus.getNodeAvgCurrent(node) if (node == 1): output = str(measuredCurrent) + ", " totalCurrent += measuredCurrent else: output += str(measuredCurrent) + ", " totalCurrent += measuredCurrent fC.write(output + str(totalSamplesTaken_c) + '\n') # Update Avg Current AvgCurrent = totalCurrent / totalSamplesTaken_c else: for node in range(1, 6): totalCurrent += xjus.getNodeAvgCurrent(node) # Update Avg Current AvgCurrent = totalCurrent / totalSamplesTaken_c
def returnToStand(): leftCurrent = 0 for node in left: leftCurrent += xjus.getNodeAvgCurrent(node) rightCurrent = 0 for node in right: rightCurrent += xjus.getNodeAvgCurrent(node) if leftCurrent > rightCurrent: first = right second = left else: first = left second = right for node in first: moveToFullRotation(node) wait() for node in second: moveToFullRotation(node) wait() for node in nodes: xjus.zeroPosition(node)