@@ -8,16 +8,15 @@ Rigid transform between two Pose2's, assuming (x,y,theta).
88Calcuated as:
99```math
1010\\ 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})
1413\\ end{aligned}
1514```
1615with:
1716``\\ mathcal M= \\ mathrm{SE}(2)`` Special Euclidean group\\
1817``p`` and ``q`` ``\\ in \\ mathcal M`` the two Pose2 points\\
1918the 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 ``\\ hat{X} \\ in T_p \\ mathcal M``\\
2120``X^i`` coordinates of ``X``
2221
2322DevNotes
@@ -27,53 +26,27 @@ Related
2726
2827[`Pose3Pose3`](@ref), [`Point2Point2`](@ref), [`MutablePose2Pose2Gaussian`](@ref), [`DynPose2`](@ref), [`IMUDeltaFactor`](@ref)
2928"""
30- Base. @kwdef struct Pose2Pose2{T <: IIF.SamplableBelief } <: IIF.AbstractManifoldMinimize
29+ Base. @kwdef struct Pose2Pose2{T<: IIF.SamplableBelief } <: IIF.AbstractManifoldMinimize
3130 Z:: T = MvNormal (Diagonal ([1.0 ; 1.0 ; 1.0 ]))
3231end
3332
3433DFG. getManifold (:: InstanceType{Pose2Pose2} ) = Manifolds. SpecialEuclidean (2 ; vectors= HybridTangentRepresentation ())
3534
3635Pose2Pose2 (:: UniformScaling ) = Pose2Pose2 ()
3736
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̂)
6741end
6842
69-
7043# NOTE, serialization support -- will be reduced to macro in future
7144# ------------------------------------
7245
7346"""
7447$(TYPEDEF)
7548"""
76- Base. @kwdef struct PackedPose2Pose2 <: AbstractPackedFactor
49+ Base. @kwdef struct PackedPose2Pose2 <: AbstractPackedFactor
7750 Z:: PackedSamplableBelief
7851end
7952function convert (:: Type{Pose2Pose2} , d:: PackedPose2Pose2 )
8558
8659
8760# 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 )
8962 return compareDensity (a. Z, b. Z)
9063end
9164
0 commit comments