@@ -38,18 +38,23 @@ getLastUpdatedTimestamp(est::AbstractPointParametricEst) = est.lastUpdatedTimest
38
38
39
39
Variable nodes `variableType` information holding a variety of meta data associated with the type of variable stored in that node of the factor graph.
40
40
41
+ DevWork
42
+ - TODO, see IncrementalInference.jl 1228
43
+
41
44
Related
42
45
43
46
getVariableType
44
47
"""
48
+ getVariableType (v:: DFGVariable{T} ) where T <: InferenceVariable = T ()
49
+
45
50
function getVariableType (vnd:: VariableNodeData )
51
+ # @warn "getVariableType(::VariableNodeData) is being deprecated, use getVariableType(::DFGVariable) instead."
46
52
return vnd. variableType
47
53
end
48
54
49
55
50
56
# TODO : Confirm that we can switch this out, instead of retrieving the complete variable.
51
- # getVariableType(v::DFGVariable{T}) where T <: InferenceVariable = T()
52
- getVariableType (v:: DFGVariable ) = getVariableType (getSolverData (v))
57
+ # getVariableType(v::DFGVariable) = getVariableType(getSolverData(v))
53
58
54
59
# Optimized in CGDFG
55
60
getVariableType (dfg:: AbstractDFG , lbl:: Symbol ) = getVariableType (getVariable (dfg,lbl))
326
331
$SIGNATURES
327
332
Set solver data structure stored in a variable.
328
333
"""
329
- setSolverData! (v:: DFGVariable , data:: VariableNodeData , key:: Symbol = :default ) = v. solverDataDict[key] = data
334
+ function setSolverData! (v:: DFGVariable , data:: VariableNodeData , key:: Symbol = :default )
335
+ @assert key == data. solveKey " VariableNodeData.solveKey=:$(data. solveKey) does not match requested :$(key) "
336
+ v. solverDataDict[key] = data
337
+ end
330
338
331
339
# #------------------------------------------------------------------------------
332
340
# # smallData
@@ -520,7 +528,9 @@ function updateVariableSolverData!(dfg::AbstractDFG,
520
528
# for InMemoryDFGTypes do memory copy or repointing, for cloud this would be an different kind of update.
521
529
usevnd = useCopy ? deepcopy (vnd) : vnd
522
530
# should just one, or many pointers be updated?
523
- if haskey (var. solverDataDict, vnd. solveKey) && isa (var. solverDataDict[vnd. solveKey], VariableNodeData) && length (fields) != 0
531
+ useExisting = haskey (var. solverDataDict, vnd. solveKey) && isa (var. solverDataDict[vnd. solveKey], VariableNodeData) && length (fields) != 0
532
+ # @error useExisting vnd.solveKey
533
+ if useExisting
524
534
# change multiple pointers inside the VND var.solverDataDict[solvekey]
525
535
for field in fields
526
536
destField = getfield (var. solverDataDict[vnd. solveKey], field)
@@ -561,13 +571,20 @@ function updateVariableSolverData!(dfg::AbstractDFG,
561
571
end
562
572
563
573
564
- updateVariableSolverData! (dfg:: AbstractDFG ,
565
- sourceVariable:: DFGVariable ,
566
- solveKey:: Symbol = :default ,
567
- useCopy:: Bool = true ,
568
- fields:: Vector{Symbol} = Symbol[];
569
- warn_if_absent:: Bool = true ) =
570
- updateVariableSolverData! (dfg, sourceVariable. label, getSolverData (sourceVariable, solveKey), useCopy, fields; warn_if_absent= warn_if_absent)
574
+ function updateVariableSolverData! ( dfg:: AbstractDFG ,
575
+ sourceVariable:: DFGVariable ,
576
+ solveKey:: Symbol = :default ,
577
+ useCopy:: Bool = true ,
578
+ fields:: Vector{Symbol} = Symbol[];
579
+ warn_if_absent:: Bool = true )
580
+ #
581
+ vnd = getSolverData (sourceVariable, solveKey)
582
+ # toshow = listSolveKeys(sourceVariable) |> collect
583
+ # @info "update DFGVar solveKey" solveKey vnd.solveKey
584
+ # @show toshow
585
+ @assert solveKey == vnd. solveKey " VariableNodeData's solveKey=:$(vnd. solveKey) does not match requested :$solveKey "
586
+ updateVariableSolverData! (dfg, sourceVariable. label, vnd, useCopy, fields; warn_if_absent= warn_if_absent)
587
+ end
571
588
572
589
function updateVariableSolverData! (dfg:: AbstractDFG ,
573
590
sourceVariables:: Vector{<:DFGVariable} ,
@@ -674,13 +691,13 @@ function getPPE(dfg::AbstractDFG, variablekey::Symbol, ppekey::Symbol=:default)
674
691
end
675
692
676
693
# Not the most efficient call but it at least reuses above (in memory it's probably ok)
677
- getPPE (dfg:: AbstractDFG , sourceVariable:: VariableDataLevel1 , ppekey:: Symbol = default):: AbstractPointParametricEst = getPPE (dfg, sourceVariable. label, ppekey)
694
+ getPPE (dfg:: AbstractDFG , sourceVariable:: VariableDataLevel1 , ppekey:: Symbol = : default ) = getPPE (dfg, sourceVariable. label, ppekey)
678
695
679
696
"""
680
697
$(SIGNATURES)
681
698
Add variable PPE, errors if it already exists.
682
699
"""
683
- function addPPE! (dfg:: AbstractDFG , variablekey:: Symbol , ppe:: P ):: AbstractPointParametricEst where {P <: AbstractPointParametricEst }
700
+ function addPPE! (dfg:: AbstractDFG , variablekey:: Symbol , ppe:: P ) where {P <: AbstractPointParametricEst }
684
701
var = getVariable (dfg, variablekey)
685
702
if haskey (var. ppeDict, ppe. solveKey)
686
703
error (" PPE '$(ppe. solveKey) ' already exists" )
0 commit comments