Here a template function for Euler integration is defined.
This function applies one Euler integration step to the state given in the kinematics argument.
The forces, moments and gravitation applied by the forcer are taken into account. Note that Euler integration steps are really simple, and in practice rather coarse. This function is meant to be a reference implementation, normally you would want a more sophisticated integration method like Runge Kutta.
The template parameter needs to stick to the following signature:
class MOD {
void derivative(
VectorE& xd,
double dt);
const Vector& X() const;
void setState(
const VectorE& newx);
};
- Parameters
-
model | State-carrying object, that can calculate its derivative. |
ws | Workspace. |
dt | Time step of the integration. |