Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MechaRaptor - Data Processing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
Aerospace and Mechanical Engineering
tlambert
MechaRaptor - Data Processing
Commits
058a531c
Verified
Commit
058a531c
authored
2 years ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
feat(loadardu): true angle calculation
parent
6c04dbd9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/loadardu.m
+25
-3
25 additions, 3 deletions
utils/loadardu.m
with
25 additions
and
3 deletions
utils/loadardu.m
+
25
−
3
View file @
058a531c
...
@@ -54,8 +54,8 @@ function arduData = loadardu(arduFile)
...
@@ -54,8 +54,8 @@ function arduData = loadardu(arduFile)
arduData
(:,
6
:
end
)
=
[];
arduData
(:,
6
:
end
)
=
[];
arduData
=
[
arduData
,
power
];
arduData
=
[
arduData
,
power
];
% Recalculate angles properly
% Recalculate angles properly
from wing positions recoreded
arduData
(:,
2
:
5
)
=
fixangles
(
arduData
(:,
2
:
5
));
end
end
function
rawTable
=
loadcsv
(
file
)
function
rawTable
=
loadcsv
(
file
)
...
@@ -78,7 +78,6 @@ function rawTable = loadcsv(file)
...
@@ -78,7 +78,6 @@ function rawTable = loadcsv(file)
rawTable
.
Properties
.
VariableNames
=
{
'time'
,
'angleFrontLeft'
,
'angleFrontRight'
,
...
rawTable
.
Properties
.
VariableNames
=
{
'time'
,
'angleFrontLeft'
,
'angleFrontRight'
,
...
'angleAftLeft'
,
'angleAftRight'
,
...
'angleAftLeft'
,
'angleAftRight'
,
...
'tensionF'
,
'currentF'
,
'tensionA'
,
'currentA'
};
'tensionF'
,
'currentF'
,
'tensionA'
,
'currentA'
};
end
end
function
timeMilli
=
timetomilli
(
time
)
function
timeMilli
=
timetomilli
(
time
)
...
@@ -89,5 +88,28 @@ function timeMilli = timetomilli(time)
...
@@ -89,5 +88,28 @@ function timeMilli = timetomilli(time)
% Converts into difference from the first time
% Converts into difference from the first time
timeMilli
=
milliseconds
(
time
-
time
(
1
))
+
1
;
% Shift of 1 so first time is 1 millisecond
timeMilli
=
milliseconds
(
time
-
time
(
1
))
+
1
;
% Shift of 1 so first time is 1 millisecond
end
function
angles
=
fixangles
(
wingPos
)
% FIXANGLES Fix the angle values to avoid issues with the 12 bit overflow
% Note: 3rd sensor had an encoding issue. This issue is fixed here automatically
% Defaults and constants
ENC_PRECISION
=
12
;
% 12-bits encoders
MAX_WING_ANGLE
=
38.07
;
% Determined by geometry of the setup
% Abbreviations
nBits
=
2
^
ENC_PRECISION
;
nBits16
=
2
^
16
;
% Fix issue with third sensor (aft left wing) where it was converted in a 16-bits int
% FIXME: Once this is fixed in the controller, add a switch to correct or not the data
wingPos
(:,
3
)
=
mod
(
wingPos
(:,
3
)
+
nBits
/
2
,
nBits16
);
% Convert position data into actual degree
angles
=
wingPos
*
360
/
nBits
;
% Calibrate values so max aligns with MAX_WING_ANGLE
maxAng
=
max
(
angles
);
angles
=
angles
-
maxAng
+
MAX_WING_ANGLE
;
end
end
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