Data Smoothing and Position Mapping

From Lofaro Lab Wiki
Jump to: navigation, search

Data Smoothing

Software: MATLAB

1. Download file dataStabilization.m here.[1]

2. Open the position data and time data files. Copy the body position data to sheet 1, face data to sheet 2, and time data to sheet 3 of an Excel file, and save it in the same folder of the file dataStabilization.m. Let’s say the Excel file’s name is Hello.xlsx.

3. Open the dataStabilization.m file, and replace the file name Hello.xlsx in lines 2 and 3 with the name of your file.

clear all;
[body,txt,raw] = xlsread('Hello.xlsx',1); % replace "Hello" with your file name 
[face,txtf,rawf] = xlsread('Hello.xlsx',2); % replace "Hello" with your file name

4. Replace Hello and HelloF with your desired name at lines 396 and 397. These are MATLAB data file.

save('HelloB.mat','BODYA') % body data for "Hello"
save('HelloF.mat','FACE') % face data for "Hello"

5. Then “Run” the program and new MATLAB data files are created.

Position Mapping

Software: MATLAB

1. Download file mapping.m here[2], and place it in the same folder of the file dataStabilization.m

2. Replace HelloB and HelloF (lines 2 and 3) with the MATLAB data file names you just created in data stabilization.

clear all;
load HelloB.mat % change "HelloB" to your MATLAB data file name
load HelloF.mat % change "HelloF" to your MATLAB data file name

3. Replace Hello_mapped.xlsx (line 594) with desired file name. This is an Excel file that contains the mapped position data for upper body joints of the robot.

%% exporting
xlswrite('Hello_Mapped.xlsx', BODYRo)

4. From line 60 to line 72, change the robot’s measurements and robot facial features’ coordinates with respect to the midpoint of the robot’s shoulders.

%%%%%%%%%%%%%%%%%%%%%%% Robot's measurements %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
robotShoulderLen = 25.7;
robotArmLen = 24.331;
robotForeArmLen = 24.617;
robotHandLen = 9;
robotHandTipLen = 11.113 + 6.075;
robotEyeL = [-3.9 -5.06 35.39];
robotEyeR = [-3.9 5.06 35.39];
robotNose = [-3.9 0 28.23];
robotMouthL = [-3.9 -5 24.395];
robotMouthR = [-3.9 5 24.395];

5. Run the program and a robot’s position data file is created.