You are viewing the documentation for OpenSim 2.4. Are you looking for the latest OpenSim 4.0 Documentation?
Example - Model Editing
Purpose
In this example, you will add a body and an actuator to an existing OpenSim model by editing its xml file. Â You can find the model file (arm26.osim) in the examples folder under your OpenSim installation directory.
You will need to download an XML editor to work through this example. Â Some free options include:
- notepad++ (http://notepad-plus.sourceforge.net/uk/site.htm)
- XMLMarker (http://symbolclick.com/download.htm)
You can also download a pdf of this page by clicking on the Tools link in the top right corner and selecting "Export to PDF".
Connecting an Additional Segment to the Model
- Open Model File in XML. Use an XML editor (e.g., Notepad++) to open the OpenSim model file (e.g., arm26.osim). When collapsed to the 3rd level (e.g., Alt+3 in Notepad+), your model file should look like the figure below.
Â
- Explore the Model. The Model tag has five main sets named, ForceSet, BodySet, ConstraintSet, MarkerSet, and ContactGeometrySet.
- Explore the Body Set. The BodySet tag has three Body objects named ground, r_humerus, and r_ulna_radius_hand.
- Add New Body. Add a new Body named bucket immediately below the Body named r_ulna_radius_hand.
- Specify Mass Properties. Add tags and enter values for the mass, mass_center, inertia_xx, inertia_yy, inertia_zz, interia_xy, inertia_xz, and inertia_yz for the bucket as seen below:
- Specify Joint. Add tags and names for the PinJoint and parent_body, and tags and values for location_in_parent, orientation_in_parent, location, and orientation as seen below:
The location_in_parent and orientation_in_parent tags define the position and orientation of the joint with respect to the parent body origin. In the above example, the vector from the parent body r_ulna_radius_hand to the joint r_handle is [0.031 -0.031 0.07] and the orientation of the joint (in a zero pose) is exactly the same as the orientation of the parent body (in a zero pose). The location_in_parent and orientation_in_parent vectors should be given in the coordinate frame of the parent body. In most cases, the location_in_parent and orientation_in_parent tags are all that's required to specify the new joint (in which case, the child body origin, e.g., bucket, would be located at the joint center of r_handle). Additionally, the local location and orientation offset of the joint center with respect to the child body origin can be specified using the location and orientation tags. The above description of joints in OpenSim is illustrated here: JointReferenceFrames.jpgÂ
Â
- Specify Generalized Coordinate. Add a tag and name for the Coordinate, and add tags and values for motion type, default_value, default_speed_value, initial_value, range, clamped, and locked as seen below:
- Specify Geometry File. Add a tag for VisibleObject and add the appropriate tags for GeometrySet and other properties  as seen below:
- Specify DisplayGeometry including Geometry_File in the GeometrySet
- Save Model File. From the XML editor, save the OpenSim model file (e.g., arm26_with_bucket.osim). Now open your new model in OpenSim to see the bucket!
Â
Adding an Additional Actuator
Â
- Explore the ForceSet. The ForceSet tag has six Thelen2003Muscle objects named TRIlong, TRIlat, TRImed, BIClong, BICshort, and BRA.
- Add New Actuator. Add a CoordinateActuator object named r_handle_rot_force immediately below the Thelen2003Muscle named BRA. Associate this CoordinateActuator with the r_handle_rot coordinate and specify an optimal_force of 1000.
- Save Model File. From the XML editor, save the OpenSim model file (e.g., arm26_with_bucket.osim).
Â
Return to the list of Examples and TutorialsÂ
OpenSim is supported by the Mobilize Center , an NIH Biomedical Technology Resource Center (grant P41 EB027060); the Restore Center , an NIH-funded Medical Rehabilitation Research Resource Network Center (grant P2C HD101913); and the Wu Tsai Human Performance Alliance through the Joe and Clara Tsai Foundation. See the People page for a list of the many people who have contributed to the OpenSim project over the years. ©2010-2024 OpenSim. All rights reserved.