function
RigidBody.bodyAngularVelocityRate
Body-angular-velocity component of the rigid-body vector field
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | state | RigidBody.State | | |
| input | wrench | RigidBody.Wrench | | |
| input | parameters | RigidBody.Parameters | | |
| output | rate | Real | [3] |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function bodyAngularVelocityRate
"Body-angular-velocity component of the rigid-body vector field"
input RigidBody.State state;
input RigidBody.Wrench wrench;
input RigidBody.Parameters parameters;
output Real rate[3];
protected
Real rightHandSide[3, 1];
Real solution[3, 1];
Boolean accepted;
algorithm
rightHandSide[:, 1] := wrench.bodyTorque
- cross(state.bodyAngularVelocity,
parameters.inertia * state.bodyAngularVelocity);
(solution, accepted) := LinearAlgebra.solveSPD(
parameters.inertia, rightHandSide);
assert(accepted, "Rigid-body inertia must be symmetric positive definite");
rate := solution[:, 1];
end bodyAngularVelocityRate;