Skip to content

Commit 9fc1e3d

Browse files
authored
Merge pull request #1700 from JuliaRobotics/23Q1/fix/accumfactorparam
fix multiple accumulateFactorMeans bugs
2 parents bb86f74 + 1e921b9 commit 9fc1e3d

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

src/ConsolidateParametricRelatives.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ function solveFactorParameteric(
2525
fct::DFGFactor,
2626
# currval::P1,
2727
srcsym_vals::AbstractVector{Pair{Symbol, P}},
28-
trgsym::Symbol,
29-
solveKey::Symbol = :default;
28+
trgsym::Symbol;
29+
solveKey::Symbol = :default,
3030
evaltmpkw...,
3131
) where {P}
3232
#
@@ -71,7 +71,7 @@ function solveFactorParameteric(
7171
sfidx,
7272
measT,
7373
pts;
74-
solveKey = solveKey,
74+
solveKey,
7575
evaltmpkw...,
7676
)[1]
7777

src/services/CalcFactor.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ function _prepParamVec(
264264
# TODO --rather define reusable memory for the proposal
265265
# we are generating a proposal distribution, not direct replacement for existing memory and hence the deepcopy.
266266
if sfidx > 0
267+
# FIXME, POSSIBLE SOURCE OF HUGE MEMORY CONSUMPTION ALLOCATION
267268
varParamsAll[sfidx] = deepcopy(varParamsAll[sfidx])
268269
end
269270

src/services/EvalFactor.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ function _evalFactorTemporary!(
609609
varTypes,
610610
pts;
611611
dfg = tfg,
612-
solveKey = solveKey,
613-
newFactor = newFactor,
612+
solveKey,
613+
newFactor,
614614
buildgraphkw...,
615615
)
616616

@@ -624,9 +624,9 @@ function _evalFactorTemporary!(
624624
solvefor,
625625
measurement;
626626
needFreshMeasurements = false,
627-
solveKey = solveKey,
627+
solveKey,
628628
inflateCycles = 1,
629-
_slack = _slack,
629+
_slack,
630630
)
631631

632632
return sfPts

src/services/TetherUtils.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ Related:
116116
117117
[`approxConv`](@ref), [`solveFactorParameteric`](@ref), `RoME.MutablePose2Pose2Gaussian`
118118
"""
119-
function accumulateFactorMeans(dfg::AbstractDFG, fctsyms::AbstractVector{Symbol})
119+
function accumulateFactorMeans(
120+
dfg::AbstractDFG,
121+
fctsyms::AbstractVector{Symbol};
122+
solveKey::Symbol=:default
123+
)
120124

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

143147
srcsym = currsym
@@ -146,7 +150,7 @@ function accumulateFactorMeans(dfg::AbstractDFG, fctsyms::AbstractVector{Symbol}
146150
# first find direction of solve
147151
vars = getVariableOrder(fct)
148152
trgsym = setdiff(vars, [srcsym])[1]
149-
val = solveFactorParameteric(dfg, fct, [srcsym => val;], trgsym)
153+
val = solveFactorParameteric(dfg, fct, [srcsym => val;], trgsym; solveKey)
150154
srcsym = trgsym
151155
end
152156

0 commit comments

Comments
 (0)