def segmentGroundPlanes():

    objs = []
    for obj in om.getObjects():
        name = obj.getProperty('Name')
        if name.startswith('pointcloud snapshot'):
            objs.append(obj)

    objs = sorted(objs, key=lambda x: x.getProperty('Name'))

    d = DebugData()

    prevHeadAxis = None
    for obj in objs:
        name = obj.getProperty('Name')
        print '----- %s---------' % name
        print  'head axis:', obj.headAxis
        origin, normal, groundPoints, _ = segmentGround(obj.polyData)
        print 'ground normal:', normal
        showPolyData(groundPoints, name + ' ground points', visible=False)
        a = np.array([0,0,1])
        b = np.array(normal)
        diff = math.degrees(math.acos(np.dot(a,b) / (np.linalg.norm(a) * np.linalg.norm(b))))
        if diff > 90:
            print 180 - diff
        else:
            print diff

        if prevHeadAxis is not None:
            a = prevHeadAxis
            b = np.array(obj.headAxis)
            diff = math.degrees(math.acos(np.dot(a,b) / (np.linalg.norm(a) * np.linalg.norm(b))))
            if 90 > diff:
                print 180 - diff
            else:
                print diff
        prevHeadAxis = np.array(obj.headAxis)

        d.addLine([0,0,0], normal)

    updatePolyData(d.getPolyData(), 'normals')
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/segmentGroundPlanes/swapped operands of `>`