Skip to content

Commit 8f0cda2

Browse files
authored
Upgrade to LieGroups (#35)
Co-authored-by: Johannes Terblanche <[email protected]>
1 parent ae5019e commit 8f0cda2

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ version = "0.2.4"
55

66
[deps]
77
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
8+
LieGroups = "6774de46-80ba-43f8-ba42-e41071ccfc5f"
89
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
9-
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
1010
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
1111
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
1212
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1313

1414
[compat]
1515
DocStringExtensions = "0.8, 0.9"
16-
Manifolds = "0.10, 0.11"
16+
LieGroups = "0.1"
1717
RecursiveArrayTools = "3.27.0"
1818
Rotations = "1"
1919
StaticArrays = "1"

src/CameraModels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module CameraModels
22

33
using LinearAlgebra
4-
using Manifolds
4+
using LieGroups
55
using DocStringExtensions
66
using StaticArrays
77
import Rotations as Rot_

src/services/Utils.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ function intersectRayToPlane(
153153
a_F::AbstractVector{<:Real},
154154
l_nFL::AbstractVector{<:Real},
155155
l_FL::AbstractVector{<:Real};
156-
M = SpecialEuclidean(3),
157-
R0 = [1 0 0; 0 1 0; 0 0 1.],
158-
l_T_ex = ArrayPartition([0;0;0.], exp_lie(M.manifold[2], hat(M.manifold[2], R0, [0;0.2;0.]))),
156+
M = SpecialEuclideanGroup(3; variant = :right),
157+
l_T_ex = ArrayPartition([0;0;0.], exp(SpecialOrthogonalGroup(3), hat(LieAlgebra(SpecialOrthogonalGroup(3)), [0;0.2;0.]))),
159158
ex_T_c = ArrayPartition([0;0;0.], [0 0 1; -1 0 0; 0 -1 0.]),
160159
)
161160
# camera in level (or camera to level) manifold element as ArrayPartition

test/multiview_manifolds.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
# using Revise
55
using Test
66
import CameraModels
7-
using Optim, Manifolds
7+
using Optim, LieGroups
88
using StaticArrays
9+
using LieGroups: SpecialEuclideanProductPoint
910
# using ManifoldDiff
1011
# import FiniteDifferences as FD
1112

1213
##
1314

14-
M = SpecialEuclidean(3)
15+
M = SpecialEuclideanGroup(3; variant = :right)
1516

1617
##
1718
@testset "Multiview optimization of point in front of 2 cameras" begin
@@ -49,7 +50,7 @@ function projectPointFrom(cam, c_H_w, w_Ph)
4950
end
5051

5152
function cameraResidual(cam, meas, M, w_T_c, w_Ph, κ=1000)
52-
pred = projectPointFrom(cam, inv(affine_matrix(M,w_T_c)), w_Ph)
53+
pred = projectPointFrom(cam, inv(convert(AbstractMatrix, SpecialEuclideanProductPoint(w_T_c))), w_Ph)
5354
# experimental cost function to try force bad reprojects in front of the camera during optimization
5455
κ*(abs(pred.depth) - pred.depth)^2 + (meas[1]-pred[1])^2 + (meas[2]-pred[2])^2
5556
end

test/testutils.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
using Test
22
using CameraModels
3-
import Manifolds as MJL
3+
import LieGroups
4+
using LieGroups:
5+
SpecialEuclideanGroup,
6+
SpecialOrthogonalGroup,
7+
hat,
8+
exp,
9+
compose,
10+
LieAlgebra
411

512

613
@testset "Test intersect of line and plane" begin
@@ -20,8 +27,8 @@ end
2027

2128
@testset "Test raytracing to plane" begin
2229

23-
M = MJL.SpecialEuclidean(3)
24-
Mr = M.manifold[2]
30+
M = SpecialEuclideanGroup(3; variant = :right)
31+
Mr = SpecialOrthogonalGroup(3)
2532
R0 = [1 0 0; 0 1 0; 0 0 1.]
2633

2734

@@ -36,8 +43,8 @@ l_FL = [0; 0; -2.]
3643

3744
# local level to body to extrinsic transform
3845
l_T_b = ArrayPartition([0;0;0.], R0)
39-
b_T_ex = ArrayPartition([0;0;0.], MJL.exp_lie(Mr, MJL.hat(Mr, R0, [0;0.2;0.2])))
40-
l_T_ex = MJL.compose(M, l_T_b, b_T_ex)
46+
b_T_ex = ArrayPartition([0;0;0.], exp(Mr, hat(LieAlgebra(Mr), [0;0.2;0.2])))
47+
l_T_ex = compose(M, l_T_b, b_T_ex)
4148

4249
# Ray trace
4350
l_Forb = intersectRayToPlane(
@@ -50,8 +57,8 @@ l_Forb = intersectRayToPlane(
5057

5158

5259
## Place the body somewhere in the world
53-
w_T_b = ArrayPartition([0.;0.;2.], MJL.exp_lie(Mr, MJL.hat(Mr, R0, [0;0;0.])))
60+
w_T_b = ArrayPartition([0.;0.;2.], LieGroups.exp(Mr, LieGroups.hat(LieAlgebra(Mr), [0;0;0.])))
5461
# find feature points in the world frame
55-
_w_Forb = MJL.affine_matrix(M, w_T_b)*[l_Forb; 1.]
62+
# _w_Forb = MJL.affine_matrix(M, w_T_b)*[l_Forb; 1.]
5663

5764
end

0 commit comments

Comments
 (0)