Commit 32706b42 authored by yean's avatar yean
Browse files

New files for Simulink

parent 6d4d50be
function [] = animate_simulink_data(simData, params)
function [] = animate_simulink_data(simData, params, using_load)
%animate Animates the multirotor
% Inputs:
% simData
......@@ -7,7 +7,7 @@ function [] = animate_simulink_data(simData, params)
%% Some hardcoding before we smooth things out
% params.num_vehicles = 1;
using_load = true;
%using_load = true;
%% Process Input into simpler names
......
......@@ -14,5 +14,13 @@ function [] = plot_vec3(T,v,name)
plot(T,v(:,3));
ylabel('z-dir');
xlabel('Time (s)');
if strcmp(name, 'Xd Load')
movegui('southwest');
elseif strcmp(name, 'Xd Load Control')
movegui('south');
elseif strcmp(name, 'X Load')
movegui('southeast');
end
end
......@@ -37,7 +37,7 @@ plot_vec3(simData.tout, simData.payload_X,'X Load');
% plot_force(simData.tout, simData.q1_F_drag, 'Q1 Drag_V');
%% Animate
animate_simulink_data(simData, params);
animate_simulink_data(simData, params, true);
......
......@@ -10,12 +10,21 @@ addpath(genpath(pwd));
%% Set up Parameters
traj_num = 1;
params = setUpParameters(traj_num);
params.num_vehicles = 1;
%% TODO Everything
%% Load Top Level Simulink Model (helps Simulink load ahead of time)
open('singlequadrotor');
%% Call Simulink and Run the Simulation
simData = sim('singlequadrotor','StartTime','0','StopTime',num2str(params.tFinal));
%% Plot
plot_vec3(simData.tout, simData.Xd_load,'Xd Load');
plot_vec3(simData.tout, simData.Xd_load_control,'Xd Load Control');
%% Animate
animate_simulink_data(simData, params, false);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment