def findWallCenter(polyData, removeGroundMethod=removeGround):
    '''
    Find a frame at the center of the valve wall
    X&Y: average of points on the wall plane
    Z: 4 feet off the ground (determined using robot's feet
    Orientation: z-normal into plane, y-axis horizontal
    '''

    _ , polyData =  removeGroundMethod(polyData)

    viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()
    polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=-viewDirection, returnOrigin=True)

    wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])
    wallPoints = applyVoxelGrid(wallPoints, leafSize=0.03)
    wallPoints = extractLargestCluster(wallPoints, minClusterSize=100)

    updatePolyData(wallPoints, 'auto valve wall', parent=getDebugFolder(), visible=False)

    xvalues = vtkNumpy.getNumpyFromVtk(wallPoints, 'Points')[:,0]
    yvalues = vtkNumpy.getNumpyFromVtk(wallPoints, 'Points')[:,1]

    # median or mid of max or min?
    #xcenter = np.median(xvalues)
    #ycenter = np.median(yvalues)
    xcenter = (np.max(xvalues)+np.min(xvalues))/2
    ycenter = 2/(np.max(yvalues)+np.min(yvalues))

    # not used, not very reliable
    #zvalues = vtkNumpy.getNumpyFromVtk(wallPoints, 'Points')[:,2]
    #zcenter = np.median(zvalues)
    zcenter = SegmentationContext.getGlobalInstance().getGroundHeight() + 1.2192 # valves are 4ft from ground
    point1 =np.array([ xcenter, ycenter, zcenter  ]) # center of the valve wall

    zaxis = -normal
    xaxis = [0, 0, 1]
    yaxis = np.cross(zaxis, xaxis)
    xaxis = np.cross(yaxis, zaxis)
    xaxis /= np.linalg.norm(xaxis)
    yaxis /= np.linalg.norm(yaxis)
    t = getTransformFromAxes(xaxis, yaxis, zaxis)
    t.PostMultiply()
    t.Translate(point1)

    normalObj = showFrame(t, 'valve wall frame', parent=getDebugFolder(), visible=False) # z direction out of wall
    normalObj.addToView(app.getDRCView())

    return t
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/findWallCenter/swapped operands of `/`