Engineering Lab report - Matlab

profilesandOG
Lab2f18Introduction.pdf

BIOEN 4250: BIOMECHANICS I Laboratory 2 – Rigid Body Kinematics

September 11 – 14, 2018 TAs: Allen Lin ([email protected]), Kelly Smith ([email protected]) Lab Quiz: A 10-point lab quiz, which will count towards your lab grade, will be given at the beginning of

class. Be familiar with the entire protocol. Objective: The objective of this laboratory is to use a 3D electromagnetic digitizer to measure the kinematics

of a simplified mechanical surrogate of a knee joint (Figure 1) under passive flexion. The student will learn how this measurement technique works and how it can be combined with the equations of 3D rigid body kinematics to track the relative motion between two rigid bodies. The student will also learn how to decode a Matlab script for analysis of the data acquired during the lab.

Background: Kinematics is the branch of physics which involves the description of motion, without examining

the forces which produce the motion (dynamics or kinetics, on the other hand, involves an examination of both a description of motion and the forces which produce it). A subset of kinematics is that of rigid body kinematics, which as the name suggests, concerns the motions of one or more rigid bodies. A rigid body experiences zero deformation. In other words, all points lying on a rigid body experience no motion relative to each other.

In bioengineering, body segments are typically considered to be rigid bodies. These body

segments are tracked using a number of techniques such as goniometry, accelerometry, magnetic tracking, fluoroscopy, video systems, and stereo photogrammetry. The technique used in this lab utilizes an electromagnetic digitizer (a manually operated, instrumented wand with a probe on the end) to record the coordinates in 3D space of certain landmarks on the rigid bodies involved. The techniques used to analyze these captured 3D coordinates regarding the movement of these landmarks is very similar to the techniques utilized in the analysis of similar data obtained from video based stereo photogrammetry systems, commonly called photogrammetry. However, for the sake of time, we have bypassed the video analysis portion of the process for laboratory 2. In these visually based systems, which will be used in a laboratory 3, a number of markers are tracked using two or more calibrated video cameras. By placing markers on each body segment, the position and relative angles of each joint can be found. In the lab today, this same data will be gathered using the digitizer.

As a possible point of interest, these visual tracking

techniques are most renowned for their use in computer animation, where markers are placed on actors who are then videotaped by multiple cameras during a scene (see VICON Motion Capture Systems). The video data is then used to re-create the actor’s motions in computer animated characters. A collaborator of Dr. Jeffrey Weiss (faculty in BIOEN) actually received an Academy Award for using this technology in the production of The Lord of the Rings Trilogy and I-Robot. Photogrammetry is also used in clinical applications for gait analysis. For example, cerebral palsy patients are often analyzed using motion tracking systems in order to determine the abnormalities in their gait. So called “gait reports” are then given to clinicians who are often able to use this information to perform corrective surgeries. Finally, motion tracking of this

Figure 1: Experimental rig setup. The “L” shape pieces attached to the sides of the rig have 3 divots that will serve as kinematic marker clusters. In this image, the horizontal piece will represent the femur and the angled piece the tibia.

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

2

type is used in numerous research applications, such as tracking the motion of cadaver knees or generating data for input into a computational model.

Equipment: The following equipment will be required for each group. Note that there are only two digitizers.

Thus, each lab section will be divided into multiple time slots (and each time slot to 2 separate groups) in order to allow for smaller working groups.

• mechanical knee surrogate with mounting bracket • MicroScribe electromagnetic digitizer • allen (hex head) wrench, 3/16”; required for mounting and adjusting knee surrogate • digital calipers • goniometer or protractor • plastic ruler or tape measurer

Experimental Procedure:

Please read both handouts on Euler angles (located in the Handouts section on the Canvas page) and this entire document before the lab. This will help you prepare both for the quiz and the actual lab procedure.

1. Check to ensure the surrogate knee and mounting bracket are properly secured to the table (as shown in Figure 1).

2. Set the position of the surrogate knee at ~5° flexion (almost straight leg) with the two halves of the lower (tibial) portion of the fixture aligned.

