Help with Aero.Body

2 次查看(过去 30 天)
Marcus
Marcus 2014-2-18
回答: magicwuchao 2014-11-28
Hi,
I am trying to work with Aero.Body and am not quite getting the results that I expected. First of all, I do not want to work with animations or FlightGear. I want to work with Aero.Body because I can plot in a typical figure. Animations plot in a different figure resulting in a loss of reference. I don't want to work with FlightGear because I have additional bodies to plot, a trajectory composed of multiple parts, which is hard to get into FlightGear.
I was able to plot a reference geometry file but using the move function with the geometry is giving bad results. The part comes in rotated in the roll axis by 90 degrees which means that roll,pitch,yaw values I enter are wrong. I have tried for 2 days now to figure out the transforms with no luck. I simply want to take in the geometry, set it to a position of 0,0,0 and then use the move function to properly update roll/pitch/yaw in a 3-2-1 fashion. Can someone please help me with this. Here is what I have so far:
h = Aero.Body;
h.load('pa24-250_orange.ac','Ac3d');
f = figure;
ax = axes;
h.generatePatches(ax);
%Here we see that the aircraft is rolled 90 degrees
xlabel('North [m]')
ylabel('East [m]')
zlabel('Alt [m]')
axis equal
set(gca,'YDir','reverse')
grid on
newPos = [0 0 0];
newRot = [0 0 0];
h.move(newPos,newRot)
%The objective is to get the attitude level
newPos = [0 0 0];
newRot = [-pi/2 0 0];
h.move(newPos,newRot)
%This results in the correct attidue
%Now apply additional rotations for verification, change heading first
newPos = [0 0 0];
newRot = [-pi/2 0 pi/4];
h.move(newPos,newRot)
%The aircraft pitches down, this is not desired
%Now apply additional rotations for verification, change pitch next
newPos = [0 0 0];
newRot = [-pi/2 pi/4 0];
h.move(newPos,newRot)
%The aircraft changes heading, this is not desired
Unfortunately the move command does not return anything so I am unable to save the rotated reference frames. I have additionally tried to rotate the model in AC3D with no luck either.
Thanks

回答(1 个)

magicwuchao
magicwuchao 2014-11-28
Hi! I think the Coordinate Systems difinition will help you.
The matlab , flightgear and ac3d have different Coordinate Systems!

类别

Help CenterFile Exchange 中查找有关 Get Started with Aerospace Blockset 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by