I was wondering if it could be a geometry problem? The exact model worked fine when the dimensions of the CAD file were not scaled
I mean to say I scaled the geometries on CAD to 100 times smaller to make it in tune with the opensim anatomy geometries for later use
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSimDocument Version="30000">
<Model name="VisualisingCAD">
<credits>Frank Anderson, Peter Loan, Ayman Habib, Ajay Seth, Michael Sherman</credits>
<publications>Unassigned</publications>
<length_units>meters</length_units>
<force_units>N</force_units>
<!--Acceleration due to gravity.-->
<gravity> 0 0 0</gravity>
<!--Bodies in the model.-->
<BodySet>
<objects>
<Body name="ground">
<mass>0</mass>
<mass_center> 0 0 0</mass_center>
<inertia_xx>1</inertia_xx>
<inertia_yy>1</inertia_yy>
<inertia_zz>1</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
<!--Joint that connects this body with the parent body.-->
<Joint />
<VisibleObject>
<!--Set of geometry files and associated attributes, allow .vtp, .stl, .obj-->
<GeometrySet>
<objects>
<DisplayGeometry>
<!--Name of geometry file .vtp, .stl, .obj-->
<geometry_file>plane.vtp</geometry_file>
<!--Color used to display the geometry when visible-->
<color> 1 1 1</color>
<!--Name of texture file .jpg, .bmp-->
<texture_file />
<!--in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded-->
<display_preference>0</display_preference>
<!--Display opacity between 0.0 and 1.0-->
<opacity>1</opacity>
</DisplayGeometry>
</objects>
<groups />
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Whether to show a coordinate frame-->
<show_axes>false</show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries-->
<display_preference>0</display_preference>
</VisibleObject>
<WrapObjectSet>
<objects />
<groups />
</WrapObjectSet>
</Body>
<Body name="A">
<mass>10</mass>
<mass_center> 0 0 0</mass_center>
<inertia_xx>1</inertia_xx>
<inertia_yy>1</inertia_yy>
<inertia_zz>1</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
<!--Joint that connects this body with the parent body.-->
<Joint>
<WeldJoint name="AToGround">
<!--Name of the parent body to which this joint connects its owner body.-->
<parent_body>ground</parent_body>
<!--Location of the joint in the parent body specified in the parent reference frame. Default is (0,0,0).-->
<location_in_parent>0 0 0</location_in_parent>
<!--Orientation of the joint in the parent body specified in the parent reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. Default is (0,0,0).-->
<orientation_in_parent>0 1.5 0</orientation_in_parent>
<!--Location of the joint in the child body specified in the child reference frame. For SIMM models, this vector is always the zero vector (i.e., the body reference frame coincides with the joint). -->
<location>0 0 0</location>
<!--Orientation of the joint in the owing body specified in the owning body reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. -->
<orientation>0 0 0</orientation>
<!--Set holding the generalized coordinates (q's) that parmeterize this joint.-->
<CoordinateSet>
<objects />
<groups />
</CoordinateSet>
<!--Whether the joint transform defines parent->child or child->parent.-->
<reverse>false</reverse>
</WeldJoint>
</Joint>
<VisibleObject>
<!--Set of geometry files and associated attributes, allow .vtp, .stl, .obj-->
<GeometrySet>
<objects>
<DisplayGeometry>
<!--Name of geometry file .vtp, .stl, .obj-->
<geometry_file>PartA.stl</geometry_file>
<!--Color used to display the geometry when visible-->
<color> 1 1 1</color>
<!--Name of texture file .jpg, .bmp-->
<texture_file />
<!--in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded-->
<display_preference>4</display_preference>
<!--Display opacity between 0.0 and 1.0-->
<opacity>1</opacity>
</DisplayGeometry>
</objects>
<groups />
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Whether to show a coordinate frame-->
<show_axes>false</show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries-->
<display_preference>4</display_preference>
</VisibleObject>
<WrapObjectSet>
<objects />
<groups />
</WrapObjectSet>
</Body>
<Body name="B">
<mass>10</mass>
<mass_center> 0 0 0</mass_center>
<inertia_xx>1</inertia_xx>
<inertia_yy>1</inertia_yy>
<inertia_zz>1</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
<!--Joint that connects this body with the parent body.-->
<Joint>
<FreeJoint name="BToA">
<!--Name of the parent body to which this joint connects its owner body.-->
<parent_body>A</parent_body>
<!--Location of the joint in the parent body specified in the parent reference frame. Default is (0,0,0).-->
<location_in_parent>0 0 0</location_in_parent>
<!--Orientation of the joint in the parent body specified in the parent reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. Default is (0,0,0).-->
<orientation_in_parent>0 0 0</orientation_in_parent>
<!--Location of the joint in the child body specified in the child reference frame. For SIMM models, this vector is always the zero vector (i.e., the body reference frame coincides with the joint). -->
<location>0 0 0</location>
<!--Orientation of the joint in the owing body specified in the owning body reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. -->
<orientation>0 0 0</orientation>
<!--Set holding the generalized coordinates (q's) that parmeterize this joint.-->
<CoordinateSet>
<objects>
<Coordinate name="BToA_xRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1.5707963267949 1.5707963267949</range>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<locked>true</locked>
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="BToA_yRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1.5707963267949 1.5707963267949</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="BToA_zRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1.5707963267949 1.5707963267949</range>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="BToA_xTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1 1</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="BToA_yTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-10 10</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="BToA_zTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-10 10</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
</objects>
<groups />
</CoordinateSet>
<!--Whether the joint transform defines parent->child or child->parent.-->
<reverse>false</reverse>
</FreeJoint>
</Joint>
<VisibleObject>
<!--Set of geometry files and associated attributes, allow .vtp, .stl, .obj-->
<GeometrySet>
<objects>
<DisplayGeometry>
<!--Name of geometry file .vtp, .stl, .obj-->
<geometry_file>PartBm.stl</geometry_file>
<!--Color used to display the geometry when visible-->
<color> 1 1 1</color>
<!--Name of texture file .jpg, .bmp-->
<texture_file />
<!--in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded-->
<display_preference>4</display_preference>
<!--Display opacity between 0.0 and 1.0-->
<opacity>1</opacity>
</DisplayGeometry>
</objects>
<groups />
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Whether to show a coordinate frame-->
<show_axes>false</show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries-->
<display_preference>4</display_preference>
</VisibleObject>
<WrapObjectSet>
<objects />
<groups />
</WrapObjectSet>
</Body>
<Body name="C">
<mass>10</mass>
<mass_center> 0 0 0</mass_center>
<inertia_xx>1</inertia_xx>
<inertia_yy>1</inertia_yy>
<inertia_zz>1</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
<!--Joint that connects this body with the parent body.-->
<Joint>
<FreeJoint name="CToB">
<!--Name of the parent body to which this joint connects its owner body.-->
<parent_body>B</parent_body>
<!--Location of the joint in the parent body specified in the parent reference frame. Default is (0,0,0).-->
<location_in_parent>0 -0.01 -0.0105</location_in_parent>
<!--Orientation of the joint in the parent body specified in the parent reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. Default is (0,0,0).-->
<orientation_in_parent>0 0 0</orientation_in_parent>
<!--Location of the joint in the child body specified in the child reference frame. For SIMM models, this vector is always the zero vector (i.e., the body reference frame coincides with the joint). -->
<location>0 0 0</location>
<!--Orientation of the joint in the owing body specified in the owning body reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. -->
<orientation>0 0 0</orientation>
<!--Set holding the generalized coordinates (q's) that parmeterize this joint.-->
<CoordinateSet>
<objects>
<Coordinate name="CToB_xRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1.5707963267949 1.5707963267949</range>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="CToB_yRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1.5707963267949 1.5707963267949</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>false</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="CToB_zRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1.5707963267949 1.5707963267949</range>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<locked>true</locked>
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="CToB_xTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-1 1</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="CToB_yTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-10 10</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
<Coordinate name="CToB_zTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-10 10</range>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>true</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
</objects>
<groups />
</CoordinateSet>
<!--Whether the joint transform defines parent->child or child->parent.-->
<reverse>false</reverse>
</FreeJoint>
</Joint>
<VisibleObject>
<!--Set of geometry files and associated attributes, allow .vtp, .stl, .obj-->
<GeometrySet>
<objects>
<DisplayGeometry>
<!--Name of geometry file .vtp, .stl, .obj-->
<geometry_file>PartCscaled.stl</geometry_file>
<!--Color used to display the geometry when visible-->
<color> 1 1 1</color>
<!--Name of texture file .jpg, .bmp-->
<texture_file />
<!--in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded-->
<display_preference>4</display_preference>
<!--Display opacity between 0.0 and 1.0-->
<opacity>0.38</opacity>
</DisplayGeometry>
</objects>
<groups />
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> 0 0 0 0 0 0</transform>
<!--Whether to show a coordinate frame-->
<show_axes>true</show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries-->
<display_preference>4</display_preference>
</VisibleObject>
<WrapObjectSet>
<objects />
<groups />
</WrapObjectSet>
</Body>
</objects>
<groups />
</BodySet>
<!--Constraints in the model.-->
<ConstraintSet>
<objects />
<groups />
</ConstraintSet>
<!--Forces in the model.-->
<!--Markers in the model.-->
<MarkerSet>
<objects />
<groups />
</MarkerSet>
<!--ContactGeometries in the model.-->
<ContactGeometrySet>
<objects>
<ContactMesh name="c_contact">
<!--Body name to connect the contact geometry to-->
<body_name>C</body_name>
<!--Location of geometry center in the body frame-->
<location>0 0.002376 -0.0182</location>
<!--Orientation of geometry in the body frame-->
<orientation>0 0 0</orientation>
<!--Filename that contain mesh geomtry (supports .obj, .stl, .vtp). Mesh should be closed and water-tight.-->
<filename>shaftscaled.obj</filename>
</ContactMesh>
<ContactMesh name="b_contact">
<!--Body name to connect the contact geometry to-->
<body_name>B</body_name>
<!--Location of geometry center in the body frame-->
<location>0 0 0</location>
<!--Orientation of geometry in the body frame-->
<orientation>0 0 0</orientation>
<!--Filename that contain mesh geomtry (supports .obj, .stl, .vtp). Mesh should be closed and water-tight.-->
<filename>PartBmNew.obj</filename>
</ContactMesh>
</objects>
<groups />
</ContactGeometrySet>
<ForceSet>
<objects>
<ElasticFoundationForce name="Shaft_B">
<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
<isDisabled>false</isDisabled>
<!--Material properties.-->
<ElasticFoundationForce::ContactParametersSet name="">
<objects>
<ElasticFoundationForce::ContactParameters name="">
<!--Names of geometry objects affected by these parameters.-->
<geometry>c_contact b_contact</geometry>
<stiffness>10000</stiffness>
<dissipation>0.1</dissipation>
<static_friction>0.5</static_friction>
<dynamic_friction>0.5</dynamic_friction>
<viscous_friction>0.5</viscous_friction>
</ElasticFoundationForce::ContactParameters>
</objects>
<groups />
</ElasticFoundationForce::ContactParametersSet>
<!--Slip velocity (creep) at which peak static friction occurs.-->
<transition_velocity>0</transition_velocity>
</ElasticFoundationForce>
</objects>
<groups />
</ForceSet>
<!--Controllers in the model.-->
<ControllerSet name="Controllers">
<objects />
<groups />
</ControllerSet>
<!--Additional components in the model.-->
<ComponentSet name="MiscComponents">
<objects />
<groups />
</ComponentSet>
<!--Probes in the model.-->
<ProbeSet>
<objects />
<groups />
</ProbeSet>
</Model>
</OpenSimDocument>