Skip to main content

Module free_body

Module free_body 

Source
Expand description

A free rigid body of fixed mass and inertia, with no design, motor or aerodynamics: the flight’s gravity, Earth rotation, rigid-body equations and integrator on a body a test gives.

It exists to fly published check cases whose bodies are not rockets, such as NASA’s dragless sphere and tumbling brick (NASA/TM-2015-218675, cases 1 to 3 and 6 to 10), through the code a rocket flies on. Nothing here is a second model: the weight and the Coriolis force come from the Environment’s Earth, as crate::dynamics takes them, the air and the wind from the environment at the height a rocket’s flight reads them at, the two accelerations from that module’s free-flight equations, and the steps from crate::integrator. A test holds the derivative to the one a coasting rocket’s flight evaluates at the same state.

The caller may add loads of its own (FreeBodyLoads): a force F through the center of mass and a moment M about it, in body axes, formed from the state, the air there and the velocity through it (LoadInputs). A check case’s constant drag or damping coefficient is such a load; the body has no aerodynamics of its own.

With the reference point at the center of mass, a constant mass m and a constant inertia I about it, and no load but gravity g, the Coriolis force and the caller’s, the equations of crate::dynamics reduce to Newton’s and Euler’s:

a  = g(x) − 2 Ω × v + q F / m
ω̇ = I⁻¹ (M − ω × I ω)
q̇ = ½ q ⊗ ω

x and v are the center of mass’s position and velocity in the launch frame L, Ω the Earth’s rate, q the attitude (body to L) and ω the angular velocity relative to L in body axes. As in a rocket’s flight, the Earth’s rate enters the translation only: the rotational equations treat L as inertial (the decision record on rigid-body flight, ADR-011). Source: the equations of motion on the page Rigid-body flight, which cites RocketPy’s derivation.

Structs§

FreeBody
A rigid body of fixed mass and inertia.
LoadInputs
What a free body’s loads are formed from at one state, read as a rocket’s flight reads them: the air and the wind at the center of mass’s height above mean sea level.
Loads
A force through the center of mass and a moment about it, in body axes.
NoLoads
No load but gravity and the Coriolis force.

Constants§

FREE_BODY_INERTIA_NOT_FINITE
SimError::Domain’s what for an inertia tensor with an entry that is not finite; the value is the entry.
FREE_BODY_INERTIA_NOT_POSITIVE
SimError::Domain’s what for an inertia tensor that is not positive definite; the value is the leading principal minor that is not positive.
FREE_BODY_INERTIA_NOT_SYMMETRIC
SimError::Domain’s what for an inertia tensor that is not symmetric; the value is the largest difference between an entry and its mirror, kg·m².
FREE_BODY_LOAD_NOT_FINITE
SimError::Domain’s what for a caller’s load with a component that is not finite; the value is the component.
FREE_BODY_MASS_REFUSED
SimError::Domain’s what for a mass that is not finite and positive.
FREE_BODY_TIME_REFUSED
SimError::Domain’s what for a sample time that is not finite, comes before the start or comes before the sample ahead of it; the value is the time, s.

Traits§

FreeBodyLoads
The loads a caller puts on a free body, formed at each state the integrator evaluates. Any Fn(&LoadInputs) -> Result<Loads, SimError> is one; NoLoads is none.