@@ -8,16 +8,15 @@ Rigid transform between two Pose2's, assuming (x,y,theta).
8
8
Calcuated as:
9
9
```math
10
10
\\ begin{aligned}
11
- \\ hat{q}=\\ exp_pX_m\\\\
12
- X = \\ log_q \\ hat{q}\\\\
13
- X^i = \\ mathrm{vee}(q, X)
11
+ \\ hat{X}_p=\\ log_pq\\\\
12
+ X^i = \\ mathrm{vee}(X_m-\\ hat{X})
14
13
\\ end{aligned}
15
14
```
16
15
with:
17
16
``\\ mathcal M= \\ mathrm{SE}(2)`` Special Euclidean group\\
18
17
``p`` and ``q`` ``\\ in \\ mathcal M`` the two Pose2 points\\
19
18
the measurement vector ``X_m \\ in T_p \\ mathcal M``\\
20
- and the error vector ``X \\ in T_q \\ mathcal M``\\
19
+ and the error vector ``\h at{X} \\ in T_p \\ mathcal M``\\
21
20
``X^i`` coordinates of ``X``
22
21
23
22
DevNotes
@@ -27,53 +26,27 @@ Related
27
26
28
27
[`Pose3Pose3`](@ref), [`Point2Point2`](@ref), [`MutablePose2Pose2Gaussian`](@ref), [`DynPose2`](@ref), [`IMUDeltaFactor`](@ref)
29
28
"""
30
- Base. @kwdef struct Pose2Pose2{T <: IIF.SamplableBelief } <: IIF.AbstractManifoldMinimize
29
+ Base. @kwdef struct Pose2Pose2{T<: IIF.SamplableBelief } <: IIF.AbstractManifoldMinimize
31
30
Z:: T = MvNormal (Diagonal ([1.0 ; 1.0 ; 1.0 ]))
32
31
end
33
32
34
33
DFG. getManifold (:: InstanceType{Pose2Pose2} ) = Manifolds. SpecialEuclidean (2 ; vectors= HybridTangentRepresentation ())
35
34
36
35
Pose2Pose2 (:: UniformScaling ) = Pose2Pose2 ()
37
36
38
-
39
- # Assumes X is a tangent vector
40
- function (cf:: CalcFactor{<:Pose2Pose2} )(_X:: AbstractArray{MT} , _p:: AbstractArray{PT} , _q:: AbstractArray{LT} ) where {MT,PT,LT}
41
- # TODO remove this convertions
42
- # @warn "This warning should not be triggered after StaticArrays upgrade" maxlog=10
43
- T = promote_type (MT, PT, LT)
44
- X = convert (ArrayPartition{T, Tuple{SVector{2 , T}, SMatrix{2 , 2 , T, 4 }}}, _X)
45
- p = convert (ArrayPartition{T, Tuple{SVector{2 , T}, SMatrix{2 , 2 , T, 4 }}}, _p)
46
- q = convert (ArrayPartition{T, Tuple{SVector{2 , T}, SMatrix{2 , 2 , T, 4 }}}, _q)
47
- return cf (X,p,q)
48
- end
49
-
50
- # function calcPose2Pose2(
51
- function (cf:: CalcFactor{<:Pose2Pose2} )(
52
- X:: ArrayPartition{XT, Tuple{SVector{2, XT}, SMatrix{2, 2, XT, 4}}} ,
53
- p:: ArrayPartition{T, Tuple{SVector{2, T}, SMatrix{2, 2, T, 4}}} ,
54
- q:: ArrayPartition{T, Tuple{SVector{2, T}, SMatrix{2, 2, T, 4}}} ) where {XT<: Real ,T<: Real }
55
-
56
- M = getManifold (Pose2)
57
- # ϵ0 = ArrayPartition(zeros(SVector{2,T}), SMatrix{2, 2, T}(I))
58
- ϵ0 = getPointIdentity (M)
59
-
60
- ϵX = exp (M, ϵ0, X)
61
- # q̂ = Manifolds.compose(M, p, ϵX)
62
- q̂ = _compose (M, p, ϵX)
63
- X_hat = log (M, q, q̂)# ::ArrayPartition{T, Tuple{SVector{2, T}, SMatrix{2, 2, T, 4}}}
64
- # Xc = vee(M, q, X_hat)
65
- Xc = _vee (M, X_hat)# ::SVector{3,T}
66
- return Xc
37
+ function (cf:: CalcFactor{<:Pose2Pose2} )(X, p, q)
38
+ G = getManifold (Pose2)
39
+ X̂ = log (base_manifold (G), getPointIdentity (G), compose (G, inv (G, p), q))
40
+ return vee (LieAlgebra (G), X - X̂)
67
41
end
68
42
69
-
70
43
# NOTE, serialization support -- will be reduced to macro in future
71
44
# ------------------------------------
72
45
73
46
"""
74
47
$(TYPEDEF)
75
48
"""
76
- Base. @kwdef struct PackedPose2Pose2 <: AbstractPackedFactor
49
+ Base. @kwdef struct PackedPose2Pose2 <: AbstractPackedFactor
77
50
Z:: PackedSamplableBelief
78
51
end
79
52
function convert (:: Type{Pose2Pose2} , d:: PackedPose2Pose2 )
85
58
86
59
87
60
# FIXME , rather have separate compareDensity functions
88
- function compare (a:: Pose2Pose2 ,b:: Pose2Pose2 ; tol:: Float64 = 1e-10 )
61
+ function compare (a:: Pose2Pose2 , b:: Pose2Pose2 ; tol:: Float64 = 1e-10 )
89
62
return compareDensity (a. Z, b. Z)
90
63
end
91
64
0 commit comments