|
1 |
| -include("DFGVariable/PackedVariableNodeData.jl") |
2 |
| -include("DFGVariable/PointParametricEst.jl") |
3 |
| -include("DFGVariable/VariableNodeData.jl") |
| 1 | +## VariableNodeData.jl |
| 2 | +""" |
| 3 | +$(TYPEDEF) |
| 4 | +Data container for solver-specific data. |
| 5 | +
|
| 6 | + --- |
| 7 | +Fields: |
| 8 | +$(TYPEDFIELDS) |
| 9 | +""" |
| 10 | +mutable struct VariableNodeData{T<:InferenceVariable} |
| 11 | + val::Array{Float64,2} |
| 12 | + bw::Array{Float64,2} |
| 13 | + BayesNetOutVertIDs::Array{Symbol,1} |
| 14 | + dimIDs::Array{Int,1} # Likely deprecate |
| 15 | + dims::Int |
| 16 | + eliminated::Bool |
| 17 | + BayesNetVertID::Symbol # Union{Nothing, } |
| 18 | + separator::Array{Symbol,1} |
| 19 | + softtype::T |
| 20 | + initialized::Bool |
| 21 | + inferdim::Float64 |
| 22 | + ismargin::Bool |
| 23 | + dontmargin::Bool |
| 24 | + solveInProgress::Int |
| 25 | + solvedCount::Int |
| 26 | + VariableNodeData{T}() where {T <:InferenceVariable} = |
| 27 | + new{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], T(), false, 0.0, false, false, 0, 0) |
| 28 | + VariableNodeData{T}(val::Array{Float64,2}, |
| 29 | + bw::Array{Float64,2}, |
| 30 | + BayesNetOutVertIDs::Array{Symbol,1}, |
| 31 | + dimIDs::Array{Int,1}, |
| 32 | + dims::Int,eliminated::Bool, |
| 33 | + BayesNetVertID::Symbol, |
| 34 | + separator::Array{Symbol,1}, |
| 35 | + softtype::T, |
| 36 | + initialized::Bool, |
| 37 | + inferdim::Float64, |
| 38 | + ismargin::Bool, |
| 39 | + dontmargin::Bool, |
| 40 | + solveInProgress::Int=0, |
| 41 | + solvedCount::Int=0) where T <: InferenceVariable = |
| 42 | + new{T}(val,bw,BayesNetOutVertIDs,dimIDs,dims, |
| 43 | + eliminated,BayesNetVertID,separator, |
| 44 | + softtype::T,initialized,inferdim,ismargin, |
| 45 | + dontmargin, solveInProgress, solvedCount) |
| 46 | +end |
| 47 | + |
| 48 | +VariableNodeData(val::Array{Float64,2}, |
| 49 | + bw::Array{Float64,2}, |
| 50 | + BayesNetOutVertIDs::Array{Symbol,1}, |
| 51 | + dimIDs::Array{Int,1}, |
| 52 | + dims::Int,eliminated::Bool, |
| 53 | + BayesNetVertID::Symbol, |
| 54 | + separator::Array{Symbol,1}, |
| 55 | + softtype::T, |
| 56 | + initialized::Bool, |
| 57 | + inferdim::Float64, |
| 58 | + ismargin::Bool, |
| 59 | + dontmargin::Bool, |
| 60 | + solveInProgress::Int=0, |
| 61 | + solvedCount::Int=0) where T <: InferenceVariable = |
| 62 | + VariableNodeData{T}(val,bw,BayesNetOutVertIDs,dimIDs,dims, |
| 63 | + eliminated,BayesNetVertID,separator, |
| 64 | + softtype::T,initialized,inferdim,ismargin, |
| 65 | + dontmargin, solveInProgress, solvedCount) |
| 66 | +# |
| 67 | +VariableNodeData(softtype::T) where T <: InferenceVariable = |
| 68 | + VariableNodeData{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], softtype, false, 0.0, false, false, 0, 0) |
| 69 | + |
| 70 | +##PackedVariableNodeData.jl |
| 71 | +""" |
| 72 | +$(TYPEDEF) |
| 73 | +Packed VariabeNodeData structure for serializing DFGVariables. |
| 74 | +
|
| 75 | + --- |
| 76 | +Fields: |
| 77 | +$(TYPEDFIELDS) |
| 78 | +""" |
| 79 | +mutable struct PackedVariableNodeData |
| 80 | + vecval::Array{Float64,1} |
| 81 | + dimval::Int |
| 82 | + vecbw::Array{Float64,1} |
| 83 | + dimbw::Int |
| 84 | + BayesNetOutVertIDs::Array{Symbol,1} # Int |
| 85 | + dimIDs::Array{Int,1} |
| 86 | + dims::Int |
| 87 | + eliminated::Bool |
| 88 | + BayesNetVertID::Symbol # Int |
| 89 | + separator::Array{Symbol,1} # Int |
| 90 | + softtype::String |
| 91 | + initialized::Bool |
| 92 | + inferdim::Float64 |
| 93 | + ismargin::Bool |
| 94 | + dontmargin::Bool |
| 95 | + solveInProgress::Int |
| 96 | + solvedCount::Int |
| 97 | + PackedVariableNodeData() = new() |
| 98 | + PackedVariableNodeData(x1::Vector{Float64}, |
| 99 | + x2::Int, |
| 100 | + x3::Vector{Float64}, |
| 101 | + x4::Int, |
| 102 | + x5::Vector{Symbol}, # Int |
| 103 | + x6::Vector{Int}, |
| 104 | + x7::Int, |
| 105 | + x8::Bool, |
| 106 | + x9::Symbol, # Int |
| 107 | + x10::Vector{Symbol}, # Int |
| 108 | + x11::String, |
| 109 | + x12::Bool, |
| 110 | + x13::Float64, |
| 111 | + x14::Bool, |
| 112 | + x15::Bool, |
| 113 | + x16::Int, |
| 114 | + solvedCount::Int) = new(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16, solvedCount) |
| 115 | +end |
| 116 | + |
| 117 | +## PoiintParametricEst.jl |
| 118 | +# AbstractPointParametricEst interface |
| 119 | +abstract type AbstractPointParametricEst end |
| 120 | +""" |
| 121 | + $TYPEDEF |
| 122 | +
|
| 123 | +Data container to store Parameteric Point Estimate (PPE) for mean and max. |
| 124 | +""" |
| 125 | +struct MeanMaxPPE <: AbstractPointParametricEst |
| 126 | + solverKey::Symbol #repeated because of Sam's request |
| 127 | + suggested::Vector{Float64} |
| 128 | + max::Vector{Float64} |
| 129 | + mean::Vector{Float64} |
| 130 | + lastUpdatedTimestamp::DateTime |
| 131 | +end |
| 132 | +MeanMaxPPE(solverKey::Symbol, suggested::Vector{Float64}, max::Vector{Float64},mean::Vector{Float64}) = MeanMaxPPE(solverKey, suggested, max, mean, now()) |
| 133 | + |
| 134 | +getMaxPPE(est::AbstractPointParametricEst) = est.max |
| 135 | +getMeanPPE(est::AbstractPointParametricEst) = est.mean |
| 136 | +getSuggestedPPE(est::AbstractPointParametricEst) = est.suggested |
| 137 | +getLastUpdatedTimestamp(est::AbstractPointParametricEst) = est.lastUpdatedTimestamp |
4 | 138 |
|
| 139 | +## DFGVariable.jl |
5 | 140 | """
|
6 | 141 | $(TYPEDEF)
|
7 | 142 | Complete variable structure for a DistributedFactorGraph variable.
|
@@ -56,3 +191,55 @@ function Base.copy(o::DFGVariable)::DFGVariable
|
56 | 191 | solverDataDict=copy(o.solverDataDict), smallData=copy(o.smallData),
|
57 | 192 | bigData=copy(o.bigData), solvable=getSolvable(o), _internalId=getInternalId(o))
|
58 | 193 | end
|
| 194 | + |
| 195 | +## DFGVariableSummary.jl |
| 196 | +""" |
| 197 | +$(TYPEDEF) |
| 198 | +Summary variable structure for a DistributedFactorGraph variable. |
| 199 | +
|
| 200 | + --- |
| 201 | +Fields: |
| 202 | +$(TYPEDFIELDS) |
| 203 | +""" |
| 204 | +struct DFGVariableSummary <: AbstractDFGVariable |
| 205 | + """Variable label, e.g. :x1. |
| 206 | + Accessor: `getLabel`""" |
| 207 | + label::Symbol |
| 208 | + """Variable timestamp. |
| 209 | + Accessors: `getTimestamp`, `setTimestamp!`""" |
| 210 | + timestamp::DateTime |
| 211 | + """Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK]. |
| 212 | + Accessors: `getTags`, `addTags!`, and `deleteTags!`""" |
| 213 | + tags::Set{Symbol} |
| 214 | + """Dictionary of parametric point estimates keyed by solverDataDict keys |
| 215 | + Accessors: `addPPE!`, `updatePPE!`, and `deletePPE!`""" |
| 216 | + ppeDict::Dict{Symbol, <:AbstractPointParametricEst} |
| 217 | + """Symbol for the softtype for the underlying variable. |
| 218 | + Accessor: `getSofttype`""" |
| 219 | + softtypename::Symbol |
| 220 | + """Dictionary of large data associated with this variable. |
| 221 | + Accessors: `addBigDataEntry!`, `getBigDataEntry`, `updateBigDataEntry!`, and `deleteBigDataEntry!`""" |
| 222 | + bigData::Dict{Symbol, AbstractBigDataEntry} |
| 223 | + """Internal ID used by some of the DFG drivers. We don't suggest using this outside of DFG.""" |
| 224 | + _internalId::Int64 |
| 225 | +end |
| 226 | + |
| 227 | +## SkeletonDFGVariable.jl |
| 228 | +""" |
| 229 | +$(TYPEDEF) |
| 230 | +Skeleton variable structure for a DistributedFactorGraph variable. |
| 231 | +
|
| 232 | + --- |
| 233 | +Fields: |
| 234 | +$(TYPEDFIELDS) |
| 235 | +""" |
| 236 | +struct SkeletonDFGVariable <: AbstractDFGVariable |
| 237 | + """Variable label, e.g. :x1. |
| 238 | + Accessor: `getLabel`""" |
| 239 | + label::Symbol |
| 240 | + """Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK]. |
| 241 | + Accessors: `getTags`, `addTags!`, and `deleteTags!`""" |
| 242 | + tags::Set{Symbol} |
| 243 | +end |
| 244 | + |
| 245 | +SkeletonDFGVariable(label::Symbol) = SkeletonDFGVariable(label, Set{Symbol}()) |
0 commit comments