1
0
mirror of https://gitlab.com/lander-team/lander-sim.git synced 2025-08-02 11:21:27 +00:00

Replace simPrototypeSTART.m

This commit is contained in:
Brendan McGeeney
2021-09-16 23:35:23 +00:00
parent 1025132497
commit 4b450c6083

View File

@@ -5,8 +5,8 @@ close all; clear all; clc;
% Initial Conditions
v0 = 0; % Initial Velocity (z) [m/s]
M0 = 1.2; % Initial Mass [kg]
yaw0 = 0; % Initial Yaw [deg]
pitch0 = 5; % Initial Pitch [deg]
yaw0 = 5; % Initial Yaw [deg]
pitch0 = 15; % Initial Pitch [deg]
roll0 = 0; % Initial Roll [deg]
p0 = 0; % Initial Angular Velocity (x) [deg/s]
q0 = 0; % Initial Angular Velocity (y) [deg/s]
@@ -22,7 +22,7 @@ tb = Tcurve(end, 1) - Tcurve(1, 1); % Bu
mdot = Mp / tb; % Mass Flow Rate [kg/s]
D = 0; % Drag [N]
stepSize = 0.001; % Simulation Step Size [s]
maxServo = 15; % Max Servo Rotation [deg]
maxServo = 15; % Max Servo Rotation [deg]
% Moment of Inertia / Mass
I11 = (1/12) * 0.5318^2 + 0.25 * 0.05105^2; % (1/12) * h^2 + 0.25 * r^2
@@ -31,8 +31,9 @@ I33 = 0.5 * 0.05105^2; % 0.
I = [I11 0 0; 0 I22 0; 0 0 I33]; % I divided by Mass... this is taken care of in Simulink since our mass isn't constant
%% Pre-Sim Calcs
K = calcLQR(I*M0); % LQR Gain Calcs
[h0, vb, burnStartTime] = burnStartTimeCalc(Tcurve, tb, M0, mdot, Mb, v0); % Burn Start Time Calc
K = calcLQR(I*M0) % LQR Gain Calcs
[h0, vb, burnStartTime] = burnStartTimeCalc(Tcurve, tb, M0, mdot, Mb, v0) % Burn Start Time Calc
h0 = 21;
simTime = burnStartTime + tb; % Simulation Time [s]
yaw0 = yaw0 * pi / 180; % Initial Yaw [rad]
@@ -128,7 +129,7 @@ for i = 1 : length(simOut.h.Data)
drawnow limitrate
% Write Animation to gif, set to zero when testing since its slow to render.
outframes = 50; % 50 is a nice default
outframes = 0; % 50 is a nice default
if outframes
% Write to the GIF File
if i == 1