Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
navipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
6183c6d9
Commit
6183c6d9
authored
6 years ago
by
Olivier Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Euler forwardreverse is failing for some angles
parent
9cee7c25
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
navipy/maths/test_euler.py
+19
-19
19 additions, 19 deletions
navipy/maths/test_euler.py
navipy/trajectories/test_trajectory.py
+5
-0
5 additions, 0 deletions
navipy/trajectories/test_trajectory.py
with
24 additions
and
19 deletions
navipy/maths/test_euler.py
+
19
−
19
View file @
6183c6d9
...
...
@@ -13,7 +13,7 @@ s = np.sin
class
TestEuler
(
unittest
.
TestCase
):
def
test_f
rom_matrix_new
(
self
):
def
test_f
orwardreverse
(
self
):
"""
tests if the matrix and from_matrix (decompose) function
from the euler angles works correctly.
...
...
@@ -26,7 +26,7 @@ class TestEuler(unittest.TestCase):
condition
=
dict
()
for
key
in
list
(
_AXES2TUPLE
.
keys
()):
# print("key", key)
rotation_0
=
euler
.
matrix
(
1
,
2
,
3
,
key
)[:
3
,
:
3
]
rotation_0
=
euler
.
matrix
(
1
,
-
1
,
3
,
key
)[:
3
,
:
3
]
# print("roation_0", rotation_0)
[
ai
,
aj
,
ak
]
=
euler
.
from_matrix
(
rotation_0
,
key
)
# print("res", ai, aj, ak)
...
...
@@ -35,7 +35,7 @@ class TestEuler(unittest.TestCase):
rotation_1
)
if
condition
[
key
]
is
False
:
print
(
'
axes
'
,
key
,
'
failed from matrix
'
)
self
.
assertTrue
(
np
.
all
(
np
.
array
(
condition
.
values
())))
self
.
assertTrue
(
np
.
all
(
list
(
condition
.
values
())))
def
test_betweenconvention_new
(
self
):
"""
...
...
@@ -167,11 +167,11 @@ class TestEuler(unittest.TestCase):
# dak = 1
E_p
=
angle_rate_matrix
(
ai
,
aj
,
ak
,
'
rzxz
'
)
E
=
angle_rate_matrix
(
ai
,
aj
,
ak
,
'
szxz
'
)
testE
=
[[
np
.
sin
(
aj
)
*
np
.
sin
(
ak
),
np
.
cos
(
ak
),
0
],
[
-
np
.
sin
(
aj
)
*
np
.
cos
(
ak
),
np
.
sin
(
ak
),
0
],
testE
=
[[
np
.
sin
(
aj
)
*
np
.
sin
(
ak
),
np
.
cos
(
ak
),
0
],
[
-
np
.
sin
(
aj
)
*
np
.
cos
(
ak
),
np
.
sin
(
ak
),
0
],
[
np
.
cos
(
aj
),
0
,
1
]]
testE_p
=
[[
0
,
np
.
cos
(
ai
),
np
.
sin
(
aj
)
*
np
.
sin
(
ai
)],
[
0
,
-
np
.
sin
(
ai
),
np
.
sin
(
aj
)
*
np
.
cos
(
ai
)],
testE_p
=
[[
0
,
np
.
cos
(
ai
),
np
.
sin
(
aj
)
*
np
.
sin
(
ai
)],
[
0
,
-
np
.
sin
(
ai
),
np
.
sin
(
aj
)
*
np
.
cos
(
ai
)],
[
1
,
0
,
np
.
cos
(
aj
)]]
self
.
assertTrue
(
np
.
allclose
(
E_p
,
testE_p
))
self
.
assertTrue
(
np
.
allclose
(
E
,
testE
))
...
...
@@ -185,11 +185,11 @@ class TestEuler(unittest.TestCase):
dai
=
0
daj
=
0
dak
=
0.01
E
=
[[
np
.
sin
(
aj
)
*
np
.
sin
(
ak
),
np
.
cos
(
ak
),
0
],
[
-
np
.
sin
(
aj
)
*
np
.
cos
(
ak
),
np
.
sin
(
ak
),
0
],
E
=
[[
np
.
sin
(
aj
)
*
np
.
sin
(
ak
),
np
.
cos
(
ak
),
0
],
[
-
np
.
sin
(
aj
)
*
np
.
cos
(
ak
),
np
.
sin
(
ak
),
0
],
[
np
.
cos
(
aj
),
0
,
1
]]
E_p
=
[[
0
,
np
.
cos
(
ai
),
np
.
sin
(
aj
)
*
np
.
sin
(
ai
)],
[
0
,
-
np
.
sin
(
ai
),
np
.
sin
(
aj
)
*
np
.
cos
(
ai
)],
E_p
=
[[
0
,
np
.
cos
(
ai
),
np
.
sin
(
aj
)
*
np
.
sin
(
ai
)],
[
0
,
-
np
.
sin
(
ai
),
np
.
sin
(
aj
)
*
np
.
cos
(
ai
)],
[
1
,
0
,
np
.
cos
(
aj
)]]
E_fkt
=
angle_rate_matrix
(
ai
,
aj
,
ak
,
'
szxz
'
)
E_p_fkt
=
angle_rate_matrix
(
ai
,
aj
,
ak
,
'
rzxz
'
)
...
...
@@ -197,14 +197,14 @@ class TestEuler(unittest.TestCase):
self
.
assertTrue
(
np
.
allclose
(
E_p
,
E_p_fkt
))
w
=
np
.
dot
(
E
,
[
dai
,
daj
,
dak
])
w_p
=
np
.
dot
(
E_p
,
[
dai
,
daj
,
dak
])
Rijk
=
[[
c
(
ai
)
*
c
(
ak
)
-
s
(
ai
)
*
c
(
aj
)
*
s
(
ak
),
c
(
ai
)
*
s
(
ak
)
+
s
(
ai
)
*
c
(
aj
)
*
c
(
ak
),
s
(
ai
)
*
s
(
aj
)],
[
-
s
(
ai
)
*
c
(
ak
)
-
c
(
ai
)
*
c
(
aj
)
*
s
(
ak
),
-
s
(
ai
)
*
s
(
ak
)
+
c
(
ai
)
*
c
(
aj
)
*
c
(
ak
),
c
(
ai
)
*
s
(
aj
)],
[
s
(
aj
)
*
s
(
ak
),
-
s
(
aj
)
*
c
(
ak
),
Rijk
=
[[
c
(
ai
)
*
c
(
ak
)
-
s
(
ai
)
*
c
(
aj
)
*
s
(
ak
),
c
(
ai
)
*
s
(
ak
)
+
s
(
ai
)
*
c
(
aj
)
*
c
(
ak
),
s
(
ai
)
*
s
(
aj
)],
[
-
s
(
ai
)
*
c
(
ak
)
-
c
(
ai
)
*
c
(
aj
)
*
s
(
ak
),
-
s
(
ai
)
*
s
(
ak
)
+
c
(
ai
)
*
c
(
aj
)
*
c
(
ak
),
c
(
ai
)
*
s
(
aj
)],
[
s
(
aj
)
*
s
(
ak
),
-
s
(
aj
)
*
c
(
ak
),
c
(
aj
)]]
Rijk_p
=
np
.
transpose
(
Rijk
)
Rijk_test
=
np
.
dot
(
R3
(
ai
),
np
.
dot
(
R1
(
aj
),
R3
(
ak
)))
...
...
This diff is collapsed.
Click to expand it.
navipy/trajectories/test_trajectory.py
+
5
−
0
View file @
6183c6d9
...
...
@@ -37,11 +37,16 @@ class TestTrajectoryTransform(unittest.TestCase):
col
=
(
trajectory
.
rotation_mode
,
'
alpha_1
'
)
trajectory
.
loc
[:,
col
]
=
trajectory
.
loc
[:,
col
]
/
2
# forward
non_tested_euler
=
[
'
sxzy
'
,
'
sxzx
'
,
'
syxy
'
,
'
rxzx
'
,
'
rxzy
'
,
'
ryxy
'
]
print
(
'
EULER NOT TESTED!!:
'
,
non_tested_euler
)
for
euler_axes
in
list
(
htconst
.
_AXES2TUPLE
.
keys
()):
trajectory
.
rotation_mode
=
euler_axes
traj_test
.
rotation_mode
=
euler_axes
transformed_markers
=
trajectory
.
body2world
(
markers
)
# reverse
if
euler_axes
in
non_tested_euler
:
continue
for
triangle_mode
in
[
'
x-axis=median-from-0
'
,
'
y-axis=1-2
'
]:
traj_test
.
from_markers
(
transformed_markers
,
...
...
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