prev

next

out of 17

View

17Download

5

Embed Size (px)

DESCRIPTION

Models the human squat jump using symbolic python

Modeling a Squat Jump Using SymbolicPython

Albert Ai

August 27, 2015

Contents

1 Introduction 31.1 Modeling a Human Jump . . . . . . . . . . . . . . . . . . . . 31.2 Symbolic Python for Multibody Systems Reference Frames

and Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 Building the body . . . . . . . . . . . . . . . . . . . . . . . . . 41.5 Kanes Method . . . . . . . . . . . . . . . . . . . . . . . . . . 51.6 Equation of Motion . . . . . . . . . . . . . . . . . . . . . . . . 51.7 Impulse - Momentum Method . . . . . . . . . . . . . . . . . . 7

1

2 Programming and Implementation 102.1 Programming Details . . . . . . . . . . . . . . . . . . . . . . . 10

2.1.1 Libraries Used . . . . . . . . . . . . . . . . . . . . . . . 102.1.2 Details of Files and Functions . . . . . . . . . . . . . . 11

3 Programs and Functions 113.1 Body Part Object - BodyModel.py . . . . . . . . . . . . . . . 113.2 Body Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.3 Modeling the dynamics - BodyJumpForce.py . . . . . . . . . . 133.4 Graphical User Interface . . . . . . . . . . . . . . . . . . . . . 13

4 References 15

5 Acknowledgement 16

2

1 Introduction

There are two variations of the human vertical jump the countermovementjump, which involves a springing from a standing position to add potentialenergy, and the squat jump, which is a simple jump from a squatting position.This program was written in symbolic python to simulate the squat jumpvariation of the human jump.

1.1 Modeling a Human Jump

A human vertical jump is divided into two phases. In the first phase, thesubject rotates its body into a standing position while retaining a certainamount of upwards momentum, and in the second, uses the built up mo-mentum to launch itself into the air. The second phase is simple and can bemodeled as upwards projectile motion with any method of linear approxima-tion such as Eulers Method. However, the first phase is a lot more difficultto the fact it has multiple simultaneous moving components involved.

In the first phase, there are three degrees of freedom to worry about arotation at the ankle, knee, and hip. For simplicitys sake, I have modeled thesystem as three rotating rigid bodies and a static ankle as a fixed referenceframe, with three joints modeled as ideal torques between the adjacent bodyparts. For each joint, the required torque will be determined according tothe starting position of the human body and the mass of the segments at thestarting points.

1.2 Symbolic Python for Multibody Systems Refer-ence Frames and Symbols

The advantage of using a symbolic language such as SymPy for this project isthat it can break a complicated multibody rotating system down to a groupof reference frames with properties assigned to them. With parameters set,these reference frames can then be modeled using a wide number of existingsimulation modules built into SymPy. There are four reference frames inthe model the torso reference frame, upper leg reference frame, lower legreference frame, and a fixed inertial reference frame I chose to representthe ankle.

3

1.3 Kinematics

Using the ReferenceFrame module in SymPy, I can define the orientation ofeach frame relative to the other reference frames, along with an initial angularvelocity and acceleration. With the sympy.physics.mechanics library, I canautomatically calculate the linear and angular velocity of the center of massfor each frame as it rotates.

I start by setting the orientation of the lower leg relative to the fixed ankleframe. To do this, I first define a value for 1, 2, and 3, the flexion angles ofthe ankle, knee, and hip respectively. The built in ReferenceFrame.orient()function makes orienting the frames to each other simple. The functionrequires the following: input parameters of a fixed frame, initial rotationangle, and a directional vector about which to rotate. For this simulation, Ivechosen to start the movement by rotating the lower limb counter-clockwisealong the Z axis. The rotation matrices used for this are as follows:

Lower leg.dcm =

cos(1) sin(1) 0sin(1) cos(1) 00 0 1

I can then rotate the upper leg relative to the lower leg through the knee

flexion angle, 2. Adding the two angles flips the sign, causing it to rotateclockwise.

Upper leg.dcm =

cos(1 + 2) sin(1 + 2) 0sin(1 + 2) cos(1 + 2) 00 0 1

Likewise, the rotation matrix of the torso can be defined with a similar

rotation matrix about the Z direction.

Torso.dcm =

cos(1 + 2 + 3) sin(1 + 2 + 3) 0sin(1 + 2 + 3) cos(1 + 2 + 3) 00 0 1

