Sie sind auf Seite 1von 6

MKT4132

HW1

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59

Body-Fixed Frame to Earth-Fixed Frame Transformations

In this HW, it is expected you to do transformations to obtain the position and orientation of a rigid body with respect

to the Earth-fixed frame.

A set of data including the linear and angular velocities of a vehicle with respect to body-fixed frame is supplied with

this HW:

LinAngVel.mat (located in the Google Drive, shared through our web group)

The data was collected during the lane-change maneuver of a vehicle. By loading LinAngVel.mat file to the workspace of Matlab, you will get the LinAngVel matrix of 3000x6 dimension. The columns represent, u, v, w, p, q, and r velocities.

1. Draw the linear and angular velocities plots by following the figure format given below.

2. By applying the transformation matrices based on Euler angles, obtain the values of X, Y, Z, roll, pitch, and yaw. Draw X, Y, Z, roll, pitch, and yaw plots by following the figure format given below.

3. By applying the transformation matrices based on quaternions, obtain the values of X, Y, Z, roll, pitch, and yaw. Draw X, Y, Z, roll, pitch, and yaw plots by following the figure format given below.

4. Draw the trajectory of the vehicle on X-Y plane by using the code given below. For this case, initial position of the vehicle will be (X 0 , Y 0 , Z 0 ) = (10, 2, 0).

plygnx=[-0.05 0.05 0.1 0.05 -0.05 -0.05]; plygny=[0.05 0.05 0 -0.05 -0.05 0.05];

offst=0;

%offset value

scl=5;

%scale factor

%x values of the polygon %y values of the polygon

%scaled polygon:

px=plygnx*scl*2;

py=plygny*scl;

figure; plot(xyz(:,1),xyz(:,2)); hold on;

%xyz is the position vector

for i1=1:80:numel(xyz(:,1))

angl=rpy(i1,3);

pxx=(px-offst)*cos(angl)-(py-offst)*sin(angl); pyy=(px-offst)*sin(angl)+(py-offst)*cos(angl);

plot(xyz(i1,1)+pxx,xyz(i1,2)+pyy);

%rpy is the Euler angles vector

end

hold off;

Put your HW report, .m file, Simulink file, etc. into a folder and rename your folder according to the format: StudentNo_HW1_IVD.zip

Do not forget to put comments into your Matlab code.

YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN

1

MKT4132

HW1

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59

A part of the Simulink model showing the transformation from angular velocities to the angles:

the transformation from angular velocities to the angles: Here, ei’ represents the first derivative of Euler

Here, ei’ represents the first derivative of Euler parameter e i w.r.t. to time. By using the calculated Euler parameters, you can also calculate the positions from linear velocities in a similar way. Do not forget to apply the initial positions to the integrator blocks.

YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN

2

MKT4132

HW1

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59

Inside of the block “Initial conditions for integrators”: The code inside the Embedded Matlab Func.:
Inside of the block “Initial conditions for integrators”:
The code inside the Embedded Matlab Func.:

function Quat = fcn(Eul) % Produces quaternion from the given Euler angle array [Phi Theta Psi]'

s1=sin(Eul(1)/2);c1=cos(Eul(1)/2);

s2=sin(Eul(2)/2);c2=cos(Eul(2)/2);

s3=sin(Eul(3)/2);c3=cos(Eul(3)/2);

Quat = c3*[c2*s1;s2*c1;-s2*s1;c2*c1] + s3*[-s2*c1;c2*s1;c2*c1;s2*s1];

YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN

3

MKT4132

HW1

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59 Figure 1. Linear and Angular Velocities w.r.t.

Figure 1. Linear and Angular Velocities w.r.t. Body-Fixed Coordinate System

YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN
YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN

4

MKT4132

HW1

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59 Figure 2. Positions and orientations w.r.t. Earth-Fixed

Figure 2. Positions and orientations w.r.t. Earth-Fixed Coordinate System [based on quaternions]

Figure 3. Positions and orientations w.r.t. Earth-Fixed Coordinate System [based on Euler angles]

YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN

5

MKT4132

HW1

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59

Introduction to Vehicle Dynamics Due: March 15, 2015 23:59 Figure 4. Trajectory of the Vehicle on

Figure 4. Trajectory of the Vehicle on X-Y Plane (Initial coordinates: (0,0,0) )

In your report (you should prepare it according to the supplied report format), explain how you implemented your HW, put plots and the code.

YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN
YTU, Mechatronics Eng. | Asst. Prof. M. Selçuk ARSLAN

6