Exemplo n.º 1
0
def main():
    markerNames = ['LASIS', 'RASIS', 'LPSIS', 'RPSIS', 'SACR', 'RGTRO']
    pelvisPoints = parsePointFile('Subject005Trial08.txt', markerNames)

    avgPoints = getAvgPoints(pelvisPoints, markerNames, range(100))

    pelvis = pelvicCoordinateSystem()
    pelvis.setCoordinateSystem(avgPoints['RASIS'], avgPoints['LASIS'], avgPoints['RPSIS'], avgPoints['LPSIS'])
    pelvis.setOrigin(avgPoints['RASIS'], avgPoints['LASIS'], avgPoints['RGTRO'], side='right')
    print pelvis.getOrientation()*180/np.pi, pelvis.origin
    print avgPoints['LASIS']
    # for name in markerNames:
    #     point = pelvis.getLocalCoordiante(avgPoints[name])
    #     print '{} & {} & {} & {} \\'.format(name, np.round(point[0],3)*100, np.round(point[1],3)*100, np.round(point[2],3)*100)
        # print '\hline\n{} & {} & {} & {} \\'.format(name, np.round(point[0],3)*100, np.round(point[1],3)*100, np.round(point[2],3)*100)
    return
Exemplo n.º 2
0
def main():
    markerNames = ['LASIS', 'RASIS', 'LPSIS', 'RPSIS', 'SACR']
    # markerNames = ['LGTRO', 'FLTHI', 'LTHI', 'LLEK']
    pelvisPoints = parsePointFile('Subject005Trial08.txt', markerNames)

    mass = 35.8 # Trunk weight in kg
    totalHeight = 1.7 # meters
    height = 0.289*totalHeight # meters
    width = 0.2295*totalHeight # meters
    thickness = 0.15 # meters
    inertiaMatrix = getInertiaMatrix(mass, width, height, thickness)

    timeIndicies = range(400, 1200)

    rotationMatrix = np.zeros((4,4,len(timeIndicies)))
    points0 = _getPoints(pelvisPoints, markerNames, 0)
    for i in range(len(timeIndicies)):
        timeIndex = timeIndicies[i]
        points1 = _getPoints(pelvisPoints, markerNames, timeIndex)
        rotationMatrix[:,:,i] = soderSvd(points0, points1)

    rotationMatrix = filterData(rotationMatrix)

    rotationMatrix = rotationMatrix[:,:,200:801]

    angularVelocities = np.zeros((rotationMatrix.shape[2], 3))
    for i in range(1, rotationMatrix.shape[2]-1):
        angularVelocities[i] = getAngularVelocity(rotationMatrix[:,:,i-1],
                                                  rotationMatrix[:,:,i],
                                                  rotationMatrix[:,:,i+1])
    angularAccelerations = getAngularAcceleration(angularVelocities)

    moments = np.zeros_like(angularAccelerations)
    term1 = np.zeros_like(angularAccelerations)
    term2 = np.zeros_like(angularAccelerations)
    for i in range(len(angularAccelerations)):
        moments[i], term1[i], term2[i] = getMoments(inertiaMatrix, angularVelocities[i], angularAccelerations[i])
    return angularVelocities, angularAccelerations, moments, term1, term2