Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

In this problem, we will use the OpenSim API to check the solution to problem 7.3 Introduction to transformation matrices. (If you haven't completed that problem yet, please start there.)

(a) Download and install OpenSim.

(b) Read the Common Scripting Commands and Scripting in the GUI pages in the OpenSim documentation.

(c) Define frame A and point p in a model. You can do this by writing a script that creates a new model, or you could add components to an existing model. For simplicity, the instructions here will add components to the arm26 model. First, open arm26.osim. Next, type the following in the ScriptingShell Window, filling in the missing information as indicated:

model  = getCurrentModel()
sphere = modeling.Sphere(0.02)
transA = modeling.Transform( modeling.Vec3(a,b,c) )  #fill in a,b,c
frameA = modeling.PhysicalOffsetFrame(model.getGround(), transA)
frameA.setName('frameA')
model.addComponent(frameA)
frameA.attachGeometry(sphere)
m = modeling.Marker('p', frameA, modeling.Vec3(a,b,c) )  #fill in a,b,c
model.addMarker(m)
model.finalizeConnections()
model.print('step1.osim')

(d) Close the arm26 model and open step1.osim. You will see a sphere at the origin of frame A and a marker at point p. Next, we will add frame B. Type the following in the ScriptingShell Window, filling in the missing information as indicated:

angle  = 0  #fill in the angle
rot    = modeling.Rotation(angle, modeling.CoordinateAxis(2))  #Note: CoordinateAxis(2) refers to the Z-axis
transB = modeling.Transform(rot, modeling.Vec3(a,b,c))  #fill in a,b,c
frameA = model.getComponent('frameA')
frameA = modeling.PhysicalOffsetFrame.safeDownCast(frameA)
frameB = modeling.PhysicalOffsetFrame(frameA, trans)
frameB.setName('frameB')
model.addComponent(frameB)
model.finalizeConnections()
model.print('step2.osim')





.


 Solution (only visible by instructors; please contact us to request access)

Unable to render {include} The included page could not be found.

  • No labels