-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDrone_model.m
More file actions
34 lines (30 loc) · 977 Bytes
/
Drone_model.m
File metadata and controls
34 lines (30 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% JITENDRA SINGH
% India
% this code written for making the animation of Quadcoptor model, all units
% are in meters, in this code of example we are using 'HGtransform'
% function for animate the trajectory of quadcopter
% {Thanks to MATLAB}
close all
clear all
clc
%% 1. define the motion coordinates
tt = 0:0.03:6;
z = tt/2;
y = sin(2*tt);
x = cos(2*tt);
yaw = 1.2*tt;
roll = 5*sin(5*tt);
pitch = 5*cos(5*tt);
%% 6. animate by using the function makehgtform
% Function for ANimation of QuadCopter
drone_Animation(x,y,z,roll,pitch,yaw)
%% step5: Save the movie
%myWriter = VideoWriter('drone_animation', 'Motion JPEG AVI');
% myWriter = VideoWriter('drone_animation1', 'MPEG-4');
% myWriter.Quality = 100;
% myWritter.FrameRate = 120;
%
% % Open the VideoWriter object, write the movie, and class the file
% open(myWriter);
% writeVideo(myWriter, movieVector);
% close(myWriter);