#define PulsedBody_cxx
#include "PulsedBody.hxx"
#include <iostream>
RigidBody(100.0, 5.0, 6.0, 9.0, 0.0, 0.0, 0.0, 1),
tau_e(1.2),
dt(dt),
force(Vector::Zero(3)),
fpoint(Vector::Zero(3)),
gravity(Vector::Zero(3)),
workspace(14)
{
fpoint[2] = -1.0;
fpoint[0] = 1e-8;
gravity[2] = 9.810665;
}
{
}
{
xd[13] = (1330.0 -
x[13]) /
tau_e;
return;
}
{
cout <<
"psi=" <<
psi() <<
" theta=" <<
theta() <<
" phi=" <<
phi()
<<
" V=" <<
V() <<
" alpha=" <<
alpha() <<
" beta=" <<
beta() << endl;
Vector sp(6);
cout << sp << endl;
}
int main()
{
for (int ii = 1000; ii--; ) {
pb.step();
}
return 0;
}
This is an example, using the RigidBody class as basis for implementation of equations of motion.
Definition PulsedBody.hxx:30
Vector force
For efficiency, auxiliary variable that represents a force vector.
Definition PulsedBody.hxx:44
RungeKuttaWorkspace workspace
Workspace for the RungeKutta integration.
Definition PulsedBody.hxx:54
PulsedBody(double dt)
Constructor.
Vector fpoint
Auxiliary variable, vector giving the point where the force is applied.
Definition PulsedBody.hxx:48
double tau_e
Time constant simulating the "engine" dynamics.
Definition PulsedBody.hxx:34
Vector gravity
Auxiliary variable, vector giving gravity.
Definition PulsedBody.hxx:51
void derivative(VectorE &xd, double dt_offset)
Function needed for integration.
double dt
Size of time steps.
Definition PulsedBody.hxx:37
void step()
Function that does an integration step.
Rigid body dynamics function, calculates derivative of a rigid body, given sum of moments and forces ...
Definition RigidBody.hxx:108
void zeroForces()
Initialize sum of forces on the body to zero.
const double theta() const
Get euler angle theta.
Definition RigidBody.hxx:315
const double psi() const
Get euler angle psi.
Definition RigidBody.hxx:317
void specific(Vector &sp)
Calculate specific forces and moments, forces stored in elements 0, 1, and 2, moments in elements 3,...
const double beta() const
Obtain beta.
Definition RigidBody.hxx:307
const double phi() const
Get euler angle phi.
Definition RigidBody.hxx:313
const Vector & X() const
Obtain the state, 13 elements.
Definition RigidBody.hxx:298
const double V() const
Obtain speed.
Definition RigidBody.hxx:301
const double alpha() const
Obtain alpha.
Definition RigidBody.hxx:304
void derivative(VectorE &xd, double unused=0.0)
Obtain and calculate the derivative, given sum of forces and moments and the gravitational field acti...
void addInertialGravity(const Vector &g)
Add a gravitational field; 3 element vector, gravitation expressed in the inertial system.
void output()
Calculate auxiliary outputs, V, , , , and .
Vector x
State vector.
Definition RigidBody.hxx:114
void applyBodyForce(const Vector3 &Fb, const Vector3 &point)
Apply a force expressed in body coordinates.
void integrate_rungekutta(MOD &model, RungeKuttaWorkspace &ws, double dt)
This function applies one Runge Kutta integration step to the state given in the kinematics argument.
Definition integrate_rungekutta.hxx:88
print the IncoRole to a stream
Definition SimStateRequest.hxx:185