3. Tighten the wing nut at the “knee” to be sure the fixture does not move. 4. Use the calipers, ruler, protractor, etc. to measure the distances between the indicated

points on the fixture, as well as the angle between the upper and lower segment of the surrogate. The list of measurements you need to take with the associated definitions is provided at the end of this document.

5. Using the MicroScribe digitizer, you will digitize the coordinates necessary to establish an embedded coordinate system in the upper segment of the fixture (femur) with respect to a coordinate system defined with the markers on the femoral kinematic marker cluster and repeat this process for the lower segment (tibia). The embedded coordinate systems should be set up to follow the conventions in the Coordinate System Conventions section below. Digitize the points on the fixture following the order listed at the end of this document in the section Order of Digitized Points (note that the points necessary to establish the embedded and marker coordinate systems are included in the list of points you need to digitize). The TAs will demonstrate the digitization process at the beginning of the lab.

6. Save the data file from the digitizer as “groupID_Position1.xlsx”. 7. Loosen the wing nut and rotate the “knee” to a position of approximately 30 ̊ flexion and

retighten the wing nut. Rotate the lower half of the lower section to the 2nd position (TA will demonstrate this).

8. Using the MicroScribe digitizer, digitize the points on the fixture in the same manner as Step 6. Please ask the TAs if you need clarification or help with the digitization process and/or order of points. The order of the digitized points should be the same in all three positions.

9. Save the data file from the digitizer as “groupID_Position2.xlsx”. 10. Loosen the wing nut and rotate the “knee” to a position of approximately 90 ̊ flexion and

retighten the wing nut (with the “tibial” section pointing to the floor). Rotate the lower half of the lower section to the 3rd position (TA will demonstrate this).

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

3

11. Using the MicroScribe, digitize the specified points on the fixture once more. Please ask the TAs if you need clarification or help with the digitization process and/or order of points. 
The order of the digitized points should be the same in all three positions.

12. Save the data file from the digitizer as “groupID_Position3.xlsx”. 13. Save all data onto your (or your labmate’s) CADE account and collect any hand-written

notes before leaving the laboratory. If the data was not saved under your CADE account, you are responsible for obtaining the data from your labmate. Each student should have:

• Three data files from the electromagnetic digitizer (“..._Position1.xlsx”, 
“..._Position2.xlsx”, and “..._Position3.xlsx”).

• Manually recorded measurements taken prior use of the digitizer at each of the three 
positions. This is particularly important for verifying the digitizer data during analysis.

• Your notes pertaining to where the coordinates were taken for the reference system, as well as what order the landmarks and “markers” were recorded with the digitizer.

Data Analysis:

The objective of the data analysis is to determine the transformation matrix between the femoral- and tibial-embedded coordinate systems, as well as the transformation matrix between the marker clusters. These transformation matrices will aid in determining the associated Euler angles during “knee” flexion/extension. Comparison of the calculated Euler angles from these two different transformation matrices will help to illustrate the benefit of going the extra step to find the embedded transformation matrices. You will be provided with a MATLAB program to perform the majority of the data analysis. Please see the instructions for the lab report for additional details on the expected plots/figures from analyzing the data and regarding the preparation of your report. The overall picture of the analysis is as follows:

