Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-talos-balance
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Guilhem Saurel
sot-talos-balance
Commits
d2f1d4e2
Commit
d2f1d4e2
authored
6 years ago
by
François Bailly
Browse files
Options
Downloads
Patches
Plain Diff
[added weighted mean of euler angles]
parent
c40b2faf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/sot/talos_balance/base-estimator.hh
+3
-0
3 additions, 0 deletions
include/sot/talos_balance/base-estimator.hh
src/base-estimator.cpp
+33
-8
33 additions, 8 deletions
src/base-estimator.cpp
with
36 additions
and
8 deletions
include/sot/talos_balance/base-estimator.hh
+
3
−
0
View file @
d2f1d4e2
...
...
@@ -79,6 +79,9 @@ namespace dynamicgraph {
/** Avoids singularity while taking the mean of euler angles**/
double
eulerMean
(
double
a1
,
double
a2
);
/** Avoids singularity while taking the mean of euler angles**/
double
wEulerMean
(
double
a1
,
double
a2
,
double
w1
,
double
w2
);
class
SOTBASEESTIMATOR_EXPORT
BaseEstimator
:
public
::
dynamicgraph
::
Entity
...
...
This diff is collapsed.
Click to expand it.
src/base-estimator.cpp
+
33
−
8
View file @
d2f1d4e2
...
...
@@ -96,17 +96,39 @@ namespace dynamicgraph
inline
double
eulerMean
(
double
a1
,
double
a2
)
{
double
res
=
0
;
double
mean
=
(
a1
+
a2
)
/
2.
;
if
(
(
a1
-
a2
)
>
EIGEN_PI
||
(
a1
-
a2
)
<
-
EIGEN_PI
)
{
re
s
=
mean
>
0
?
-
EIGEN_PI
+
mean
:
EIGEN_PI
+
mean
;
re
turn
mean
>
0
?
-
EIGEN_PI
+
mean
:
EIGEN_PI
+
mean
;
}
else
return
mean
;
}
inline
double
wEulerMean
(
double
a1
,
double
a2
,
double
w1
,
double
w2
)
{
double
wMean
=
(
a1
*
w1
+
a2
*
w2
)
/
(
w1
+
w2
);
double
na
,
naw
,
pa
,
paw
;
if
((
a1
-
a2
)
>
EIGEN_PI
||
(
a1
-
a2
)
<
-
EIGEN_PI
)
{
res
=
mean
;
if
(
a1
<
a2
)
{
na
=
a1
;
//negative angle
naw
=
w1
;
//negative angle weight
pa
=
a2
;
//positive angle
paw
=
w2
;
//positive angle weight
}
else
{
na
=
a2
;
//negative angle
naw
=
w2
;
//negative angle weight
pa
=
a1
;
//positive angle
paw
=
w1
;
//positive angle weight
}
double
piFac
=
(
paw
-
naw
)
/
(
naw
+
paw
);
return
(
EIGEN_PI
*
piFac
-
wMean
)
<
0
?
-
EIGEN_PI
+
wMean
-
EIGEN_PI
*
piFac
:
EIGEN_PI
+
wMean
-
EIGEN_PI
*
piFac
;
}
return
res
;
return
wMean
;
}
#define PROFILE_BASE_POSITION_ESTIMATION "base-est position estimation"
...
...
@@ -681,13 +703,16 @@ namespace dynamicgraph
// average (we do not take into account the IMU yaw)
double
wSum
=
wL
+
wR
+
m_w_imu
;
rpy_chest
[
0
]
=
eulerMean
(
rpy_chest_lf
[
0
],
rpy_chest_rf
[
0
]);
rpy_chest
[
0
]
=
wEulerMean
(
rpy_chest_lf
[
0
],
rpy_chest_rf
[
0
],
wL
,
wR
);
//rpy_chest[0] = eulerMean(rpy_chest_lf[0], rpy_chest_rf[0]);
//eulerMean(rpy_chest[0], rpy_chest_imu[0], rpy_chest(0))
rpy_chest
[
1
]
=
eulerMean
(
rpy_chest_lf
[
1
],
rpy_chest_rf
[
1
]);
rpy_chest
[
1
]
=
wEulerMean
(
rpy_chest_lf
[
1
],
rpy_chest_rf
[
1
],
wL
,
wR
);
//rpy_chest[1] = eulerMean(rpy_chest_lf[1], rpy_chest_rf[1]);
//eulerMean(rpy_chest[1], rpy_chest_imu[1], rpy_chest(1))
//rpy_chest(0) = (rpy_chest_lf[0]*wL + rpy_chest_rf[0]*wR + rpy_chest_imu[0]*m_w_imu) / wSum;
//rpy_chest(1) = (rpy_chest_lf[1]*wL + rpy_chest_rf[1]*wR + rpy_chest_imu[1]*m_w_imu) / wSum;
rpy_chest
[
2
]
=
eulerMean
(
rpy_chest_lf
[
2
],
rpy_chest_rf
[
2
]);
rpy_chest
[
2
]
=
wEulerMean
(
rpy_chest_lf
[
2
],
rpy_chest_rf
[
2
],
wL
,
wR
);
//rpy_chest[2] = eulerMean(rpy_chest_lf[2], rpy_chest_rf[2]);
//rpy_chest(2) = (rpy_chest_lf[2]*wL + rpy_chest_rf[2]*wR ) / (wL+wR);
rpyToMatrix
(
rpy_chest
,
m_oRchest
);
...
...
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