DistributedFactorGraphs Types

DistributedFactorGraphs Module

DistributedFactorGraphs.DistributedFactorGraphsModule

DistributedFactorGraphs.jl provides a flexible factor graph API for use in the Caesar.jl ecosystem.

The package supplies:

  • A standardized API for interacting with factor graphs
  • Implementations of the API for in-memory and database-driven operation
  • Visualization extensions to validate the underlying graph
source

Types

Abstract DFG

Summary DFG

DFG Variable Nodes

DistributedFactorGraphs.PackedVariableNodeDataType
mutable struct PackedVariableNodeData

Packed VariableNodeData structure for serializing DFGVariables.


Fields:

  • id::Union{Nothing, Base.UUID}

  • vecval::Vector{Float64}

  • dimval::Int64

  • vecbw::Vector{Float64}

  • dimbw::Int64

  • BayesNetOutVertIDs::Vector{Symbol}

  • dimIDs::Vector{Int64}

  • dims::Int64

  • eliminated::Bool

  • BayesNetVertID::Symbol

  • separator::Vector{Symbol}

  • variableType::String

  • initialized::Bool

  • infoPerCoord::Vector{Float64}

  • ismargin::Bool

  • dontmargin::Bool

  • solveInProgress::Int64

  • solvedCount::Int64

  • solveKey::Symbol

  • covar::Vector{Float64}

  • _version::String

source
DistributedFactorGraphs.VariableComputeType
struct VariableCompute{T<:InferenceVariable, P, N} <: AbstractDFGVariable

Complete variable structure for a DistributedFactorGraph variable.


Fields:

  • id::Union{Nothing, Base.UUID}: The ID for the variable

  • label::Symbol: Variable label, e.g. :x1. Accessor: getLabel

  • timestamp::TimeZones.ZonedDateTime: Variable timestamp. Accessors: getTimestamp, setTimestamp

  • nstime::Dates.Nanosecond: Nanoseconds since a user-understood epoch (i.e unix epoch, robot boot time, etc.)

  • tags::Set{Symbol}: Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK]. Accessors: getTags, mergeTags!, and removeTags!

  • ppeDict::Dict{Symbol, AbstractPointParametricEst}: Dictionary of parametric point estimates keyed by solverDataDict keys Accessors: addPPE!, updatePPE!, and deletePPE!

  • solverDataDict::Dict{Symbol, VariableNodeData{T, P, N}} where {T<:InferenceVariable, P, N}: Dictionary of solver data. May be a subset of all solutions if a solver key was specified in the get call. Accessors: addVariableSolverData!, updateVariableSolverData!, and deleteVariableSolverData!

  • smallData::Dict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}: Dictionary of small data associated with this variable. Accessors: getMetadata, setMetadata!

  • dataDict::Dict{Symbol, BlobEntry}: Dictionary of large data associated with this variable. Accessors: addBlobEntry!, getBlobEntry, updateBlobEntry!, and deleteBlobEntry!

  • solvable::Base.RefValue{Int64}: Solvable flag for the variable. Accessors: getSolvable, setSolvable!

source
DistributedFactorGraphs.VariableNodeDataType
mutable struct VariableNodeData{T<:InferenceVariable, P, N}

Data container for solver-specific data.


T: Variable type, such as Position1, or RoME.Pose2, etc. P: Variable point type, the type of the manifold point. N: Manifold dimension. Fields:

  • variableType::InferenceVariable: DEPRECATED remove in DFG v0.22

  • id::Union{Nothing, Base.UUID}: Globally unique identifier.

  • val::Vector: Vector of on-manifold points used to represent a ManifoldKernelDensity (or parametric) belief.
  • bw::Matrix{Float64}: Common kernel bandwith parameter used with ManifoldKernelDensity, see field covar for the parametric covariance.
  • covar::Array{StaticArraysCore.SMatrix{N, N, Float64}, 1} where N: Parametric (Gaussian) covariance.

  • BayesNetOutVertIDs::Vector{Symbol}

  • dimIDs::Vector{Int64}

  • dims::Int64

  • eliminated::Bool: Flag used by junction (Bayes) tree construction algorithm to know whether this variable has yet been included in the tree construction.

  • BayesNetVertID::Symbol

  • separator::Vector{Symbol}

  • initialized::Bool: False if initial numerical values are not yet available or stored values are not ready for further processing yet.

  • infoPerCoord::Vector{Float64}: Stores the amount information (per measurement dimension) captured in each coordinate dimension.
  • ismargin::Bool: Should this variable solveKey be treated as marginalized in inference computations.
  • dontmargin::Bool: Should this variable solveKey always be kept fluid and not be automatically marginalized.
  • solveInProgress::Int64: Convenience flag on whether a solver is currently busy working on this variable solveKey.
  • solvedCount::Int64: How many times has a solver updated this variable solveKey estimte.
  • solveKey::Symbol: solveKey identifier associated with this VariableNodeData object.
  • events::Dict{Symbol, Base.GenericCondition{ReentrantLock}}: Future proofing field for when more multithreading operations on graph nodes are implemented, these conditions are meant to be used for atomic write transactions to this VND.
source
DistributedFactorGraphs.VariableSummaryType
struct VariableSummary <: AbstractDFGVariable

Summary variable structure for a DistributedFactorGraph variable.


Fields:

source

DFG Factor Nodes

DistributedFactorGraphs.FactorComputeType
struct FactorCompute{T, N} <: AbstractDFGFactor

Complete factor structure for a DistributedFactorGraph factor.

DevNotes

  • TODO make consistent the order of fields skeleton Skeleton, Summary, thru FactorCompute

    • e.g. timestamp should be a later field.

Fields:

  • id::Union{Nothing, Base.UUID}: The ID for the factor

  • label::Symbol: Factor label, e.g. :x1f1. Accessor: getLabel

  • tags::Set{Symbol}: Factor tags, e.g [:FACTOR]. Accessors: getTags, mergeTags!, and removeTags!

  • _variableOrderSymbols::Tuple{Vararg{Symbol, N}} where N: Internal cache of the ordering of the neighbor variables. Rather use getVariableOrder to get the list as this is an internal value. Accessors: getVariableOrder

  • timestamp::TimeZones.ZonedDateTime: Variable timestamp. Accessors: getTimestamp, setTimestamp

  • nstime::Dates.Nanosecond: Nano second time, for more resolution on timestamp (only subsecond information)

  • solverData::Base.RefValue{GenericFunctionNodeData{T}} where T: Solver data. Accessors: getSolverData, setSolverData!

  • solvable::Base.RefValue{Int64}: Solvable flag for the factor. Accessors: getSolvable, setSolvable!

  • smallData::Dict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}: Dictionary of small data associated with this variable. Accessors: getMetadata, setMetadata!

source
DistributedFactorGraphs.FactorSkeletonType
struct FactorSkeleton <: AbstractDFGFactor

Skeleton factor structure for a DistributedFactorGraph factor.


Fields:

  • id::Union{Nothing, Base.UUID}: The ID for the factor

  • label::Symbol: Factor label, e.g. :x1f1. Accessor: getLabel

  • tags::Set{Symbol}: Factor tags, e.g [:FACTOR]. Accessors: getTags, mergeTags!, and removeTags!

  • _variableOrderSymbols::Vector{Symbol}: Internal cache of the ordering of the neighbor variables. Rather use listNeighbors to get the list as this is an internal value. Accessors: getVariableOrder

source
DistributedFactorGraphs.FactorSummaryType
struct FactorSummary <: AbstractDFGFactor

Read-only summary factor structure for a DistributedFactorGraph factor.


Fields:

  • id::Union{Nothing, Base.UUID}: The ID for the factor

  • label::Symbol: Factor label, e.g. :x1f1. Accessor: getLabel

  • tags::Set{Symbol}: Factor tags, e.g [:FACTOR]. Accessors: getTags, mergeTags!, and removeTags!

  • _variableOrderSymbols::Vector{Symbol}: Internal cache of the ordering of the neighbor variables. Rather use listNeighbors to get the list as this is an internal value. Accessors: getVariableOrder

  • timestamp::TimeZones.ZonedDateTime: Variable timestamp. Accessors: getTimestamp

source
DistributedFactorGraphs.GenericFunctionNodeDataType
mutable struct GenericFunctionNodeData{T<:(Union{var"#s14", var"#s13", var"#s12"} where {var"#s14"<:AbstractPackedFactor, var"#s13"<:AbstractFactor, var"#s12"<:FactorOperationalMemory})}

Notes

  • S::Symbol

Designing (WIP)

  • T <: Union{FactorOperationalMemory, AbstractPackedFactor}
  • in IIF.CCW{T <: DFG.AbstractFactor}
  • in DFG.AbstractRelativeMinimize <: AbstractFactor
  • in Main.SomeFactor <: AbstractRelativeMinimize
source

DFG Plots [GraphPlot.jl]

DistributedFactorGraphs.plotDFGFunction

Plots the structure of the factor graph. GraphPlot must be imported before DistributedFactorGraphs for these functions to be available. Returns the plot context.

E.g.

using GraphPlot
using DistributedFactorGraphs, DistributedFactorGraphs.DFGPlots
# ... Make graph...
# Using GraphViz plotting
plotDFG(fg)
# Save to PDF
using Compose
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), plotDFG(fg))

More information at GraphPlot.jl

source

Drivers

GraphsDFGs

FileDFG

DistributedFactorGraphs.loadDFG!Method
loadDFG!(dfgLoadInto, dst; overwriteDFGMetadata)

Load a DFG from a saved folder.

Example

using DistributedFactorGraphs, IncrementalInference
# Create a DFG - can make one directly, e.g. GraphsDFG{NoSolverParams}() or use IIF:
dfg = initfg()
# Load the graph
loadDFG!(dfg, "/tmp/savedgraph.tar.gz")
# Use the DFG as you do normally.
ls(dfg)

See also: loadDFG, saveDFG

source
DistributedFactorGraphs.saveDFGMethod
saveDFG(folder, dfg; saveMetadata)

Save a DFG to a folder. Will create/overwrite folder if it exists.

DevNotes:

  • TODO remove compress kwarg.

Example

using DistributedFactorGraphs, IncrementalInference
# Create a DFG - can make one directly, e.g. GraphsDFG{NoSolverParams}() or use IIF:
dfg = initfg()
# ... Add stuff to graph using either IIF or DFG:
v1 = addVariable!(dfg, :a, ContinuousScalar, tags = [:POSE], solvable=0)
# Now save it:
saveDFG(dfg, "/tmp/saveDFG.tar.gz")
source