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 multiple accumulateFactorMeans bugs #1700

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions src/ConsolidateParametricRelatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function solveFactorParameteric(
fct::DFGFactor,
# currval::P1,
srcsym_vals::AbstractVector{Pair{Symbol, P}},
trgsym::Symbol,
solveKey::Symbol = :default;
trgsym::Symbol;
solveKey::Symbol = :default,
evaltmpkw...,
) where {P}
#
Expand Down Expand Up @@ -71,7 +71,7 @@ function solveFactorParameteric(
sfidx,
measT,
pts;
solveKey = solveKey,
solveKey,
evaltmpkw...,
)[1]

Expand Down
1 change: 1 addition & 0 deletions src/services/CalcFactor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ function _prepParamVec(
# TODO --rather define reusable memory for the proposal
# we are generating a proposal distribution, not direct replacement for existing memory and hence the deepcopy.
if sfidx > 0
# FIXME, POSSIBLE SOURCE OF HUGE MEMORY CONSUMPTION ALLOCATION
varParamsAll[sfidx] = deepcopy(varParamsAll[sfidx])
end

Expand Down
8 changes: 4 additions & 4 deletions src/services/EvalFactor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ function _evalFactorTemporary!(
varTypes,
pts;
dfg = tfg,
solveKey = solveKey,
newFactor = newFactor,
solveKey,
newFactor,
buildgraphkw...,
)

Expand All @@ -624,9 +624,9 @@ function _evalFactorTemporary!(
solvefor,
measurement;
needFreshMeasurements = false,
solveKey = solveKey,
solveKey,
inflateCycles = 1,
_slack = _slack,
_slack,
)

return sfPts
Expand Down
10 changes: 7 additions & 3 deletions src/services/TetherUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ Related:

[`approxConv`](@ref), [`solveFactorParameteric`](@ref), `RoME.MutablePose2Pose2Gaussian`
"""
function accumulateFactorMeans(dfg::AbstractDFG, fctsyms::AbstractVector{Symbol})
function accumulateFactorMeans(
dfg::AbstractDFG,
fctsyms::AbstractVector{Symbol};
solveKey::Symbol=:default
)

## get the starting estimate
nextidx = 1
Expand All @@ -137,7 +141,7 @@ function accumulateFactorMeans(dfg::AbstractDFG, fctsyms::AbstractVector{Symbol}
nextsym =
1 < length(fctsyms) ? intersect(vars, ls(dfg, fctsyms[nextidx + 1])) : vars[end]
currsym = 1 < length(fctsyms) ? setdiff(vars, nextsym)[1] : vars[1]
calcPPE(dfg, currsym).suggested
calcPPE(dfg, currsym; solveKey).suggested
end

srcsym = currsym
Expand All @@ -146,7 +150,7 @@ function accumulateFactorMeans(dfg::AbstractDFG, fctsyms::AbstractVector{Symbol}
# first find direction of solve
vars = getVariableOrder(fct)
trgsym = setdiff(vars, [srcsym])[1]
val = solveFactorParameteric(dfg, fct, [srcsym => val;], trgsym)
val = solveFactorParameteric(dfg, fct, [srcsym => val;], trgsym; solveKey)
srcsym = trgsym
end

Expand Down