DUECA/DUSIME
|
This is an example, using the RigidBody class as basis for implementation of equations of motion. More...
#include <PulsedBody.hxx>
Public Member Functions | |
PulsedBody (double dt) | |
Constructor. | |
~PulsedBody () | |
Destructor. | |
void | derivative (VectorE &xd, double dt_offset) |
Function needed for integration. | |
void | step () |
Function that does an integration step. | |
Public Member Functions inherited from RigidBody | |
RigidBody (double mass, double Jxx, double Jyy, double Jzz, double Jxy, double Jxz, double Jyz, int extrastates=0) | |
Simple constructor for a rigid body dynamics module. | |
~RigidBody () | |
Destructor. | |
void | initialize (double x, double y, double z, double u, double v, double w, double phi, double theta, double psi, double p, double q, double r) |
Initialize a state vector x. | |
void | derivative (VectorE &xd, double unused=0.0) |
Obtain and calculate the derivative, given sum of forces and moments and the gravitational field acting on the body. | |
template<class V > | |
void | derivative (V &xd, double unused=0.0) |
Obtain and calculate the derivative, given sum of forces and moments and the gravitational field acting on the body. | |
void | specific (Vector &sp) |
Calculate specific forces and moments, forces stored in elements 0, 1, and 2, moments in elements 3, 4 and 6. | |
void | zeroForces () |
Initialize sum of forces on the body to zero. | |
void | applyBodyForce (const Vector3 &Fb, const Vector3 &point) |
Apply a force expressed in body coordinates. | |
void | applyInertialForce (const Vector &Fi, const Vector &point) |
Apply a force expressed in inertial coordinates, at a specific body point, give in body coordinates. | |
void | applyBodyMoment (const Vector &M) |
Apply a moment expressed in body coordinates. | |
void | changeState (const Vector &dx) |
Change the state vector by a quantity dx. | |
void | addInertialGravity (const Vector &g) |
Add a gravitational field; 3 element vector, gravitation expressed in the inertial system. | |
void | setState (const Vector &newx) |
Put in a new state vector. | |
void | changeMass (const double dm) |
Add to the mass of the body. | |
void | setMass (const double newm) |
Set a new mass. | |
void | output () |
Calculate auxiliary outputs, V, \(\alpha\), \(\beta\), \(\phi\), \(\theta\) and \(\Psi\). | |
const Vector & | X () const |
Obtain the state, 13 elements. | |
const double | V () const |
Obtain speed. | |
const double | alpha () const |
Obtain alpha. | |
const double | beta () const |
Obtain beta. | |
const double | getMass () const |
Get current mass. | |
const double | phi () const |
Get euler angle phi. | |
const double | theta () const |
Get euler angle theta. | |
const double | psi () const |
Get euler angle psi. | |
const Matrix3 & | A () |
Get the transformation matrix, for transforming a vector in earth coordinates to one in the body's coordinate system. | |
Public Attributes | |
double | tau_e |
Time constant simulating the "engine" dynamics. | |
double | dt |
Size of time steps. | |
Vector | force |
For efficiency, auxiliary variable that represents a force vector. | |
Vector | fpoint |
Auxiliary variable, vector giving the point where the force is applied. | |
Vector | gravity |
Auxiliary variable, vector giving gravity. | |
RungeKuttaWorkspace | workspace |
Workspace for the RungeKutta integration. | |
Additional Inherited Members | |
Protected Attributes inherited from RigidBody | |
Vector | x |
State vector. | |
This is an example, using the RigidBody class as basis for implementation of equations of motion.
The PulsedBody class derives from RigidBody, and applies forces on the RigidBody object. Using a Runge Kutta integration, the states of the RigidBody object are integrated numerically.
PulsedBody::PulsedBody | ( | double | dt | ) |
void PulsedBody::derivative | ( | VectorE & | xd, |
double | dt_offset ) |
Function needed for integration.
This function will be called by the integrate_rungekutta() function. It calculates the derivative of the state vector.
xd | Derivative of the state vector |
dt_offset | Time offset for calculating the derivative. The integration routine might need the derivative of the state for time steps that are a fraction of the integration time step, e.g. for 0dt, 0.5dt and dt after the previous integration step. |
Vector PulsedBody::force |
For efficiency, auxiliary variable that represents a force vector.
Note that RigidBody uses eigen3 http://eigen.tuxfamily.org/ for matrix and vector operations. Vector is a typedef in the RigidBody header file, and defines a shortcut to the vector class used here.