package
RigidBody
Reusable rigid-body dynamics
State and forces
State stores world position, body velocity, a scalar-first body-to-world quaternion and body angular velocity. Wrench supplies non-gravity body force and body torque. Gravity is applied by the dynamics in world negative z.
Use stateDerivative for an explicit vector field or extend RigidBody6DOF for a continuous Modelica plant. Mass must be positive and inertia symmetric positive definite.
Level hover example
model LevelHover
extends RigidBody.RigidBody6DOF(mass=1.5);
equation
F_b = {0,0,mass*g};
M_b = zeros(3);
end LevelHover;
At the default level orientation and zero initial motion, thrust balances gravity. Add vehicle forces in a derived model rather than including gravity in F_b a second time. Energy and power helpers support independent checks of force, velocity and frame conventions.
Members
| Name | Kind | Description |
|---|---|---|
| State | record | Rigid-body state in world position and body velocity coordinates |
| StateDerivative | record | Derivative corresponding to RigidBody.State |
| Wrench | record | External non-gravity wrench expressed in the body frame |
| Twist | record | Body-frame flow variable power-conjugate to RigidBody.Wrench |
| Parameters | record | Physical parameters used by the pure rigid-body vector field |
| validParameters | function | Physical-domain predicate for mass, gravity, and symmetric positive-definite inertia |
| worldPositionRate | function | World-position component of the rigid-body vector field |
| bodyVelocityRate | function | Body-velocity component of the rigid-body vector field |
| attitudeRate | function | Quaternion component of the rigid-body vector field |
| bodyAngularVelocityRate | function | Body-angular-velocity component of the rigid-body vector field |
| stateDerivativeComponents | function | Array outputs of the pure rigid-body vector field for equation-based models |
| stateDerivative | function | Pure rigid-body vector field shared by simulation and formal analysis |
| kineticEnergy | function | Translational plus rotational kinetic storage |
| potentialEnergy | function | Uniform-gravity potential energy with world z upward |
| mechanicalEnergy | function | Rigid-body mechanical storage function |
| bodyTwist | function | Extract the power-port flow variable from a rigid-body state |
| portPower | function | Bilinear wrench/twist supply rate |
| wrenchPower | function | Supply rate for a body-frame wrench |
| powerBalanceResidual | function | Mechanical-energy rate minus wrench supply; zero certifies lossless passivity |
| RigidBody6DOF | model | Six-degree-of-freedom rigid body |
| Examples | package |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
package RigidBody "Reusable rigid-body dynamics"
annotation(uses(LieGroups, LinearAlgebra),
Documentation(info = "<html>
<h4>State and forces</h4>
<p><a href=\"modelica://RigidBody.State\">State</a> stores world position, body
velocity, a scalar-first body-to-world quaternion and body angular velocity.
<a href=\"modelica://RigidBody.Wrench\">Wrench</a> supplies non-gravity body force
and body torque. Gravity is applied by the dynamics in world negative z.</p>
<p>Use <a href=\"modelica://RigidBody.stateDerivative\">stateDerivative</a> for an
explicit vector field or extend
<a href=\"modelica://RigidBody.RigidBody6DOF\">RigidBody6DOF</a> for a continuous
Modelica plant. Mass must be positive and inertia symmetric positive definite.</p>
<h4>Level hover example</h4>
<pre>model LevelHover
extends RigidBody.RigidBody6DOF(mass=1.5);
equation
F_b = {0,0,mass*g};
M_b = zeros(3);
end LevelHover;</pre>
<p>At the default level orientation and zero initial motion, thrust balances
gravity. Add vehicle forces in a derived model rather than including gravity
in F_b a second time. Energy and power helpers support independent checks of
force, velocity and frame conventions.</p>
</html>"));
end RigidBody;