Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Humanoid Path Planner
hpp-model
Commits
fb01c6da
Commit
fb01c6da
authored
Sep 17, 2015
by
Mylene Campana
Browse files
Fix unBounded interpolation for theta=Pi case
parent
7b27288c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/joint-configuration.cc
View file @
fb01c6da
...
...
@@ -360,8 +360,8 @@ namespace hpp {
namespace
rotationJointConfig
{
void
UnBounded
::
interpolate
(
ConfigurationIn_t
q1
,
ConfigurationIn_t
q2
,
const
value_type
&
u
,
const
size_type
&
index
,
ConfigurationOut_t
result
)
const
value_type
&
u
,
const
size_type
&
index
,
ConfigurationOut_t
result
)
{
// interpolate on the unit circle
double
c1
=
q1
[
index
],
s1
=
q1
[
index
+
1
];
...
...
@@ -370,13 +370,17 @@ namespace hpp {
double
sinTheta
=
c1
*
s2
-
s1
*
c2
;
double
theta
=
atan2
(
sinTheta
,
cosTheta
);
assert
(
fabs
(
sin
(
theta
)
-
sinTheta
)
<
1e-8
);
if
(
fabs
(
theta
)
>
1e-6
)
{
if
(
fabs
(
theta
)
>
1e-6
&&
fabs
(
theta
)
<
M_PI
-
1e-6
)
{
result
.
segment
(
index
,
2
)
=
(
sin
((
1
-
u
)
*
theta
)
/
sinTheta
)
*
q1
.
segment
(
index
,
2
)
+
(
sin
(
u
*
theta
)
/
sinTheta
)
*
q2
.
segment
(
index
,
2
);
}
else
{
}
else
if
(
fabs
(
theta
)
<
1e-6
)
{
// theta = 0
result
.
segment
(
index
,
2
)
=
(
1
-
u
)
*
q1
.
segment
(
index
,
2
)
+
u
*
q2
.
segment
(
index
,
2
);
}
else
{
// theta = +-M_PI
double
theta0
=
atan2
(
q1
[
index
+
1
],
q1
[
index
]);
result
[
index
]
=
cos
(
theta0
+
u
*
theta
);
result
[
index
+
1
]
=
sin
(
theta0
+
u
*
theta
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment