@@ -77,7 +77,7 @@ DFG.@defVariable Pose2 3 (:Euclid, :Euclid, :Circular)
77
77
macro defVariable (structname, dimension:: Int , manifolds)# ::Vararg{Symbol})#NTuple{dimension, Symbol})
78
78
# :(struct $structname <: InferenceVariable end)
79
79
return esc (quote
80
- struct $ structname <: InferenceVariable end
80
+ Base . @__doc__ struct $ structname <: InferenceVariable end
81
81
DistributedFactorGraphs. getDimension (:: $structname ) = $ dimension
82
82
DistributedFactorGraphs. getManifolds (:: $structname ) = $ manifolds
83
83
end )
345
345
$(SIGNATURES)
346
346
Update a small data pair `key=>value` for variable `label` in `dfg`
347
347
"""
348
- function updateSmallData! (dfg:: AbstractDFG , label:: Symbol , pair:: Pair{Symbol, <:SmallDataTypes} )
348
+ function updateSmallData! (dfg:: AbstractDFG , label:: Symbol , pair:: Pair{Symbol, <:SmallDataTypes} ; warn_if_absent :: Bool = true )
349
349
v = getVariable (dfg, label)
350
- ! haskey (v. smallData, pair. first) && @warn (" $(pair. first) does not exist, adding." )
350
+ warn_if_absent && ! haskey (v. smallData, pair. first) && @warn (" $(pair. first) does not exist, adding." )
351
351
push! (v. smallData, pair)
352
352
updateVariable! (dfg, v)
353
353
return v. smallData # or pair TODO
@@ -478,13 +478,12 @@ function updateVariableSolverData!(dfg::AbstractDFG,
478
478
variablekey:: Symbol ,
479
479
vnd:: VariableNodeData ,
480
480
useCopy:: Bool = true ,
481
- fields:: Vector{Symbol} = Symbol[],
482
- verbose :: Bool = true )
481
+ fields:: Vector{Symbol} = Symbol[];
482
+ warn_if_absent :: Bool = true )
483
483
# This is basically just setSolverData
484
484
var = getVariable (dfg, variablekey)
485
- if verbose && ! haskey (var. solverDataDict, vnd. solveKey)
486
- @warn " VariableNodeData '$(vnd. solveKey) ' does not exist, adding"
487
- end
485
+
486
+ warn_if_absent && ! haskey (var. solverDataDict, vnd. solveKey) && @warn " VariableNodeData '$(vnd. solveKey) ' does not exist, adding"
488
487
489
488
# for InMemoryDFGTypes do memory copy or repointing, for cloud this would be an different kind of update.
490
489
usevnd = useCopy ? deepcopy (vnd) : vnd
@@ -510,23 +509,22 @@ function updateVariableSolverData!(dfg::AbstractDFG,
510
509
return var. solverDataDict[vnd. solveKey]
511
510
end
512
511
513
-
514
512
function updateVariableSolverData! (dfg:: AbstractDFG ,
515
513
variablekey:: Symbol ,
516
514
vnd:: VariableNodeData ,
517
515
solveKey:: Symbol ,
518
516
useCopy:: Bool = true ,
519
- fields:: Vector{Symbol} = Symbol[],
520
- verbose :: Bool = true )
517
+ fields:: Vector{Symbol} = Symbol[];
518
+ warn_if_absent :: Bool = true )
521
519
522
520
# TODO not very clean
523
521
if vnd. solveKey != solveKey
524
- @warn " updateVariableSolverData with solveKey parameter might change in the future, see DFG #565"
522
+ @warn ( " updateVariableSolverData with solveKey parameter might change in the future, see DFG #565. Future warnings are suppressed " , maxlog = 1 )
525
523
usevnd = useCopy ? deepcopy (vnd) : vnd
526
524
usevnd. solveKey = solveKey
527
- return updateVariableSolverData! (dfg, variablekey, usevnd, useCopy, fields, verbose )
525
+ return updateVariableSolverData! (dfg, variablekey, usevnd, useCopy, fields; warn_if_absent = warn_if_absent )
528
526
else
529
- return updateVariableSolverData! (dfg, variablekey, vnd, useCopy, fields, verbose )
527
+ return updateVariableSolverData! (dfg, variablekey, vnd, useCopy, fields; warn_if_absent = warn_if_absent )
530
528
end
531
529
end
532
530
@@ -535,17 +533,19 @@ updateVariableSolverData!(dfg::AbstractDFG,
535
533
sourceVariable:: DFGVariable ,
536
534
solveKey:: Symbol = :default ,
537
535
useCopy:: Bool = true ,
538
- fields:: Vector{Symbol} = Symbol[] ) =
539
- updateVariableSolverData! (dfg, sourceVariable. label, getSolverData (sourceVariable, solveKey), useCopy, fields)
536
+ fields:: Vector{Symbol} = Symbol[];
537
+ warn_if_absent:: Bool = true ) =
538
+ updateVariableSolverData! (dfg, sourceVariable. label, getSolverData (sourceVariable, solveKey), useCopy, fields; warn_if_absent= warn_if_absent)
540
539
541
540
function updateVariableSolverData! (dfg:: AbstractDFG ,
542
541
sourceVariables:: Vector{<:DFGVariable} ,
543
542
solveKey:: Symbol = :default ,
544
543
useCopy:: Bool = true ,
545
- fields:: Vector{Symbol} = Symbol[] )
544
+ fields:: Vector{Symbol} = Symbol[];
545
+ warn_if_absent:: Bool = true )
546
546
# I think cloud would do this in bulk for speed
547
547
for var in sourceVariables
548
- updateVariableSolverData! (dfg, var. label, getSolverData (var, solveKey), useCopy, fields)
548
+ updateVariableSolverData! (dfg, var. label, getSolverData (var, solveKey), useCopy, fields; warn_if_absent = warn_if_absent )
549
549
end
550
550
end
551
551
@@ -563,7 +563,7 @@ function deepcopySolvekeys!(dfg::AbstractDFG,
563
563
for x in labels
564
564
sd = deepcopy (getSolverData (getVariable (dfg,x), src))
565
565
sd. solveKey = dest
566
- updateVariableSolverData! (dfg, x, sd, true , Symbol[], verbose )
566
+ updateVariableSolverData! (dfg, x, sd, true , Symbol[]; warn_if_absent = verbose )
567
567
end
568
568
end
569
569
const deepcopySupersolve! = deepcopySolvekeys!
@@ -670,9 +670,9 @@ addPPE!(dfg::AbstractDFG, sourceVariable::DFGVariable, ppekey::Symbol=:default)
670
670
$(SIGNATURES)
671
671
Update PPE data if it exists, otherwise add it -- one call per `key::Symbol=:default`.
672
672
"""
673
- function updatePPE! (dfg:: AbstractDFG , variablekey:: Symbol , ppe:: P ) :: P where {P <: AbstractPointParametricEst }
673
+ function updatePPE! (dfg:: AbstractDFG , variablekey:: Symbol , ppe:: AbstractPointParametricEst ; warn_if_absent :: Bool = true )
674
674
var = getVariable (dfg, variablekey)
675
- if ! haskey (var. ppeDict, ppe. solveKey)
675
+ if warn_if_absent && ! haskey (var. ppeDict, ppe. solveKey)
676
676
@warn " PPE '$(ppe. solveKey) ' does not exist, adding"
677
677
end
678
678
# for InMemoryDFGTypes, cloud would update here
@@ -685,17 +685,17 @@ end
685
685
Update PPE data if it exists, otherwise add it.
686
686
NOTE: Copies the PPE data.
687
687
"""
688
- updatePPE! (dfg:: AbstractDFG , sourceVariable:: VariableDataLevel1 , ppekey:: Symbol = :default ) =
689
- updatePPE! (dfg, sourceVariable. label, deepcopy (getPPE (sourceVariable, ppekey)))
688
+ updatePPE! (dfg:: AbstractDFG , sourceVariable:: VariableDataLevel1 , ppekey:: Symbol = :default ; warn_if_absent :: Bool = true ) =
689
+ updatePPE! (dfg, sourceVariable. label, deepcopy (getPPE (sourceVariable, ppekey)); warn_if_absent = warn_if_absent )
690
690
691
691
"""
692
692
$(SIGNATURES)
693
693
Update PPE data if it exists, otherwise add it.
694
694
"""
695
- function updatePPE! (dfg:: AbstractDFG , sourceVariables:: Vector{<:VariableDataLevel1} , ppekey:: Symbol = :default )
695
+ function updatePPE! (dfg:: AbstractDFG , sourceVariables:: Vector{<:VariableDataLevel1} , ppekey:: Symbol = :default ; warn_if_absent :: Bool = true )
696
696
# I think cloud would do this in bulk for speed
697
697
for var in sourceVariables
698
- updatePPE! (dfg, var. label, getPPE (dfg, var, ppekey))
698
+ updatePPE! (dfg, var. label, getPPE (dfg, var, ppekey); warn_if_absent = warn_if_absent )
699
699
end
700
700
end
701
701
0 commit comments