Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FPA-estimation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BSS_development
Movement Science
FPA-estimation
Commits
40c86446
Commit
40c86446
authored
1 year ago
by
Wouda, Frank (UT-EEMCS)
Browse files
Options
Downloads
Patches
Plain Diff
Variable naming updated.
parent
a9be8de5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
+math/IntSignals.m
+24
-25
24 additions, 25 deletions
+math/IntSignals.m
+math/calculateSteps.m
+2
-2
2 additions, 2 deletions
+math/calculateSteps.m
+math/intOmega.m
+36
-0
36 additions, 0 deletions
+math/intOmega.m
Main.m
+2
-0
2 additions, 0 deletions
Main.m
with
64 additions
and
27 deletions
+math/IntSignals.m
+
24
−
25
View file @
40c86446
function
data
=
intSignals
(
data
,
index
)
function
data
=
intSignals
(
data
,
calibration
,
index
)
% Pre-allocate structures for rotated signals.
if
index
==
1
data
.
rG
=
nan
(
data
.
N
,
3
);
data
.
v
G
=
nan
(
data
.
N
,
3
);
data
.
a
G
=
nan
(
data
.
N
,
3
);
data
.
posLocal
=
nan
(
data
.
N
,
3
);
data
.
v
elLocal
=
nan
(
data
.
N
,
3
);
data
.
a
ccLocal
=
nan
(
data
.
N
,
3
);
end
% start with initial orientation of unit rotation matrix.
r
t
=
eye
(
3
);
unitRotMa
t
=
eye
(
3
);
% Current part of analysis.
indexes
=
data
.
tMiddle
(
index
):
data
.
tMiddle
(
index
+
1
);
% Rotate the gyroscope data to Foot-frame.
g
F
=
(
data
.
Rcal
*
data
.
dg
yr
(
indexes
,:)
'
);
g
yroLocal
=
(
calibration
.
rotMatrix
*
data
.
filtG
yr
(
indexes
,:)
'
);
% Integrate the signals from this orientation, such that everything is
% mapped in that frame.
% RgsHat = intOmega(rt,data.dgyr(indexes,:),1/data.fs);
RgsHat
=
intOmega
(
rt
,
gF
'
,
1
/
data
.
fs
);
rotMatHat
=
math
.
intOmega
(
unitRotMat
,
gyroLocal
'
,
1
/
data
.
fs
);
a
R
=
(
data
.
Rcal
*
data
.
da
cc
(
indexes
,:)
')'
;
a
ccLocal
=
(
calibration
.
rotMatrix
*
data
.
filtA
cc
(
indexes
,:)
')'
;
% Pre-allocate space.
a
G
=
nan
(
length
(
indexes
),
3
);
a
ccFreeLocal
=
nan
(
length
(
indexes
),
3
);
% Gravity.
g
=
data
.
A
ccOffsetR
;
g
=
calibration
.
a
ccOffsetR
;
%% Get the free acceleration.
for
i
=
indexes
a
G
(
i
-
indexes
(
1
)
+
1
,:)
=
permute
(
Rgs
Hat
(
i
-
indexes
(
1
)
+
1
,:,:),[
2
3
1
])
*
...
a
R
(
i
-
indexes
(
1
)
+
1
,:)
'-g'
;
a
ccFreeLocal
(
i
-
indexes
(
1
)
+
1
,:)
=
permute
(
rotMat
Hat
(
i
-
indexes
(
1
)
+
1
,:,:),[
2
3
1
])
*
...
a
ccLocal
(
i
-
indexes
(
1
)
+
1
,:)
'-g'
;
end
%% Integrate the free acceleration to obtain velocity.
v
G
=
nan
(
length
(
indexes
),
3
);
v
G
(
1
,:)
=
zeros
(
1
,
3
);
v
elLocal
=
nan
(
length
(
indexes
),
3
);
v
elLocal
(
1
,:)
=
zeros
(
1
,
3
);
for
i
=
2
:
length
(
indexes
)
v
G
(
i
,:)
=
v
G
(
i
-
1
,:)
+
a
G
(
i
,:)
.
/
data
.
fs
;
v
elLocal
(
i
,:)
=
v
elLocal
(
i
-
1
,:)
+
a
ccFreeLocal
(
i
,:)
.
/
data
.
fs
;
end
timeAxis
=
(
0
:
length
(
v
G
)
-
1
)/
data
.
fs
;
timeAxis
=
(
0
:
length
(
v
elLocal
)
-
1
)/
data
.
fs
;
%% Linear velocity drift compensation.
for
i
=
2
:
length
(
indexes
)
v
G
(
i
,:)
=
v
G
(
i
,:)
-
timeAxis
(
i
)/
timeAxis
(
end
)
*
v
G
(
end
,:);
v
elLocal
(
i
,:)
=
v
elLocal
(
i
,:)
-
timeAxis
(
i
)/
timeAxis
(
end
)
*
v
elLocal
(
end
,:);
end
%% Strapdown integration: obtain position.
rG
=
nan
(
length
(
indexes
),
3
);
rG
(
1
,:)
=
zeros
(
1
,
3
);
posLocal
=
nan
(
length
(
indexes
),
3
);
posLocal
(
1
,:)
=
zeros
(
1
,
3
);
for
i
=
2
:
length
(
indexes
)
rG
(
i
,:)
=
rG
(
i
-
1
,:)
+
v
G
(
i
,:)
.
/
data
.
fs
;
posLocal
(
i
,:)
=
posLocal
(
i
-
1
,:)
+
v
elLocal
(
i
,:)
.
/
data
.
fs
;
end
data
.
FPA
(
index
)
=
atand
(
rG
(
end
,
2
)/
rG
(
end
,
1
));
data
.
rG
(
indexes
,:)
=
rG
;
data
.
v
G
(
indexes
,:)
=
v
G
;
data
.
a
G
(
indexes
,:)
=
a
G
;
data
.
FPA
(
index
)
=
atand
(
posLocal
(
end
,
2
)/
posLocal
(
end
,
1
));
data
.
posLocal
(
indexes
,:)
=
posLocal
;
data
.
v
elLocal
(
indexes
,:)
=
v
elLocal
;
data
.
a
ccLocal
(
indexes
,:)
=
a
ccFreeLocal
;
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
+math/calculateSteps.m
+
2
−
2
View file @
40c86446
...
...
@@ -40,11 +40,11 @@ for iStep = steps
% Pre-allocate space for the FPA values.
if
iStep
==
1
data
Struct
.
FPA
=
nan
(
length
(
steps
),
1
);
data
.
FPA
=
nan
(
length
(
steps
),
1
);
end
% Integrate the signals to obtain the FPA within a step.
data
Struct
=
math
.
intSignals
(
data
Struct
,
iStep
);
data
=
math
.
intSignals
(
data
,
calibration
,
iStep
);
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
intOmega.m
→
+math/
intOmega.m
+
36
−
0
View file @
40c86446
function
[
Rgs
Rdot
]
=
intOmega
(
Rgs_ini
t
,
omega
,
t
_sample
)
function
rotMat
=
intOmega
(
initRotMa
t
,
omega
,
t
s
)
% intOmega.m - Calculates orientation matrix by integrating gyroscope signal
%
% Inputs:
%
Rgs_init
Initial orientation matrix
%
initRotMat
Initial orientation matrix
% omega Angular velocity (rad/s)
% t
_sample
Sample time
% t
s
Sample time
%
% Outputs:
%
Rgs
Orientation matrix [Nsamples x 3 x 3]
%
rotMat
Orientation matrix [Nsamples x 3 x 3]
%
% Martin Schepers, July 2005
% Henk Kortier, Sep 2011
% Frank Wouda, Aug 2023
N
=
size
(
omega
,
1
);
omega
_sg_s_tilde
=
zeros
(
N
,
3
,
3
);
omega
Matrix
=
zeros
(
N
,
3
,
3
);
for
i
=
1
:
N
omega
_sg_s_tilde
(
i
,:,:)
=
[
0
-
omega
(
i
,
3
)
omega
(
i
,
2
);
omega
Matrix
(
i
,:,:)
=
[
0
-
omega
(
i
,
3
)
omega
(
i
,
2
);
omega
(
i
,
3
)
0
-
omega
(
i
,
1
);
-
omega
(
i
,
2
)
omega
(
i
,
1
)
0
];
end
Rgs
=
zeros
(
N
,
3
,
3
);
Rgs
(
1
,:,:)
=
Rgs_ini
t
;
% initial value
rotMat
=
zeros
(
N
,
3
,
3
);
rotMat
(
1
,:,:)
=
initRotMa
t
;
% initial value
for
i
=
2
:
N
R
=
permute
(
Rgs
(
i
-
1
,
:,
:),[
2
3
1
]);
R
=
permute
(
rotMat
(
i
-
1
,
:,
:),[
2
3
1
]);
Rdot
=
R
*
permute
(
omega
_sg_s_tilde
(
i
,:,:),[
2
3
1
]);
% Integrate R
R
=
R
+
t
_sample
.*
Rdot
;
Rdot
=
R
*
permute
(
omega
Matrix
(
i
,:,:),[
2
3
1
]);
% Integrate R
R
=
R
+
t
s
.*
Rdot
;
[
A
,
~
]
=
qr
(
R
);
% create proper rotation matrix
Rgs
(
i
,:,:)
=
sqrt
(
A
.*
A
)
.*
sign
(
R
);
% get correct sign
rotMat
(
i
,:,:)
=
sqrt
(
A
.*
A
)
.*
sign
(
R
);
% get correct sign
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Main.m
+
2
−
0
View file @
40c86446
%% This is the main file that runs on IMU data in csv format to obtain
% foot progression angle.
clear
all
;
close
all
;
clc
% Run the settings file.
settingsFile
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment