# Introduction

The next step is to provide some information about the mass and inertia of the bodies involved. Each of the three rigid bodies have both a mass which resists linear accelerations and inertia which resists rotational accelerations. In this notebook we will specify the mass of the three bodies, the inertia tensor/dyadic, and also create three `RigidBody` objects that hold all of the necessary information for each rigid body.

# Setup

First, we will import the results from the previous notebook. Even if you didn't get everything correctly working, the following import statement will bring in the correct solution so you can move forward. We will do this in all of the subsquent notebooks.


```python
from __future__ import print_function, division
from solution.kinematics import *
```

We will also need the function for easily generating inertial quantities and the `RigigBody` class so we can create some rigid bodies.


```python
from sympy.physics.mechanics import inertia, RigidBody
```

We will need to specify some constants for the mass and inertia values.


```python
from sympy import symbols
```

Once again, initalize SymPy printing so that we get nicely renderd symbols.


```python
from sympy.physics.vector import init_vprinting
init_vprinting(use_latex='mathjax', pretty_print=False)
```

# Mass

The masses of each rigid body can be represented by constant values, so we create a symbol for each body.


```python
lower_leg_mass, upper_leg_mass, torso_mass = symbols('m_L, m_U, m_T')
```


```python
lower_leg_mass
```


```python
upper_leg_mass
```


```python
torso_mass
```

# Inertia

Since we are studying a 2D planar problem, we are only concerned about the rotational inertia about the $\hat{i}_z$ axis. We will assume that the rigid bodies are symmetric about the $XZ$ and $YZ$ planes, so we only need a single variable for each rigid body to specify the rotation inertia.


```python
lower_leg_inertia, upper_leg_inertia, torso_inertia = symbols('I_Lz, I_Uz, I_Tz')
```

The `inertia()` function is a convenience function for creating inertia dyadics (i.e. basis dependent tensors). You specify a reference frame to define the inertia with respect to and at a minimum for symmetric bodies provide the diagonal entries of the inertia tensor. In our case the rotational inertia about the $x$ and $y$ are not neeed so they are set to zero and $z$ inertia entry is set to the defined variable.


```python
lower_leg_inertia_dyadic = inertia(lower_leg_frame, 0, 0, lower_leg_inertia)
```


```python
lower_leg_inertia_dyadic
```

In general, we store the inertia as dyadics, i.e. basis dependent tensors. If you want to see what the inertia is expressed in a particular frame, use the `to_matrix()` method.


```python
lower_leg_inertia_dyadic.to_matrix(lower_leg_frame)
```

We will also eventually need to know what point the inertia is defined with respect to. In our case, we will simply define all inertia's about the mass center. We can store the total information needed by PyDy in a tuple of an inertia `Dyadic` and a `Point`.


```python
lower_leg_central_inertia = (lower_leg_inertia_dyadic, lower_leg_mass_center)
```

The upper leg and torso inertias are found in the same fashion.


```python
upper_leg_inertia_dyadic = inertia(upper_leg_frame, 0, 0, upper_leg_inertia)
upper_leg_inertia_dyadic.to_matrix(upper_leg_frame)
```


```python
upper_leg_central_inertia = (upper_leg_inertia_dyadic, upper_leg_mass_center)
```

## Exercise

Create a tuple of an inertia `Dyadic` and `Point` for the torso.


```python
torso_inertia_dyadic =
```


```python
torso_central_inertia =
```


```python
%load exercise_solutions/n04_inertia_inertia-dyadic.py
```

# Rigid Bodies

To completely define a rigid body, the mass center point, the reference frame, the mass, and the inertia defined about a point must be specified.


```python
lower_leg = RigidBody('Lower Leg', lower_leg_mass_center, lower_leg_frame,
                      lower_leg_mass, lower_leg_central_inertia)
```

## Exercise

Create RigidBody objects for the upper leg and torso


```python
upper_leg = 
```


```python
torso = 
```


```python
%load exercise_solutions/n04_inertia_define-rigid-body.py
```

e14dcf4b37f2aa7a72f9f461d70c54b627b481e6
ipynb
Jupyter Notebook
notebooks/n04_inertia.ipynb
pydy/pydy-tutorial-human-standing
72b1d8513e339e9b10e501bd3490caa3fa997bc4
CC-BY-4.0
2015-05-19T15:24:18.000Z
2022-03-12T09:39:03.000Z
notebooks/n04_inertia.ipynb
pydy/pydy-tutorial-human-standing
72b1d8513e339e9b10e501bd3490caa3fa997bc4
CC-BY-4.0
2015-05-05T18:08:20.000Z
2022-01-28T11:12:42.000Z
notebooks/n04_inertia.ipynb
pydy/pydy-tutorial-pycon-2014
72b1d8513e339e9b10e501bd3490caa3fa997bc4
CC-BY-4.0
2015-06-16T01:50:51.000Z
2022-02-26T07:39:41.000Z
Qwen/Qwen-72B
1. YES
2. YES