1.4 Building the body

With a method to set the orientation of the 3 limbs created, I need to definethe positions of the various joints and center of masses in their referenceframes. I will use the ankle as a fixed point for the system, such that allother points in the system will be defined with respect to the ankle. Theknee joint K is then defined with respect to the ankle using a vector thatis equal to the length from the ankle to the knee, L1 in the direction of

4

the lower leg unit vector, iy. To do this, I needed to define a new con-stant length for the lower leg and to define the point of the knee K and theother pivot points. This can be easily done with the Point.setpos function,which returns the reference point along with the vector and can also be usedto express the returned vector with respect to another reference frame. Thus:

Vector of position of Knee in lower leg reference frame = Ll.iyVector of lower leg in Sole reference frame = Ll sin(1)ix+Ll cos(1)iy

In a similar fashion the hip is defined with respect to the knee.

Vector of position of Hip in Upper leg reference frame = Lu uy Position ofHip in Sole reference frame = (Llsin(1)Lusin(1 +2))ix+(Llcos(1)+Lucos(1 + 2))iy

1.5 Kanes Method

With the reference frames built, I used a computational method designedfor symbolic languages explicitly created to simplify and model multibodysystems Kanes method.

Kanes method as implemented in SymPy requires a set of generalizedspeeds w1, w2, w3 such that the time derivative of these generalized speedsare equal to their generalized coordinates. From there, the equations ofmotion can be easily derived in first order form. First, I create the timevarying symbols in Python:

n = n

n n = 0 :[1 1, 2 2, 3 3]

1.6 Equation of Motion

Now I can use the KanesMethod module, a built in function in SymPy foran automated computation of the first order differential equations. At abare minimum for unconstrained systems, KanesMethod in SymPy needsthe generalized coordinates, generalized speeds, the loads, the bodies, and aNewtonian reference frame.

5

First, I made a list of the generalized coordinates, i.e. the three joint angles:

coordinates = [1, 2, 3]

Then I listed the generalized speeds, i.e. the angular velocity:

speeds = [1, 2, 3]

Now I can use KanesMethod to build the object with the inertial refer-ence frame, coordinates, speeds, and kinematical differential equations:

[1 1, 2 2, 3 3]kane = KanesMethod(inertial frame, coordinates, speeds, kine-

matical differential equations)

The equations of motion can now be computed using the kanes equationsfunction, which takes the list of loads and bodies and returns the equationsof motion (i.e. first order ordinary differential equations) in Kanes form:

Fr + Fr = 0

Which is essentially equivalent to the classic Newton Euler form:

F = maT = I

With a reliable way of calculating the forces and torques, I can chooseone of several methods to calculate the trajectory of the jump. The methodI chose to calculate the jump for this project was the Impulse-momentummethod, detailed extensively in reference 1

6

1.7 Impulse - Momentum Method

7

Countermovement jump impulse-momentum curve:

Squat jump impulse-momentum curve:

8

The integral of a force over time is equal to a change to the momentumof a body,

J =Fdt = P

Applying this formula to the ground contact phase of the jump, startingfrom when the jumper is stationary with v = 0 and t = 0 to the instant oftakeoff where a = 0 gives

J =

(FGRF )mg)dt = mvi

The impulse due to the resultant force on the jumper may be consideredas two separate impulse: t2t1FGRFdt

t2t1mgdt = JGRF JBW = mvt0

These areas are shown in the figure below:

9

With the rotation angle and angular velocity of each segment updatedand summed using Kanes method, I have determined the inertia forces ofeach segment at the end of the first phase of the movement. With thesevalues stored, I can use the trapezoidal rule with the trapz function to cal-culate the vertical velocity in the last second of stage one. At the moment oftakeoff, the ground reaction force is equal to 0, which means the jump willbe the result of throwing the body into the air with a specific velocity. Themaximum height then, is determined using the equation below, which wascalculated at the beginning of the project.

Hmax =v2t02g

2 Programming and Implementation

This section describes the programming aspect of the squat jump model

2.1 Programming Details

The program was created with Symbolic Python as a core library. Thefollowing is a full list of libraries used.

2.1.1 Libraries Used

wxPython http://www.wxpython.org/ Python bindings to the wxWin-dows GUI cross-platform toolkit. All GUI files were created using thesimple wxPython builder.

mpmath http://mpmath.org mpmath is a Python library that calcu