@@ -40,6 +40,14 @@ function preambleCache(dfg::AbstractDFG, vars::AbstractVector{<:DFGVariable}, pp
4040 (;manifold= M, ϵ0= getPointIdentity(M), Xc= zeros(3 ), q̂= getPointIdentity(M))
4141end
4242
43+ @inline function _vee(:: SpecialEuclidean{2} , X:: ArrayPartition{T, Tuple{SVector{2, T}, SMatrix{2, 2, T, 4}}} ) where T<: Real
44+ return SVector{3 ,T}(X. x[1 ][1 ],X. x[1 ][2 ],X. x[2 ][2 ])
45+ end
46+
47+ @inline function _compose(:: SpecialEuclidean{2} , p:: ArrayPartition{T, Tuple{SVector{2, T}, SMatrix{2, 2, T, 4}}} , q:: ArrayPartition{T, Tuple{SVector{2, T}, SMatrix{2, 2, T, 4}}} ) where T<: Real
48+ return ArrayPartition(p. x[1 ] + p. x[2 ]* q. x[1 ], p. x[2 ]* q. x[2 ])
49+ end
50+
4351# Assumes X is a tangent vector
4452function (cf:: CalcFactor{<:Pose2Pose2} )(_X:: AbstractArray{MT} , _p:: AbstractArray{PT} , _q:: AbstractArray{LT} ) where {MT,PT,LT}
4553 T = promote_type(MT, PT, LT)
@@ -60,14 +68,10 @@ function (cf::CalcFactor{<:Pose2Pose2})(
6068
6169 ϵX = exp(M, ϵ0, X)
6270 # q̂ = Manifolds.compose(M, p, ϵX)
63- tp, Rp = Manifolds. submanifold_components(M, p)
64- tq, Rq = Manifolds. submanifold_components(M, ϵX)
65- R = Rp* Rq
66- t = tp + Rp* (tq)
67- q̂ = ArrayPartition(t,R)
68- X = log(M, q, q̂)
69- # Xc = vee(M, q, q̂)
70- Xc = SA[X. x[1 ][1 ], X. x[1 ][2 ], X. x[2 ][2 ]]
71+ q̂ = _compose(M, p, ϵX)
72+ X_hat = log(M, q, q̂)
73+ # Xc = vee(M, q, X_hat)
74+ Xc = _vee(M, X_hat)
7175 return Xc
7276end
7377
0 commit comments