如何使用 Aerospace Toolbox 为火箭创建动画
How do I create an animation for a rocket using the Aerospace Toolbox
如何在 MATLAB Aerospace Toolbox 中使用 xyz、滚动、俯仰、偏航和时间为火箭创建动画?
这是一些示例数据:
x = 1.0e+06 .*[3.0138, 3.1345, 3.7675, 4.7347,6.1352];
y = 1.0e+07 .*[-1.8160,-1.8244,-1.8326,-1.8232,-1.7877];
z = 1.0e+07 .*[0.9917,0.9980,1.0119,1.0218,1.0261];
r =[ 0,0,0.0046,0.0046,0.0046];
p =[ 89.9900,26.6402,22.4665,16.0608,3.6879];
y =[86.7370,86.7370,86.7810,86.7810,86.7810];
t =[0,95,186,282,380];
这是我目前尝试过的方法:
data = [x',y',z',r',p',y',t'];
h=Aero.Animation;
f=figure;
h.Figure=f;
h.initialize();
h.FramesPerSecond=10
h.TimeScaling = 5;
idx1=h.createBody('delta2.ac','ac');
h.show()
h.bodies{1}.TimeseriesSourceType='Array6DoF';
h.bodies{1}.timeseriesSource=data;
h.Camera.offset=[-150 -150 0];
h.show()
h.VideoRecord = 'on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI'
h.VideoFilename = 'rocket trajectory';
h.play()
h.VideoRecord='off';
然而,当我尝试 运行 数据时,火箭不会旋转或平移。
使用以下代码创建了一个工作动画:
6dof 数据应采用以下格式作为数组:[ time, lat, lon, alt, phi , theta, psi]
确保 phi、theta、psi 的单位是弧度而不是度数。
%sixdof_data = [time,lat,long,alt,phi,theta,psi]; % This is if you have data saved as variables
h = Aero.Animation;
h.FramesPerSecond = 20;
h.TimeScaling = 10;
h.createBody('delta2.ac');
h.bodies{1}.TimeseriesSourceType='Array6DoF';
h.Bodies{1}.TimeSeriesSource = sixdof_data;
h.Camera.PositionFcn = @staticCameraPosition;
h.Camera.ViewAngle = 6;
h.show();
h.VideoRecord = 'on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI';
h.VideoFilename = 'rocket trajectory'
h.play();
有用的文档:
https://www.mathworks.com/help/aerotbx/ug/playaero.flightgearanimation.html
下面是一些应该有效的示例数据:
sixdof_data =[
0 28.534 279.43 2.8871e-09 0 1.5706 1.6397
73 28.529 279.51 23057 0 0.88894 1.6397
148 28.478 280.3 1.6241e+05 0 0.70976 1.6397
220 28.36 281.87 3.8062e+05 8.3012e-05 0.44196 1.6405
294 28.185 283.85 5.206e+05 8.3012e-05 0.38282 1.6405
368 27.936 286.3 5.9145e+05 8.3012e-05 0.32057 1.6405
443 27.575 289.41 6.137e+05 8.3012e-05 0.20756 1.6405
517 27.055 293.39 6.0892e+05 8.3012e-05 0.094718 1.6405]
如何在 MATLAB Aerospace Toolbox 中使用 xyz、滚动、俯仰、偏航和时间为火箭创建动画?
这是一些示例数据:
x = 1.0e+06 .*[3.0138, 3.1345, 3.7675, 4.7347,6.1352];
y = 1.0e+07 .*[-1.8160,-1.8244,-1.8326,-1.8232,-1.7877];
z = 1.0e+07 .*[0.9917,0.9980,1.0119,1.0218,1.0261];
r =[ 0,0,0.0046,0.0046,0.0046];
p =[ 89.9900,26.6402,22.4665,16.0608,3.6879];
y =[86.7370,86.7370,86.7810,86.7810,86.7810];
t =[0,95,186,282,380];
这是我目前尝试过的方法:
data = [x',y',z',r',p',y',t'];
h=Aero.Animation;
f=figure;
h.Figure=f;
h.initialize();
h.FramesPerSecond=10
h.TimeScaling = 5;
idx1=h.createBody('delta2.ac','ac');
h.show()
h.bodies{1}.TimeseriesSourceType='Array6DoF';
h.bodies{1}.timeseriesSource=data;
h.Camera.offset=[-150 -150 0];
h.show()
h.VideoRecord = 'on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI'
h.VideoFilename = 'rocket trajectory';
h.play()
h.VideoRecord='off';
然而,当我尝试 运行 数据时,火箭不会旋转或平移。
使用以下代码创建了一个工作动画:
6dof 数据应采用以下格式作为数组:[ time, lat, lon, alt, phi , theta, psi]
确保 phi、theta、psi 的单位是弧度而不是度数。
%sixdof_data = [time,lat,long,alt,phi,theta,psi]; % This is if you have data saved as variables
h = Aero.Animation;
h.FramesPerSecond = 20;
h.TimeScaling = 10;
h.createBody('delta2.ac');
h.bodies{1}.TimeseriesSourceType='Array6DoF';
h.Bodies{1}.TimeSeriesSource = sixdof_data;
h.Camera.PositionFcn = @staticCameraPosition;
h.Camera.ViewAngle = 6;
h.show();
h.VideoRecord = 'on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI';
h.VideoFilename = 'rocket trajectory'
h.play();
有用的文档: https://www.mathworks.com/help/aerotbx/ug/playaero.flightgearanimation.html
下面是一些应该有效的示例数据:
sixdof_data =[
0 28.534 279.43 2.8871e-09 0 1.5706 1.6397
73 28.529 279.51 23057 0 0.88894 1.6397
148 28.478 280.3 1.6241e+05 0 0.70976 1.6397
220 28.36 281.87 3.8062e+05 8.3012e-05 0.44196 1.6405
294 28.185 283.85 5.206e+05 8.3012e-05 0.38282 1.6405
368 27.936 286.3 5.9145e+05 8.3012e-05 0.32057 1.6405
443 27.575 289.41 6.137e+05 8.3012e-05 0.20756 1.6405
517 27.055 293.39 6.0892e+05 8.3012e-05 0.094718 1.6405]