def test_markAdoptedSets(): # Set's. fus = osim.FunctionSet() fu1 = osim.Constant() fus.adoptAndAppend(fu1) del fus del fu1 gs = osim.GeometrySet() dg = osim.DisplayGeometry() gs.adoptAndAppend(dg) del gs del dg s = osim.ScaleSet() o = osim.Scale() s.adoptAndAppend(o) del s del o s = osim.ForceSet() o = osim.BushingForce() s.adoptAndAppend(o) del s del o cs = osim.ControllerSet() csc = osim.PrescribedController() cs.adoptAndAppend(csc) del cs del csc s = osim.ContactGeometrySet() o = osim.ContactHalfSpace() s.adoptAndAppend(o) del s del o s = osim.AnalysisSet() o = osim.MuscleAnalysis() s.adoptAndAppend(o) del s del o s = osim.ControlSet() o = osim.ControlLinear() s.adoptAndAppend(o) del s del o s = osim.MarkerSet() o = osim.Marker() s.adoptAndAppend(o) del s del o s = osim.BodySet() o = osim.Body() s.adoptAndAppend(o) del s del o s = osim.BodyScaleSet() o = osim.BodyScale() s.adoptAndAppend(o) del s del o s = osim.CoordinateSet() o = osim.Coordinate() s.adoptAndAppend(o) del s del o s = osim.JointSet() o = osim.BallJoint() s.adoptAndAppend(o) del s del o s = osim.PathPointSet() o = osim.PathPoint() s.adoptAndAppend(o) del s del o s = osim.IKTaskSet() o = osim.IKMarkerTask() s.adoptAndAppend(o) del s del o s = osim.MarkerPairSet() o = osim.MarkerPair() s.adoptAndAppend(o) del s del o s = osim.MeasurementSet() o = osim.Measurement() s.adoptAndAppend(o) del s del o # TODO # s = osim.ProbeSet() # o = osim.Umberger2010MuscleMetabolicsProbe() # s.adoptAndAppend(o) # del s # del o s = osim.ConstraintSet() a = osim.Model() body = osim.Body('body', 1.0, osim.Vec3(0, 0, 0), osim.Inertia(0, 0, 0)) loc_in_parent = osim.Vec3(0, -0, 0) orient_in_parent = osim.Vec3(0, 0, 0) loc_in_body = osim.Vec3(0, 0, 0) orient_in_body = osim.Vec3(0, 0, 0) joint = osim.WeldJoint("weld_joint", a.getGroundBody(), loc_in_parent, orient_in_parent, body, loc_in_body, orient_in_parent) a.addBody(body) constr = osim.ConstantDistanceConstraint() constr.setBody1ByName("ground") constr.setBody1PointLocation(osim.Vec3(0, 0, 0)) constr.setBody2ByName("body") constr.setBody2PointLocation(osim.Vec3(1, 0, 0)) constr.setConstantDistance(1) s.adoptAndAppend(constr)
def test_markAdoptedSets(self): # Set's. fus = osim.FunctionSet() fu1 = osim.Constant() fus.adoptAndAppend(fu1) del fus del fu1 s = osim.ScaleSet() o = osim.Scale() s.adoptAndAppend(o) del s del o s = osim.ControlSet() o = osim.ControlLinear() s.adoptAndAppend(o) del s del o s = osim.BodyScaleSet() o = osim.BodyScale() s.adoptAndAppend(o) del s del o s = osim.PathPointSet() o = osim.PathPoint() s.adoptAndAppend(o) del s del o s = osim.IKTaskSet() o = osim.IKMarkerTask() s.adoptAndAppend(o) del s del o s = osim.MarkerPairSet() o = osim.MarkerPair() s.adoptAndAppend(o) del s del o s = osim.MeasurementSet() o = osim.Measurement() s.adoptAndAppend(o) del s del o s = osim.FrameSet() o = osim.Body() s.adoptAndAppend(o) del s del o s = osim.ForceSet() o = osim.CoordinateLimitForce() s.adoptAndAppend(o) del s del o s = osim.ForceSet() o = osim.SpringGeneralizedForce() s.append(o) s = osim.ProbeSet() o = osim.Umberger2010MuscleMetabolicsProbe() s.adoptAndAppend(o) del s del o a = osim.Model() body = osim.Body('body', 1.0, osim.Vec3(0, 0, 0), osim.Inertia(0, 0, 0)) loc_in_parent = osim.Vec3(0, -0, 0) orient_in_parent = osim.Vec3(0, 0, 0) loc_in_body = osim.Vec3(0, 0, 0) orient_in_body = osim.Vec3(0, 0, 0) joint = osim.WeldJoint("weld_joint", a.getGround(), loc_in_parent, orient_in_parent, body, loc_in_body, orient_in_parent) a.addBody(body) constr = osim.ConstantDistanceConstraint() constr.setBody1ByName("ground") constr.setBody1PointLocation(osim.Vec3(0, 0, 0)) constr.setBody2ByName("body") constr.setBody2PointLocation(osim.Vec3(1, 0, 0)) constr.setConstantDistance(1) a.addConstraint(constr)
# Model Scaler scaleTool.getModelScaler().setApply(1) scaleTool.getModelScaler().setScalingOrder(osim.ArrayStr('measurements', 1)) scaleTool.getModelScaler().setMarkerFileName(TRC_file) scaleTool.getModelScaler().setTimeRange(TimeArray) scaleTool.getModelScaler().setPreserveMassDist(1) scaleTool.getModelScaler().setOutputModelFileName(scaled_MM_path) scaleTool.getModelScaler().setOutputScaleFileName(XML_SF_file) # The scale factor information concern the pair of marker that will be used # to scale each body in your model to make it more specific to your subject. # The scale factor are computed with the distance the virtual markers and between your experimental markers # Create a Marker Pair Set fo each body measurementTemp = osim.Measurement() bodyScaleTemp = osim.BodyScale() markerPairTemp = osim.MarkerPair() for i in range(0, nBody): # Create a Marker Pair Set markerPair = markerPairTemp.clone() markerPair.setMarkerName(0, markerPairList[i][0]) markerPair.setMarkerName(1, markerPairList[i][1]) # Create a Body Scale Set bodyScale = bodyScaleTemp.clone() bodyScale.setName(bodyNames[i][0]) # Name of the body bodyScale.setAxisNames(osim.ArrayStr('X Y Z', 1)) # Create a measurement