Post · 2 min read· pp. 523–525

aerosandbox.dynamics.rigid_body.rigid_2D.body

Attributes

Classes

DynamicsRigidBody2DBodyDynamics instance:

Module Contents

class aerosandbox.dynamics.rigid_body.rigid_2D.body.DynamicsRigidBody2DBody(mass_props=None, x_e=0, z_e=0, u_b=0, w_b=0, theta=0, q=0) : Bases: aerosandbox.dynamics.rigid_body.rigid_3D.body_euler.DynamicsRigidBody3DBodyEuler

code
Dynamics instance:
\* simulating a rigid body
\* in 2D
\* with velocity parameterized in body axes

State variables:
:   x\_e: x-position, in Earth axes. [meters]
    z\_e: z-position, in Earth axes. [meters]
    u\_b: x-velocity, in body axes. [m/s]
    w\_b: z-velocity, in body axes. [m/s]
    theta: pitch angle. [rad]
    q: y-angular-velocity, in body axes. [rad/sec]

Control variables:
:   Fx\_b: Force along the body-x axis. [N]
    Fz\_b: Force along the body-z axis. [N]
    My\_b: Moment about the body-y axis. [Nm]

Parameters:
:   - **mass\_props** ([*aerosandbox.weights.mass\_properties.MassProperties*](/u/921f7ad402625b18#aerosandbox-weights-mass-properties-massproperties)) –
    - **x\_e** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) –
    - **z\_e** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) –
    - **u\_b** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) –
    - **w\_b** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) –
    - **theta** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) –
    - **q** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) –

mass\_props
:   For each state variable, self.state\_var = state\_var

    For each indirect control variable, self.indirect\_control\_var = indirect\_control\_var

    For each control variable, self.control\_var = 0

x\_e *= 0*

y\_e *= 0*

z\_e *= 0*

u\_b *= 0*

v\_b *= 0*

w\_b *= 0*

phi *= 0*

theta *= 0*

psi *= 0*

p *= 0*

q *= 0*

r *= 0*

Fx\_b *= 0*

Fy\_b *= 0*

Fz\_b *= 0*

Mx\_b *= 0*

My\_b *= 0*

Mz\_b *= 0*

hx\_b *= 0*

hy\_b *= 0*

hz\_b *= 0*

*property* state
:   Returns the state variables of this Dynamics instance as a Dict.

    Keys are strings that give the name of the variables.
    Values are the variables themselves.

    This method should look something like:
    :   ```default

{ "x_e": self.x_e, "u_e": self.u_e, ... }

code

    *property* control\_variables

    state\_derivatives()
    :   Computes the state derivatives (i.e. equations of motion) for a body in 3D space.

        Based on Section 9.8.2 of Flight Vehicle Aerodynamics by Mark Drela.

        Returns:
        :   {
            :   “xe” : d\_xe,
                “ye” : d\_ye,
                “ze” : d\_ze,
                “u” : d\_u,
                “v” : d\_v,
                “w” : d\_w,
                “phi” : d\_phi,
                “theta”: d\_theta,
                “psi” : d\_psi,
                “p” : d\_p,
                “q” : d\_q,
                “r” : d\_r,

            }

        Return type:
        :   Time derivatives of each of the 12 state variables, given in a dictionary

<a id="aerosandbox.dynamics.rigid_body.rigid_2D.body.dyn"></a> aerosandbox.dynamics.rigid\_body.rigid\_2D.body.dyn