def calc_properties(self): '''Sets the center of mass and inertia of the solid, both with respect to the fixed human frame. ''' self.COM = self.pos + self.RotMat * self.relCOM self.Inertia = inertia.rotate3_inertia(self.RotMat,self.relInertia)
def calc_properties(self): '''Calculates the segment's center of mass with respect to the fixed human frame origin (in the fixed human reference frame) and the segment's inertia in the fixed human frame but about the segment's center of mass. ''' # center of mass self.COM = self.pos + self.RotMat * self.relCOM # inertia in frame f w.r.t. segment's COM self.Inertia = inertia.rotate3_inertia(self.RotMat, self.relInertia)
def calc_rel_properties(self): '''Calculates mass, relative center of mass, and relative/local inertia, according to formulae in Appendix B of Yeadon 1990-ii. If the stadium solid is arranged anterior-posteriorly, the inertia is rotated by pi/2 about the z axis. ''' D = self.density h = self.height r0 = self.stads[0].radius t0 = self.stads[0].thick r1 = self.stads[1].radius t1 = self.stads[1].thick a = (r1 - r0) / r0 if (t0 == 0): b = 1.0 else: b = (t1 - t0) / t0 # DOES NOT WORK FOR CIRCLES!!! self.Mass = D * h * r0 * (4.0 * t0 * self.F1(a,b) + np.pi * r0 * self.F1(a,a)) zcom = D * (h**2.0) * (4.0 * r0 * t0 * self.F2(a,b) + np.pi * (r0**2.0) * self.F2(a,a)) / self.Mass self.relCOM = np.array([[0.0],[0.0],[zcom]]) # moments of inertia Izcom = D * h * (4.0 * r0 * (t0**3.0) * self.F4(a,b) / 3.0 + np.pi * (r0**2.0) * (t0**2.0) * self.F5(a,b) + 4.0 * (r0**3.0) * t0 * self.F4(b,a) + np.pi * (r0**4.0) * self.F4(a,a) * 0.5 ) Iy = (D * h * (4.0 * r0 * (t0**3.0) * self.F4(a,b) / 3.0 + np.pi * (r0**2.0) * (t0**2.0) * self.F5(a,b) + 8.0 * (r0**3.0) * t0*self.F4(b,a) / 3.0 + np.pi * (r0**4.0) * self.F4(a,a) * 0.25) + D * (h**3.0) * (4.0 * r0 * t0 * self.F3(a,b) + np.pi * (r0**2.0) * self.F3(a,a))) # CAUGHT AN (minor) ERROR IN YEADON'S PAPER HERE Iycom = Iy - self.Mass * (zcom**2.0) Ix = (D * h * (4.0 * r0 * (t0**3.0) * self.F4(a,b) / 3.0 + np.pi * (r0**4.0) * self.F4(a,a) * 0.25) + D * (h**3.0) * (4.0 * r0 * t0 * self.F3(a,b) + np.pi * (r0**2.0) * self.F3(a,a))) Ixcom = Ix - self.Mass*(zcom**2.0) self.relInertia = np.mat([[Ixcom,0.0,0.0], [0.0,Iycom,0.0], [0.0,0.0,Izcom]]) if self.alignment == 'AP': # rearrange to anterior-posterior orientation self.relInertia = inertia.rotate3_inertia( inertia.rotate3([0,0,np.pi/2]),self.relInertia)
def calc_properties(self): '''Calculates the segment's center of mass with respect to the fixed human frame origin (in the fixed human reference frame) and the segment's inertia in the fixed human frame but about the segment's center of mass. ''' # center of mass self.COM = self.pos + self.RotMat * self.relCOM # inertia in frame f w.r.t. segment's COM self.Inertia = inertia.rotate3_inertia(self.RotMat, self.relInertia) # an alternative way of calculating absolute inertia tensor, # implemented for validation purposes. # inertia in frame f w.r.t. segment's COM self.Inertia2 = np.mat(np.zeros((3, 3))) for s in self.solids: dist = s.COM - self.COM self.Inertia2 += np.mat(inertia.parallel_axis( s.Inertia, s.Mass, [dist[0, 0], dist[1, 0], dist[2, 0]]))