Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Pose2 preambleCache bug #562

Merged
merged 3 commits into from
Mar 24, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/factors/Pose2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ DFG.getManifold(::InstanceType{Pose2Pose2}) = getManifold(Pose2) # Manifolds.Spe

Pose2Pose2(::UniformScaling) = Pose2Pose2()

function preambleCache(dfg::AbstractDFG, vars::AbstractVector{<:DFGVariable}, pp::Pose2Pose2)
M = getManifold(pp)
(;manifold=M, ϵ0=identity_element(M), Xc=zeros(3))
end

# Assumes X is a tangent vector
function (cf::CalcFactor{<:Pose2Pose2})(X, p, q)
@assert X isa ProductRepr "Pose2Pose2 expects measurement sample X to be a Manifolds tangent vector, not coordinate or point representation. Got X=$X"
M = getManifold(Pose2)
q̂ = Manifolds.compose(M, p, exp(M, identity_element(M, p), X)) #for groups

# @info "HERE" cf.cache
M = cf.cache.manifold # getManifold(Pose2)
ϵ0 = cf.cache.ϵ0

q̂ = Manifolds.compose(M, p, exp(M, ϵ0, X)) #for groups
# q̂ = Manifolds.compose(M, p, exp(M, identity_element(M, p), X)) #for groups
#TODO allocalte for vee! see Manifolds #412, fix for AD
Xc = zeros(3)
vee!(M, Xc, q, log(M, q, q̂))
return Xc
fill!(cf.cache.Xc, 0.0)
# Xc = zeros(3)
vee!(M, cf.cache.Xc, q, log(M, q, q̂))
return cf.cache.Xc
end


Expand Down