1. Determine the 4x4 transformation matrix between a coordinate system embedded in the femur (𝑓𝑒) and a coordinate system defined using the femoral (upper segment) marker cluster (𝑓𝑚), 𝑻%&→%(. Note that this transformation never changes during the test, as both coordinate systems are affixed to the same rigid body. This matrix is calculated from the digitized data from Position #1.

2. Determine the 4x4 transformation matrix between a coordinate system defined using the

Figure 2: Definition of coordinate transformation matrices. Schematic shows medial view of right knee.

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

4

tibial (lower segment) marker cluster (𝑡𝑚) and a coordinate system embedded in the tibia (𝑡𝑒), 𝑻*(→*&. Note that this transformation also never changes during the test. This matrix is calculated from the digitized data from Position #1. While the tibia (lower segment) of our surrogate is not exactly a rigid body, due to the rotations between the two parts and such, we are going to pretend it is (assuming the entire segment rotates and translates during motion along with the associated “marker” points).

3. Determine the 4x4 transformation matrix between a coordinate system defined using the femoral (upper) marker cluster (𝑓𝑚) and a coordinate system defined using the tibial (lower) marker cluster (𝑡𝑚), [𝑻%(→*((𝑡)], for all positions. This matrix is calculated from the digitizer data from all three positions.

4. The overall transformation matrix between the embedded femoral and tibial coordinate systems is then:

[𝑻%&→*&(𝑡)] = [𝑻*(→*&][𝑻%(→*((𝑡)][𝑻%&→%(]

5. There are three clinical joint flexion angles (flexion/extension, abduction/adduction, tibial

rotation) and three translations (medial/lateral tibial displacement, anterior/posterior tibial displacement, joint distraction) typically seen during movement of an actual knee. We will be calculating the Euler angles associated with the motion based on the embedded transformation matrix[𝑻%&→*&(𝑡)], and the “marker” transformation matrix [𝑻%(→*((𝑡)]. These angles do not always coincide with the clinical angles so pay attention to the Euler angle handouts and the orientation of your various coordinate systems (in the coordinate systems section below). Also, feel free to ask your TA if you have any questions.

6. Based on the transformation matrixes [𝑻%&→*&(𝑡)] determined in the Matlab script, manually calculate the tibial distraction (should be close to the distance measured between the two tibial sections). Refer to the Trigonometry Review section below to get the general idea of how to do this. You may use whatever method you wish to do this calculation (Maple, Matlab, Excel, pencil and paper, etc.); however, be sure to indicate the method used, as well as provide a description of how it was done, in you report. Please note, this is not going to be just the value of the difference between the translation vector magnitudes from one position to the next. If you are unclear of the basic idea of how to calculate this, check with the TA. It will also be briefly touched on in the lab session.

7. Use whatever method you like to confirm angles of rotation you imposed (flexion/extension, and tibial rotation). This is why you took all those extra digitized points at positions 2 and 3. You will use these manual calculations for the discussion of your Euler angles and the translation vector component of the transformation matrices.

Figure 3: Representation of the “femur” embedded coordinate system orientation to be used for data analysis. Note that the axes are not unit axes and not to scale. The origin is inside the part.

Coordinate System Conventions:

Femoral Embedded Coordinate System The embedded coordinate system for the femur should be according to that illustrated in Figure 3. The origin of this coordinate system is located inside the part approximately equidistant from the 4 divots at the end closer to the hinge. In relation to anatomical reference terminology (proximal, medial, etc.) the hinge is considered to be the knee. So the origin is at the distal end of the “femur”, and the z-axis is positive in the proximal direction. This is considered to be a left knee, so the mounting bracket is on the lateral side and thus, the x-axis is positive in the medial direction. Tibial Embedded Coordinate System The embedded coordinate system for the tibia should be according to that illustrated in Figure 4. The origin of this coordinate system is located inside the part approximately equidistant from the 4 divots at the end closer to the hinge. In relation to anatomical reference terminology (proximal, medial, etc.) the hinge is considered to be the knee. So the origin is at the proximal end of the “tibia”, and the z-axis is positive in the proximal direction. This is considered to be a left knee, so, again, the mounting bracket is on the lateral side and thus, the x-axis is positive in the medial direction. “Marker” Coordinate Systems The “marker” coordinate systems are referred to in this way because they are filling the same roll that fiduciary markers would fill in a visually based kinematic tracking system. The data analysis for these markers will be very similar to that which would be done for visually tracked fiduciary markers, but will be much simplified by tracking manually digitized points on our fixture rather than incorporating vision tracking software. The coordinate systems for both sets of markers will be set up exactly the same and should be according to that illustrated in Figure 5. The origin of these coordinate systems is located at the “bottom” markers. In relation to anatomical reference terminology (proximal, medial, etc.), the x-axes will be positive in the distal direction, the y-axes will be positive in the anterior direction, and the z-axes will be positive in the medial direction.

Trigonometry Review:

This section should help give you a better idea of how to calculate the “tibial” distraction (translation along the axis of the lower segment of the fixture) for your lab report. Basically, all you need to do is make a triangle, and solve for the angles and the length of the sides. The triangle you are going to create is shown in Figure 6.

Figure 4: Representation of the “tibial” embedded coordinate system orientation to be used for data analysis. Note that the axes are not unit axes and not to scale. The origin is inside the part.

Figure 5: Representation of the “marker” embedded coordinate system orientation to be used for data analysis. Note that the axes are not unit axes and not to scale. The origin is located at the “bottom” marker location.

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

6

For the sake of the data analysis, let’s look at this same triangle closer up (Fig. 6). Solving of this triangle can be accomplished by the use of the sine rule:

𝑎

sin (𝐴) =

𝑏 sin(𝐵)

= 𝑐

sin (𝐶)

To construct this triangle a few pieces of information should be recognized:

- Side “𝑐” will be equivalent to the length of the y-z plane portion of the translation vector in [𝑻%&→*&(𝑡)] after that vector is
rotated back to the femur embedded coordinate system.

- Side “𝑏” does not change from position to position. - Side “𝑎” is equal to “𝑏” for Position #1, but is not for Position 2 and 3 (the difference

between “𝑎” and “𝑏” is the tibial distraction or the translation along the axis of the lower segment). The tibial distraction should be similar to the measured change in length of the lower segment during the test.

- Angle “𝐶” is equal to (180° flexion angle; flexion angle should be acquired from the Euler angles calculated in the provided code, not the angles you measured by hand.)

Given these assumptions, and observations, you should be able to determine the tibial distraction asked for in the report instructions. Please use a reasonable number of significant figures for your calculations.

Tips: Use your ruler measurements between the approximate origins of the coordinate systems as a

rudimentary way to verify the translations (this is not what is referred to in step 6 or 7). The components of the rotation matrix can be verified by computing the appropriate dot products between the coordinate axes. This yields the cosine of the angle between the axis for a quick check that the angles are approximately right.

It will be easiest to verify the transformation matrices if you stick to the conventions described

above for orientation of your axes. For instance, the coordinate systems section above always defines the embedded z-axis along the long direction of the bone (shaft), with positive in the proximal direction (toward the body). The embedded x-axis is always oriented medial-lateral, with the medial direction as positive. The embedded y-axis is always oriented anterior-posterior, with the anterior direction as positive.

When composing the transformation matrices, remember that you are looking for the

transformation that rotates/translates one set of axes into another. Make sure that you define your

Figure 6: Left – The triangle you need to make superimposed on an image of the fixture. Remember that the embedded origins are inside the parts under the divots. Right – Generic version of the triangle you need to make with the interior angles labeled with capital letters and lengths of the sides labeled in lowercase letters.

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

7

displacement vectors appropriately (i.e., don’t get them backwards).

For the manual calculations in step 6 and 7, try using Matlab to determine the following: - Confirm the flexion/extension angle by finding the change in angle between the vectors formed

between the anterior/posterior points on the two main shafts closer to the wingnut (for the “tibia” this would be the anterior/posterior points on the end that is not twisting). Remember Position #1 was not at 0° flexion.

- Confirm the tibial rotation angle by finding the change in angle between vectors formed between the anterior/posterior points at either end of the “tibia” segment.

- Determine the distraction along the axis of the tibial shaft by using the sine rule on a triangle that has its three vertices at the embedded femoral origin, embedded tibial origin, and the hinge (wing nut screw). With this triangle, you should always be able to determine at least one angle (Euler angle representing flexion angle determined from the transformation matrix by the code) and the length of two sides (1 – the distance from the embedded femur origin and screw does not change, and 2- you have the magnitude of the translation between the two origins from the transformation matrix). Hint: before trying to calculate this, it might be helpful to actually draw a triangle for each of the 3 positions.

- Remember that the dot product of two vectors is 𝒂 ∙ 𝒃 = |𝑎||𝑏|cos (𝜃), so do not forget to normalize the length of vectors when determining angles between them.

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

8

Measurement Sheet Name: ________________________________ UID: _______________ Group ID: __________________________________________________ Position #1 Flexion angle (measured): ______________________________________________________ Femur Distal Medial - Tibia Proximal Medial(in): _____________________________________ Tibial Rotation angle (degrees): __________________________________________________ *Note: Just make an estimate. This is fairly awkward to measure.

Femur Distal Posterior – Distal Anterior(in): _______________________________________________ Distal Lateral – Distal Medial (in): _________________________________________________ Proximal Posterior – Proximal Anterior(in): __________________________________________ Proximal Anterior – Distal Anterior (in): _____________________________________________ Tibia Distal Posterior – Distal Anterior(in): _______________________________________________ Proximal Lateral – Proximal Medial (in): ____________________________________________ Proximal Posterior – Proximal Anterior(in): __________________________________________ Proximal Anterior – Distal Anterior (in): _____________________________________________ Position #2 Flexion angle (measured): ______________________________________________________ Femur Distal Medial – Tibia Proximal Medial(in): _____________________________________ Tibial Rotation angle (degrees): __________________________________________________ *Note: Just make an estimate. This is fairly awkward to measure.

Femur Distal Posterior – Distal Anterior(in): _______________________________________________ Distal Lateral – Distal Medial (in): _________________________________________________ Proximal Posterior – Proximal Anterior(in): __________________________________________ Proximal Anterior – Distal Anterior (in): _____________________________________________ Tibia Distal Posterior – Distal Anterior(in): _______________________________________________ Proximal Lateral – Proximal Medial (in): ____________________________________________ Proximal Posterior – Proximal Anterior(in): __________________________________________ Proximal Anterior – Distal Anterior (inches – not including rotation): ______________________

Note: You could also just measure the gap with calipers and combine with your last measurement.

same as Position #1 same as Position #1

same as Position #1 same as Position #1

same as Position #1

same as Position #1

same as Position #1

BIOEN 4250: Laboratory 2 – Rigid Body Kinematics

9

Position #3 Flexion angle (measured): ______________________________________________________ Femur Distal Medial - Tibia Proximal Medial(in): ______________________________________ Tibial Rotation angle (degrees): __________________________________________________ *Note: Just make an estimate. This is fairly awkward to measure. Femur Distal Posterior – Distal Anterior(in): _______________________________________________ Distal Lateral – Distal Medial (in): _________________________________________________ Proximal Posterior – Proximal Anterior(in): __________________________________________ Proximal Anterior – Distal Anterior (in): _____________________________________________ Tibia Distal Posterior – Distal Anterior(in): _______________________________________________ Proximal Lateral – Proximal Medial (in): ____________________________________________ Proximal Posterior – Proximal Anterior(in): __________________________________________ Proximal Anterior – Distal Anterior (inches – not including rotation): ______________________

Note: You could also just measure the gap with calipers and combine with your last measurement.

Order of Digitized Points 1. Femur Marker Top 2. Femur Marker Bottom 3. Femur Marker Front 4. Tibia Marker Top 5. Tibia Marker Bottom 6. Tibia Marker Front 7. Frame Upper Back Corner 8. Frame Lower Back Corner 9. Frame Lower Front Corner 10. Femur Distal –Medial 11. Femur Distal – Lateral 12. Femur Distal – Posterior 13. Femur Distal – Anterior 14. Femur Proximal – Posterior 15. Femur Proximal – Anterior 16. Tibia Proximal – Medial 17. Tibia Proximal – Lateral 18. Tibia Proximal – Posterior 19. Tibia Proximal – Anterior 20. Tibia Distal – Posterior 21. Tibia Distal – Anterior

same as Position #1 same as Position #1

same as Position #1

same as Position #1 same as Position #1

same as Position #1 same as Position #1