Path: LunarMissions/LunarRHS
% Spacecraft attitude and orbit dynamics with a disturbance function.
This is a rigid body with an external force and torque input. The
position is in km. The gravity model is for a point mass. The force and
torque area constant across the integration time step.
The function fDist (which should be a pointer) is of the form
[force, torque] = MyFun( x, t, d )
You can add additional fields to d. force must be in N in the body frame
and torque in Nm in the body frame. This function allows you to add
forces and torques within the integration loop. This is required for
forces and torques that are functions of time or the state vector.
--------------------------------------------------------------------------
Form:
xDot = RHSLunarLander( x, t, d )
--------------------------------------------------------------------------
-------
Inputs
-------
x (20,1) State vector [r;v;q;w;m;inertia] (km,km/s,,rad/s,kg,kg-m^2)
t (1,1) Time (s)
d (1,1) Data structure for the simulation
.torque (3,1) External torque (Nm)
.thrust (1,1) Engine Thrust (N)
.uThrust (3,1) Unit vector in the body frame
.rThrust (3,1) Thrust position in the body frame
.inertia (3,3) Vehicle inertia (kg-m^2)
.inertia (3,3) Vehicle inertia (kg-m^2)
.massDry (1,1) Vehicle dry mass (kg)
.aGrav (1,1) Pointer to gravity function
-------
Outputs
-------
xDot (:,1) dx/dt
--------------------------------------------------------------------------
AerospaceUtils: Coord/QIToBDot Common: Database/Constant Common: Quaternion/QTForm Common: Time/Date2JD Common: Time/JD2000 Math: Linear/Cross Math: Linear/Mag Math: Linear/Skew
Back to the LunarMissions Module page