-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from JuliaRobotics/master
v0.4.19-rc1
- Loading branch information
Showing
7 changed files
with
122 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# test manifold conventions | ||
|
||
|
||
using Test | ||
using Manifolds | ||
|
||
import Rotations as _Rot | ||
|
||
## | ||
@testset "test Manifolds.jl conventions" begin | ||
## | ||
|
||
M = SpecialEuclidean(2) | ||
e0 = identity_element(M) | ||
|
||
# body to body next | ||
bTb_ = ProductRepr([10.0;0], _Rot.RotMatrix(pi/2)) | ||
|
||
# drive in a clockwise square from the origin | ||
wTb0 = ProductRepr([100.0;0], _Rot.RotMatrix(0.0)) | ||
wTb1 = Manifolds.compose(M, wTb0, bTb_) # right | ||
wTb2 = Manifolds.compose(M, wTb1, bTb_) # top right | ||
wTb3 = Manifolds.compose(M, wTb2, bTb_) # top | ||
wTb4 = Manifolds.compose(M, wTb3, bTb_) # origin | ||
|
||
wCb0 = vee(M, e0, log(M, e0, wTb0)) | ||
wCb1 = vee(M, e0, log(M, e0, wTb1)) | ||
wCb2 = vee(M, e0, log(M, e0, wTb2)) | ||
wCb3 = vee(M, e0, log(M, e0, wTb3)) | ||
wCb4 = vee(M, e0, log(M, e0, wTb4)) | ||
|
||
## | ||
|
||
# check the favorable result | ||
@test isapprox( [100,0.,0], wCb0 ; atol=1e-6 ) | ||
@test isapprox( [110,0.,pi/2], wCb1 ; atol=1e-6 ) | ||
@test isapprox( [110.,10,pi], wCb2 ; atol=1e-6 ) || isapprox( [110,10,-pi], wCb2 ; atol=1e-6 ) | ||
@test isapprox( [100.,10,-pi/2], wCb3 ; atol=1e-6 ) | ||
@test isapprox( [100,0,0.], wCb4 ; atol=1e-6 ) | ||
|
||
|
||
## check that the inverse breaks | ||
|
||
|
||
# Use opposite convention from above to show it is wrong | ||
wTb0 = ProductRepr([100.0;0], _Rot.RotMatrix(0.0)) | ||
wTb1 = Manifolds.compose(M, bTb_, wTb0) # right | ||
wTb2 = Manifolds.compose(M, bTb_, wTb1) # top right | ||
wTb3 = Manifolds.compose(M, bTb_, wTb2) # top | ||
wTb4 = Manifolds.compose(M, bTb_, wTb3) # origin | ||
|
||
wCb0 = vee(M, e0, log(M, e0, wTb0)) | ||
wCb1 = vee(M, e0, log(M, e0, wTb1)) | ||
wCb2 = vee(M, e0, log(M, e0, wTb2)) | ||
wCb3 = vee(M, e0, log(M, e0, wTb3)) | ||
wCb4 = vee(M, e0, log(M, e0, wTb4)) | ||
|
||
# check the negative result | ||
@test isapprox( [100,0.,0], wCb0 ; atol=1e-6 ) | ||
@test !isapprox( [110,0.,pi/2], wCb1 ; atol=1e-6 ) | ||
@test !(isapprox( [110.,10,pi], wCb2 ; atol=1e-6 ) || isapprox( [110,10,-pi], wCb2 ; atol=1e-6 )) | ||
@test !isapprox( [100.,10,-pi/2], wCb3 ; atol=1e-6 ) | ||
@test isapprox( [100,0,0.], wCb4 ; atol=1e-6 ) | ||
|
||
|
||
## | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# test for symmetry on distances | ||
|
||
using Manifolds | ||
using Test | ||
|
||
import Rotations as _Rot | ||
|
||
## | ||
@testset "test symmetry of Manifolds.distance" begin | ||
## | ||
|
||
M = TranslationGroup(2) | ||
a,b = randn(2), randn(2) | ||
@test isapprox( distance(M, a, b), distance(M, b, a), atol = 1e-5) | ||
|
||
|
||
M = SpecialOrthogonal(2) | ||
a,b = _Rot.RotMatrix(randn()), _Rot.RotMatrix(randn()) | ||
@test isapprox( distance(M, a, b), distance(M, b, a), atol = 1e-5) | ||
|
||
|
||
M = SpecialEuclidean(2) | ||
a = ProductRepr(randn(2),_Rot.RotMatrix(randn())) | ||
b = ProductRepr(randn(2),_Rot.RotMatrix(randn())) | ||
@test isapprox( distance(M, a, b), distance(M, b, a), atol = 1e-5) | ||
|
||
|
||
M = SpecialOrthogonal(3) | ||
a = _Rot.RotZ(randn())*_Rot.RotY(randn())*_Rot.RotX(randn()) | ||
b = _Rot.RotZ(randn())*_Rot.RotY(randn())*_Rot.RotX(randn()) | ||
@test isapprox( distance(M, a, b), distance(M, b, a), atol = 1e-5) | ||
|
||
## | ||
end |