Post Process Matlab CSV and quaternion

Post Reply
Posts: 1
Joined: Tue May 21, 2019 1:10 pm

Post Process Matlab CSV and quaternion

Post by fabien54600 » Tue May 21, 2019 1:23 pm


I have some problems to calculate angle on Matlab.
In the CSV file with quaternion, I think that Qy and Qz are inverted. Is it OK ?

In order to calculate the trunk flexion, I wrote this code, is it ok ?

% initialisation of quaternions
qa(:,1) =,6); %qa_w
qa(:,2) =,3); %qa_x
qa(:,3) =,5); %qa_y
qa(:,4) =,4); %qa_z

%% Offset TPOSE

% 2 quaternions of TPose (without NaN points)
TPoseA = nanmean(RigidBody(1).datas(beginTpose*framerate+1:indTPose,:));

%% Data process : angle between 2 rigidBody A and B

% Calculation of rotation in order to align the 2 RigidBody

RigidBody(1).datas = quatmultiply(quatinv(RigidBody(1).datas),TPoseA);
% Note : Motive display euler's is X (Pitch), Y (Yaw), Z (Roll), Right-Handed (RHS), Relative Axes
% so we decode eulers heres
[yaw, roll, pitch] = quat2angle(RigidBody(1).datas(:,:),'ZYX');
pitch = rad2deg(pitch);
yaw = rad2deg(yaw);
roll = rad2deg(roll);


Post Reply