#!/usr/bin/env python # coding: utf-8 # # 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. # In[ ]: 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. # In[ ]: from sympy.physics.mechanics import inertia, RigidBody # We will need to specify some constants for the mass and inertia values. # In[ ]: from sympy import symbols # Once again, initalize SymPy printing so that we get nicely renderd symbols. # In[ ]: 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. # In[ ]: lower_leg_mass, upper_leg_mass, torso_mass = symbols('m_L, m_U, m_T') # In[ ]: lower_leg_mass # In[ ]: upper_leg_mass # In[ ]: 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. # In[ ]: 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. # In[ ]: lower_leg_inertia_dyadic = inertia(lower_leg_frame, 0, 0, lower_leg_inertia) # In[ ]: 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. # In[ ]: 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`. # In[ ]: lower_leg_central_inertia = (lower_leg_inertia_dyadic, lower_leg_mass_center) # The upper leg and torso inertias are found in the same fashion. # In[ ]: upper_leg_inertia_dyadic = inertia(upper_leg_frame, 0, 0, upper_leg_inertia) upper_leg_inertia_dyadic.to_matrix(upper_leg_frame) # In[ ]: 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. # In[ ]: torso_inertia_dyadic = # In[ ]: torso_central_inertia = # In[ ]: get_ipython().run_line_magic('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. # In[ ]: 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 # In[ ]: upper_leg = # In[ ]: torso = # In[ ]: get_ipython().run_line_magic('load', 'exercise_solutions/n04_inertia_define-rigid-body.py')