Function Reference

DistributedFactorGraphs Functions Reference

DistributedFactorGraphs Module

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

Entities

Abstract DFG

abstract type AbstractDFG{T<:AbstractParams}

Abstract parent struct for a DFG graph.

source
abstract type AbstractDFGFactor <: DFGNode

An abstract DFG factor.

source
abstract type AbstractDFGVariable <: DFGNode

An abstract DFG variable.

source
abstract type AbstractDataEntry

Abstract parent struct for big data entry.

source
abstract type AbstractParams

Abstract parent struct for solver parameters.

source
abstract type DFGNode

Abstract parent struct for DFG variables and factors.

source
struct NoSolverParams <: AbstractParams

Empty structure for solver parameters.

source

Summary DFG

DFG Variable Nodes

struct DFGVariable{T<:InferenceVariable} <: AbstractDFGVariable

Complete variable structure for a DistributedFactorGraph variable.


Fields:

  • label::Symbol

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

  • timestamp::TimeZones.ZonedDateTime

    Variable timestamp. Accessors: getTimestamp, setTimestamp

  • nstime::Dates.Nanosecond

    Nano second time, for more resolution on timestamp (only subsecond information)

  • tags::Set{Symbol}

    Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK]. Accessors: getTags, mergeTags!, and removeTags!

  • ppeDict::Dict{Symbol, var"#s19"} where var"#s19"<:AbstractPointParametricEst

    Dictionary of parametric point estimates keyed by solverDataDict keys Accessors: addPPE!, updatePPE!, and deletePPE!

  • solverDataDict::Dict{Symbol, VariableNodeData{T}} where T<:InferenceVariable

    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: getSmallData, setSmallData!

  • dataDict::Dict{Symbol, AbstractDataEntry}

    Dictionary of large data associated with this variable. Accessors: addDataEntry!, getDataEntry, updateDataEntry!, and deleteDataEntry!

  • solvable::Base.RefValue{Int64}

    Solvable flag for the variable. Accessors: getSolvable, setSolvable!

source
DFGVariable(label, variableType; timestamp, nstime, tags, estimateDict, solverDataDict, smallData, dataDict, solvable)

The default DFGVariable constructor.

source
struct DFGVariableSummary <: AbstractDFGVariable

Summary variable structure for a DistributedFactorGraph variable.


Fields:

source
struct MeanMaxPPE <: AbstractPointParametricEst

Data container to store Parameteric Point Estimate (PPE) for mean and max.

source
mutable struct PackedVariableNodeData

Packed VariabeNodeData structure for serializing DFGVariables.


Fields:

  • 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

  • inferdim::Float64

  • ismargin::Bool

  • dontmargin::Bool

  • solveInProgress::Int64

  • solvedCount::Int64

  • solveKey::Symbol

source
struct SkeletonDFGVariable <: AbstractDFGVariable

Skeleton variable structure for a DistributedFactorGraph variable.


Fields:

source
mutable struct VariableNodeData{T<:InferenceVariable}

Data container for solver-specific data.


Fields:

  • val::Matrix{Float64}

  • bw::Matrix{Float64}

  • BayesNetOutVertIDs::Vector{Symbol}

  • dimIDs::Vector{Int64}

  • dims::Int64

  • eliminated::Bool

  • BayesNetVertID::Symbol

  • separator::Vector{Symbol}

  • variableType::InferenceVariable

  • initialized::Bool

  • inferdim::Float64

  • ismargin::Bool

  • dontmargin::Bool

  • solveInProgress::Int64

  • solvedCount::Int64

  • solveKey::Symbol

  • events::Dict{Symbol, Base.GenericCondition{ReentrantLock}}

source
getEstimateFields(_)

Return the fields of MeanMaxPPE that are estimates. NOTE: This is needed for each AbstractPointParametricEst. Closest we can get to a decorator pattern.

source

DFG Factor Nodes

struct DFGFactor{T, N} <: AbstractDFGFactor

Complete factor structure for a DistributedFactorGraph factor.


Fields:

  • label::Symbol

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

  • timestamp::TimeZones.ZonedDateTime

    Variable timestamp. Accessors: getTimestamp, setTimestamp

  • nstime::Dates.Nanosecond

    Nano second time, for more resolution on timestamp (only subsecond information)

  • tags::Set{Symbol}

    Factor tags, e.g [:FACTOR]. Accessors: getTags, mergeTags!, and removeTags!

  • solverData::Base.RefValue{GenericFunctionNodeData{T}} where T

    Solver data. Accessors: getSolverData, setSolverData!

  • solvable::Base.RefValue{Int64}

    Solvable flag for the factor. Accessors: getSolvable, setSolvable!

  • _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

source
DFGFactor(label, timestamp, nstime, tags, solverData, solvable, _variableOrderSymbols)

Construct a DFG factor given a label.

source
struct DFGFactorSummary <: AbstractDFGFactor

Read-only summary factor structure for a DistributedFactorGraph factor.


Fields:

  • label::Symbol

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

  • timestamp::TimeZones.ZonedDateTime

    Variable timestamp. Accessors: getTimestamp

  • 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 getNeighbors to get the list as this is an internal value. Accessors: getVariableOrder

source
mutable struct GenericFunctionNodeData{T<:Union{AbstractFactor, AbstractPackedFactor, FactorOperationalMemory}}

Notes

  • S::Symbol

Designing (WIP)

  • T <: Union{FactorOperationalMemory, PackedInferenceType}
  • in IIF.CCW{T <: DFG.FunctorInferenceType}
  • in DFG.AbstractRelativeMinimize <: FunctorInferenceType
  • in Main.SomeFactor <: AbstractRelativeMinimize
source
struct SkeletonDFGFactor <: AbstractDFGFactor

Skeleton factor structure for a DistributedFactorGraph factor.


Fields:

  • 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 getNeighbors to get the list as this is an internal value. Accessors: getVariableOrder

source

Services

Abstract DFG

_getDuplicatedEmptyDFG(dfg)

Gets an empty and unique CloudGraphsDFG derived from an existing DFG.

source

Add a DFGFactor to a DFG.

addFactor!(dfg, factor)
source
addFactor!(dfg, variableLabels, factor)
source
addFactor!(dfg, variables, factor)
source
addVariable!(dfg, variable)

Add a DFGVariable to a DFG.

source
buildSubgraph(, dfg, variableFactorLabels)
buildSubgraph(, dfg, variableFactorLabels, distance; solvable, sessionId, kwargs...)

Build a deep subgraph copy from the DFG given a list of variables and factors and an optional distance. Note: Orphaned factors (where the subgraph does not contain all the related variables) are not returned. Related:

Dev Notes

  • Bulk vs node for node: a list of labels are compiled and the sugraph is copied in bulk.
source
copyGraph!(destDFG, sourceDFG, variableLabels, factorLabels; copyGraphMetadata, overwriteDest, deepcopyNodes, verbose)

Common function for copying nodes from one graph into another graph. This is overridden in specialized implementations for performance. Orphaned factors are not added, with a warning if verbose. Set overwriteDest to overwrite existing variables and factors in the destination DFG. NOTE: copyGraphMetadata not supported yet. Related:

source
deepcopyGraph!(destDFG, sourceDFG)
deepcopyGraph!(destDFG, sourceDFG, variableLabels)
deepcopyGraph!(destDFG, sourceDFG, variableLabels, factorLabels; kwargs...)

Copy nodes from one graph into another graph by making deepcopies. see copyGraph! for more detail. Related:

source
deepcopyGraph(, sourceDFG)
deepcopyGraph(, sourceDFG, variableLabels)
deepcopyGraph(, sourceDFG, variableLabels, factorLabels; sessionId, kwargs...)

Copy nodes from one graph into a new graph by making deepcopies. see copyGraph! for more detail. Related:

source
deleteFactor!(dfg, factor)

Delete the referened DFGFactor from the DFG.

source
deleteFactor!(dfg, label)

Delete a DFGFactor from the DFG using its label.

source
deleteVariable!(dfg, variable)

Delete a referenced DFGVariable from the DFG.

Notes

  • Returns Tuple{AbstractDFGVariable, Vector{<:AbstractDFGFactor}}
source
deleteVariable!(dfg, label)

Delete a DFGVariable from the DFG using its label.

source
exists(dfg, node)

True if the variable or factor exists in the graph.

source
findClosestTimestamp(setA, setB)

Find and return the closest timestamp from two sets of Tuples. Also return the minimum delta-time (::Millisecond) and how many elements match from the two sets are separated by the minimum delta-time.

source
findFactorsBetweenNaive(dfg, from, to)
findFactorsBetweenNaive(dfg, from, to, assertSingles)

Relatively naive function counting linearly from-to

DevNotes

  • Convert to using LightGraphs shortest path methods instead.
source
findVariableNearTimestamp(dfg, timest)
findVariableNearTimestamp(dfg, timest, regexFilter; tags, solvable, warnDuplicate, number)

Find and return nearest variable labels per delta time. Function will filter on regexFilter, tags, and solvable.

Notes

  • Returns Vector{Tuple{Vector{Symbol}, Millisecond}}

DevNotes:

  • TODO number should allow returning more than one for k-nearest matches.
  • Future versions likely will require some optimization around the internal getVariable call.
    • Perhaps a dedicated/efficient getVariableTimestamp for all DFG flavors.

Related

ls, listVariables, findClosestTimestamp

source
getAddHistory(dfg)
source
getBiadjacencyMatrix(dfg; solvable)

Get a matrix indicating adjacency between variables and factors. Returned as a named tuple: B::SparseMatrixCSC{Int}, varLabels::Vector{Symbol) facLabels::Vector{Symbol). Rows are the factors, columns are the variables, with the corresponding labels in varLabels,facLabels.

Notes

  • Returns ::NamedTuple{(:B, :varLabels, :facLabels), Tuple{SparseMatrixCSC, Vector{Symbol}, Vector{Symbol}}}
source
getDFGInfo(dfg)

Convenience function to get all the metadata of a DFG

source
getDescription(dfg)
source

Get a DFGFactor from a DFG using its label.

source

List the DFGFactors in the DFG. Optionally specify a label regular expression to retrieves a subset of the factors.

source
getNeighborhood(dfg, label, distance)

Build a list of all unique neighbors inside 'distance'

Notes

  • Returns Vector{Symbol}

Related:

source
getNeighbors(dfg, label; solvable)

Retrieve a list of labels of the immediate neighbors around a given variable or factor specified by its label.

source
getRobotData(dfg)

Get the robot data associated with the graph.

source
getRobotId(dfg)
source
getSessionData(dfg)

Get the session data associated with the graph.

source
getSessionId(dfg)
source
getSolverParams(dfg)
source

Get a summary of the graph (first-class citizens of variables and factors). Returns a DFGSummary.

Notes

  • Returns ::DFGSummary
source

Get a summary graph (first-class citizens of variables and factors) with the same structure as the original graph.

Notes

  • this is a copy of the original.
  • Returns ::LightDFG{NoSolverParams, DFGVariableSummary, DFGFactorSummary}
source
getUserData(dfg)

Get the user data associated with the graph.

source
getUserId(dfg)
source
getVariable(dfg, label, solveKey)

Get a DFGVariable with a specific solver key. In memory types still return a reference, other types returns a variable with only solveKey.

source
getVariable(dfg, label)

Get a DFGVariable from a DFG using its label.

source

List the DFGVariables in the DFG. Optionally specify a label regular expression to retrieves a subset of the variables. Tags is a list of any tags that a node must have (at least one match).

source
hasTags(dfg, sym, tags; matchAll)

Determine if the variable or factor neighbors have the tags:;Vector{Symbol}, and matchAll::Bool.

source
hasTagsNeighbors(dfg, sym, tags; matchAll)

Determine if the variable or factor neighbors have the tags:;Vector{Symbol}, and matchAll::Bool.

source
isConnected(dfg)

Checks if the graph is fully connected, returns true if so.

source

Return whether sym::Symbol represents a factor vertex in the graph DFG. Checks whether it both exists in the graph and is a factor. (If you rather want a quicker for type, just do node isa DFGFactor)

source
isPathFactorsHomogeneous(dfg, from, to)

Return (::Bool,::Vector{TypeName}) of types between two nodes in the factor graph

DevNotes

  • Only works on LigthDFG at the moment.

Related

LightDFG.findShortestPathDijkstra

source

Return whether sym::Symbol represents a variable vertex in the graph DFG. Checks whether it both exists in the graph and is a variable. (If you rather want a quick for type, just do node isa DFGVariable)

source
listFactors(dfg)
listFactors(dfg, regexFilter; tags, solvable)

Get a list of the IDs (labels) of the DFGFactors in the DFG. Optionally specify a label regular expression to retrieves a subset of the factors.

source
listSolveKeys(variable::DFGVariable) -> Set{Symbol}
listSolveKeys(variable::DFGVariable, filterSolveKeys::Union{Nothing, Regex}) -> Set{Symbol}
listSolveKeys(variable::DFGVariable, filterSolveKeys::Union{Nothing, Regex}, skeys) -> Any

List all the solvekeys used amongst all variables in the distributed factor graph object.

Related

listSupersolves, getSolverDataDict, listVariables

source
listVariables(dfg)
listVariables(dfg, regexFilter; tags, solvable)

Get a list of IDs of the DFGVariables in the DFG. Optionally specify a label regular expression to retrieves a subset of the variables. Tags is a list of any tags that a node must have (at least one match).

NOtes

  • Returns ::Vector{Symbol}

Example

listVariables(dfg, r"l", tags=[:APRILTAG;])

Related:

  • ls
source

List the DFGVariables in the DFG. Optionally specify a label regular expression to retrieves a subset of the variables. Tags is a list of any tags that a node must have (at least one match).

Notes:

  • Returns Vector{Symbol}
source
ls(dfg)
ls(dfg, node; solvable)

Retrieve a list of labels of the immediate neighbors around a given variable or factor.

source
ls2(dfg, label)

Helper to return neighbors at distance 2 around a given node label.

source
lsTypes(dfg)

Return Vector{Symbol} of all unique variable types in factor graph.

source
lsTypesDict(dfg)

Return ::Dict{Symbol, Vector{Symbol}} of all unique variable types with labels in a factor graph.

source
lsWho(dfg, type)

Gives back all factor labels that fit the bill: lsWho(dfg, :Pose3)

Notes

  • Returns Vector{Symbol}

Dev Notes

  • Cloud versions will benefit from less data transfer
  • ls(dfg::C, ::T) where {C <: CloudDFG, T <: ..}

Related

ls, lsf, lsfPriors

source

List the DFGFactors in the DFG. Optionally specify a label regular expression to retrieves a subset of the factors.

Notes

  • Return Vector{Symbol}
source

Return vector of prior factor symbol labels in factor graph dfg.

Notes:

  • Returns Vector{Symbol}
source
lsfTypes(dfg)

Return Vector{Symbol} of all unique factor types in factor graph.

source
lsfTypesDict(dfg)

Return ::Dict{Symbol, Vector{Symbol}} of all unique factors types with labels in a factor graph.

source
lsfWho(dfg, type)

Gives back all factor labels that fit the bill: lsfWho(dfg, :Point2Point2)

Notes

  • Returns Vector{Symbol}

Dev Notes

  • Cloud versions will benefit from less data transfer
  • ls(dfg::C, ::T) where {C <: CloudDFG, T <: ..}

Related

ls, lsf, lsfPriors

source
mergeGraph!(destDFG, sourceDFG)
mergeGraph!(destDFG, sourceDFG, variableLabels)
mergeGraph!(destDFG, sourceDFG, variableLabels, factorLabels)
mergeGraph!(destDFG, sourceDFG, variableLabels, factorLabels, distance; solvable, kwargs...)

Merger sourceDFG to destDFG given an optional list of variables and factors and distance. Notes:

  • Nodes already in the destination graph are updated from sourceDFG.
  • Orphaned factors (where the subgraph does not contain all the related variables) are not included.

Related:

source
mergeGraphVariableData!(destDFG, sourceDFG, varSyms)

Common function to update all solver data and estimates from one graph to another. This should be used to push local solve data back into a cloud graph, for example.

Notes

  • Returns ::Nothing
source
mergeVariableData!(dfg, sourceVariable)

Merges and updates solver and estimate data for a variable (variable can be from another graph). Note: Makes a copy of the estimates and solver data so that there is no coupling between graphs.

source
rebuildFactorMetadata!(dfg, factor)

Method must be overloaded by the user for Serialization to work.

source
setDescription!(dfg, description)
source
setRobotData!(dfg, data)

Set the robot data associated with the graph.

source
setSessionData!(dfg, data)

Set the session data associated with the graph.

source
setUserData!(dfg, data)

Set the user data associated with the graph.

source
toDot(dfg)

Produces a dot-format of the graph for visualization.

Notes

  • Returns ::String
source
toDotFile(dfg)
toDotFile(dfg, fileName)

Produces a dot file of the graph for visualization. Download XDot to see the data

Note

  • Default location "/tmp/dfg.dot" – MIGHT BE REMOVED
  • Can be viewed with the xdot system application.
  • Based on graphviz.org
source

Update a complete DFGFactor in the DFG.

source

Update a complete DFGVariable in the DFG.

source
getAdjacencyMatrixSymbols(dfg; solvable)

Get a matrix indicating relationships between variables and factors. Rows are all factors, columns are all variables, and each cell contains either nothing or the symbol of the relating factor. The first row and first column are factor and variable headings respectively. Note:

  • rather use getBiadjacencyMatrix
  • Returns either of ::Matrix{Union{Nothing, Symbol}}
source
getFactorOperationalMemoryType(dummy)

Method must be overloaded by the user for Serialization to work. E.g. IncrementalInference uses CommonConvWrapper <: FactorOperationalMemory.

source
setRobotId!(dfg, robotId)
source
setSessionId!(dfg, sessionId)
source
setUserId!(dfg, userId)
source

Common Accessors

Common Accessors to both variable and factor nodes

emptyTags!(dfg, sym)

Empty all tags from the node (empty)

source
getLabel(v)

Return the label for a DFGNode.

source
getSolvable(dfg, sym)

Get 'solvable' parameter for either a variable or factor.

source
getSolvable(var)

Variables or factors may or may not be 'solvable', depending on a user definition. Useful for ensuring atomic transactions.

Related:

  • isSolveInProgress
source
getSolveInProgress(var)
getSolveInProgress(var, solveKey)

Which variables or factors are currently being used by an active solver. Useful for ensuring atomic transactions.

DevNotes:

  • Will be renamed to data.solveinprogress which will be in VND, not DFGNode – see DFG #201

Related

isSolvable

source
getTags(v)

Return the tags for a DFGNode.

source
getTimestamp(v)

Get the timestamp of a DFGNode.

source
isSolvable(node)

Variables or factors may or may not be 'solvable', depending on a user definition. returns true if getSolvable > 0 Related:

  • getSolvable(@ref)
source
listTags(dfg, sym)

Return the tags for a variable or factor.

source
mergeTags!(dfg, sym, tags)

Merge add tags to a variable or factor (union)

source
removeTags!(dfg, sym, tags)

Remove the tags from the node (setdiff)

source
setSolvable!(dfg, sym, solvable)

Set the solvable parameter for either a variable or factor.

source
setSolvable!(node, solvable)

Set the solvable parameter for either a variable or factor.

source
setTags!(f, tags)

Set the tags for a DFGNode.

source
setTimestamp!(dfg, lbl, ts)

Set the timestamp of a Variable/Factor object in a factor graph. Note: Since timestamp is not mutable setTimestamp! calls updateVariable! internally. See also setTimestamp

source

DFG Variable Accessors CRUD and SET opperations

addPPE!(dfg, sourceVariable)
addPPE!(dfg, sourceVariable, ppekey)

Add a new PPE entry from a deepcopy of the source variable PPE. NOTE: Copies the PPE.

source
addPPE!(dfg, variablekey, ppe)

Add variable PPE, errors if it already exists.

source
addSmallData!(dfg, label, pair)

Add a small data pair key=>value for variable label in dfg

source
addVariableSolverData!(dfg, sourceVariable)
addVariableSolverData!(dfg, sourceVariable, solveKey)

Add a new solver data entry from a deepcopy of the source variable solver data. NOTE: Copies the solver data.

source
addVariableSolverData!(dfg, variablekey, vnd)

Add variable solver data, errors if it already exists.

source
deepcopySolvekeys!(dfg, dest, src; solvable, labels, verbose)

Duplicate a supersolve (solveKey).

source
deletePPE!(dfg, sourceVariable)
deletePPE!(dfg, sourceVariable, ppekey)

Delete PPE data, returns the deleted element.

source
deletePPE!(dfg, variablekey)
deletePPE!(dfg, variablekey, ppekey)

Delete PPE data, returns the deleted element.

source
deleteSmallData!(dfg, label, key)

Delete a small data entry at key for variable label in dfg

source
deleteVariableSolverData!(dfg, sourceVariable)
deleteVariableSolverData!(dfg, sourceVariable, solveKey)

Delete variable solver data, returns the deleted element.

source
deleteVariableSolverData!(dfg, variablekey)
deleteVariableSolverData!(dfg, variablekey, solveKey)

Delete variable solver data, returns the deleted element.

source
emptySmallData!(dfg, label)

Empty all small data from variable label in dfg

source

Interface function to return the variableType dimension of an InferenceVariable, extend this function for all Types<:InferenceVariable.

source
getLastUpdatedTimestamp(est)
source
getManifold(vari)

Interface function to return the <:ManifoldsBase.AbstractManifold object of variableType<:InferenceVariable, extend this function for all Types<:InferenceVariable.

source
getPPE(dfg, variablekey)
getPPE(dfg, variablekey, ppekey)

Get the parametric point estimate (PPE) for a variable in the factor graph for a given solve key.

Notes

  • Defaults on keywords solveKey and method

Related getMeanPPE, getMaxPPE, getKDEMean, getKDEFit, getPPEs, getVariablePPEs

source
getPPE(vari)
getPPE(vari, solveKey)

Get the parametric point estimate (PPE) for a variable in the factor graph.

Notes

  • Defaults on keywords solveKey and method

Related

getMeanPPE, getMaxPPE, getKDEMean, getKDEFit, getPPEs, getVariablePPEs

source
getPPEDict(v)

Get the PPE dictionary for a variable. Recommended to use CRUD operations instead, getPPE, addPPE!, updatePPE!, deletePPE!.

source
getPPEMax(est)
source
getPPEMean(est)
source
getPPESuggested(est)
source
getSmallData(dfg, label, key)

Get the small data entry at key for variable label in dfg

source
getSmallData(v)

Get the small data for a variable. Note: Rather use SmallData CRUD

source
getSolvedCount(v)

Get the number of times a variable has been inferred – i.e. solvedCount.

Related

isSolved, setSolvedCount!

source
getSolverData(v)
getSolverData(v, key)

Retrieve solver data structure stored in a variable.

source
getSolverDataDict(v)

Get solver data dictionary for a variable. Advised to use graph CRUD operations instead.

source
getVariablePPEDict(vari)

Return full dictionary of PPEs in a variable, recommended to rather use CRUD: getPPE,

source
getVariableSolverData(dfg, variablekey)
getVariableSolverData(dfg, variablekey, solvekey)

Get variable solverdata for a given solve key.

source
getVariableType(v)

Variable nodes variableType information holding a variety of meta data associated with the type of variable stored in that node of the factor graph.

DevWork

  • TODO, see IncrementalInference.jl 1228

Related

getVariableType

source
getVariableTypeName(v)

Retrieve the soft type name symbol for a DFGVariableSummary. ie :Point2, Pose2, etc.

source
isInitialized(var)
isInitialized(var, key)

Returns state of variable data .initialized flag.

Notes:

  • used by both factor graph variable and Bayes tree clique logic.
source
isMarginalized(vert)
isMarginalized(vert, solveKey)

Return ::Bool on whether this variable has been marginalized.

Notes:

  • VariableNodeData default solveKey=:default
source
isSolved(v)

Boolean on whether the variable has been solved.

Related

getSolved, setSolved!

source
listPPEs(dfg, variablekey)

List all the PPE data keys in the variable.

source
listSmallData(dfg, label)

List all small data keys for a variable label in dfg

source
listVariableSolverData(dfg, variablekey)

List all the solver data keys in the variable.

source
mergePPEs!(destVariable, sourceVariable)

Merges and updates solver and estimate data for a variable (variable can be from another graph). Note: Makes a copy of the estimates and solver data so that there is no coupling between graphs.

source
mergeVariableSolverData!(destVariable, sourceVariable)

Merges and updates solver and estimate data for a variable (variable can be from another graph). If the same key is present in another collection, the value for that key will be the value it has in the last collection listed (updated). Note: Makes a copy of the estimates and solver data so that there is no coupling between graphs.

source
setMarginalized!(vnd, val)

Mark a variable as marginalized true or false.

source
setSmallData!(v, smallData)

Set the small data for a variable. This will overwrite old smallData. Note: Rather use SmallData CRUD

source
setSolvedCount!(v, val)

Update/set the solveCount value.

Related

getSolved, isSolved

source
setSolverData!(v, data)
setSolverData!(v, data, key)

Set solver data structure stored in a variable.

source
setTimestamp(v, ts; verbose)

Set the timestamp of a DFGVariable object returning a new DFGVariable. Note: Since the timestamp field is not mutable setTimestamp returns a new variable with the updated timestamp (note the absence of !). Use updateVariable! on the returened variable to update it in the factor graph if needed. Alternatively use setTimestamp!. See issue #315.

source
updatePPE!(dfg, sourceVariables)
updatePPE!(dfg, sourceVariables, ppekey; warn_if_absent)

Update PPE data if it exists, otherwise add it.

source
updatePPE!(dfg, sourceVariable)
updatePPE!(dfg, sourceVariable, ppekey; warn_if_absent)

Update PPE data if it exists, otherwise add it. NOTE: Copies the PPE data.

source
updatePPE!(dfg, variablekey, ppe; warn_if_absent)

Update PPE data if it exists, otherwise add it – one call per key::Symbol=:default.

source
updateSmallData!(dfg, label, pair; warn_if_absent)

Update a small data pair key=>value for variable label in dfg

source
updateVariableSolverData!(dfg, variablekey, vnd)
updateVariableSolverData!(dfg, variablekey, vnd, useCopy)
updateVariableSolverData!(dfg, variablekey, vnd, useCopy, fields; warn_if_absent)

Update variable solver data if it exists, otherwise add it.

Notes:

  • useCopy=true to copy solver data and keep separate memory.
  • Use fields to updated only a few VND.fields while adhering to useCopy.

Related

mergeVariableSolverData!

source
@defVariable StructName manifolds<:ManifoldsBase.AbstractManifold

A macro to create a new variable with name StructName and manifolds. Note that the manifolds is an object and must be a subtype of ManifoldsBase.AbstractManifold. See documentation in Manifolds.jl on making your own.

Example:

DFG.@defVariable Pose2 SpecialEuclidean(2)
source

DFG Factor Accessors CRUD and SET opperations

getFactorFunction(fcd)

Return reference to the user factor in <:AbstractDFG identified by ::Symbol.

source
getFactorType(data)

Return user factor type from factor graph identified by label ::Symbol.

Notes

  • Replaces older getfnctype.
source
getSolverData(f)

Retrieve solver data structure stored in a factor.

source
getVariableOrder(fct)

Get the variable ordering for this factor. Should be equivalent to getNeighbors unless something was deleted in the graph.

source
isPrior(dfg, fc)

Return ::Bool on whether given factor fc::Symbol is a prior in factor graph dfg.

source
_getPriorType(_type)

If you know a variable is ::Type{<:Pose2} but want to find its default prior ::Type{<:PriorPose2}.

Assumptions

  • The prior type will be defined in the same module as the variable type.
  • Not exported per default, but can be used with knowledge of the caveats.

Example

using RoME
@assert RoME.PriorPose2 == DFG._getPriorType(Pose2)
source

Printing

printFactor(dfg, sym; kwargs...)

Display and return to console the user factor identified by tag name.

source
printVariable(dfg, sym; kwargs...)

Display the content of VariableNodeData to console for a given factor graph and variable tag::Symbol.

Dev Notes

  • TODO split as two show macros between AMP and DFG
source

Compare Utilities

compareAll(Al, Bl; show, skip)

Recursively compare the all fields of T that are not in skip for objects Al and Bl.

TODO > add to func_ref.md

source
compareAllVariables(fgA, fgB; skip, show, skipsamples)

Compare all variables in both ::FactorGraphs A and B.

Notes

  • A and B should all the same variables and factors.

Related:

compareFactorGraphs, compareSimilarVariables, compareVariable, ls

source
compareFactor(A, B; show, skip, skipsamples, skipcompute)

Compare that all fields are the same in a ::FactorGraph factor.

source

Compare and return if two factor graph objects are the same, by comparing similar variables and factors.

Notes:

  • Default items to skip with skipsamples, skipcompute.
  • User defined fields to skip can be specified with skip::Vector{Symbol}.
  • To enable debug messages for viewing which fields are not the same:
    • https://stackoverflow.com/questions/53548681/how-to-enable-debugging-messages-in-juno-julia-editor

Related:

compareSimilarVariables, compareSimilarFactors, compareAllVariables, ls.

source
compareFields(Al, Bl; show, skip)

Compare the all fields of T that are not in skip for objects Al and Bl.

TODO > add to func_ref.md

source

Compare similar factors between ::FactorGraphs A and B.

Related:

compareFactorGraphs, compareSimilarVariables, compareAllVariables, ls.

source

Compare similar labels between ::FactorGraphs A and B.

Notes

  • At least one variable label should exist in both A and B.

Related:

compareFactorGraphs, compareAllVariables, compareSimilarFactors, compareVariable, ls.

source
compareVariable(A, B; skip, show, skipsamples)

Compare that all fields are the same in a ::FactorGraph variable.

source

Common Functions

getVariableLabelNumber(vs)
getVariableLabelNumber(vs, prefix)

Small utility to return ::Int, e.g. 0 from getVariableLabelNumber(:x0)

Examples

getVariableLabelNumber(:l10)          # 10
getVariableLabelNumber(:x1)           # 1
getVariableLabelNumber(:x1_10, "x1_") # 10

DevNotes

  • make prefix Regex based for longer – i.e. :apriltag578, :lm1_4
source
isValidLabel(id)

Returns true if the label is valid for a session, robot, or user ID.

source
sortDFG(vars; by, kwargs...)

Convenience wrapper for Base.sort. Sort variable (factor) lists in a meaningful way (by timestamp, label, etc), for example [:april;:x1_3;:x1_6;] Defaults to sorting by timestamp for variables and factors and using natural_lt for Symbols. See Base.sort for more detail.

Notes

  • Not fool proof, but does better than native sort.

Example

sortDFG(ls(dfg)) sortDFG(ls(dfg), by=getLabel, lt=natural_lt)

Related

ls, lsf

source

Serialization

Get a type from the serialization module inside DFG.

source

DFG Plots [GraphPlot.jl]

dfgplot(dfg)
dfgplot(dfg, p)

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
dfgplot(fg)
# Save to PDF
using Compose
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), dfgplot(fg))

More information at GraphPlot.jl

source

Drivers

LightDFGs

An in-memory DistributedFactorGraph based on LightGraphs.jl with parameters:

  • T: Solver parameters (defaults to NoSolverParams())
  • V: Variable type
  • F: Factor type
source
LightDFG()
LightDFG(g; solverParams, kwargs...)

Create an in-memory LightDFG with the following parameters:

  • T: Solver parameters (defaults to NoSolverParams())
  • V: Variable type
  • F: Factor type
source
LightDFG()

Create an in-memory LightDFG with the following parameters:

  • T: Solver parameters (defaults to NoSolverParams())
  • V: Variable type
  • F: Factor type
source
savedot_attributes(io, dfg)

A replacement for to_dot that saves only hardcoded factor graph plotting attributes.

source
_getDuplicatedEmptyDFG(dfg)

Gets an empty and unique LightDFG derived from an existing DFG.

source
findShortestPathDijkstra(dfg, from, to; regexVariables, regexFactors, tagsVariables, tagsFactors, typeVariables, typeFactors, solvable, initialized)

Speciallized function available to only LightDFG at this time.

Notes

  • Has option for various types of filters (increases memory usage)

Example

using IncrementalInference

# canonical example graph as example
fg = generateCanonicalFG_Kaess()

@show path = findShortestPathDijkstra(fg, :x1, :x3)
@show isVariable.(fg, path)
@show isFactor.(fg, path)

DevNotes

  • TODO expand to other AbstractDFG entities.
  • TODO use of filter resource consumption can be improved.

Related

findFactorsBetweenNaive, LightGraphs.dijkstra_shortest_paths

source

FileDFG

loadDFG!(dfgLoadInto, dst)

Load a DFG from a saved folder. Always provide the IIF module as the second parameter.

Example

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

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. LightDFG{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

CloudGraphsDFGs

Modules = [CloudGraphsDFGs]

Data Entries and Blobs

struct BlobStoreEntry <: AbstractDataEntry

Genaral Data Store Entry.

source
struct MongodbDataEntry <: AbstractDataEntry

Data Entry in MongoDB.

source
addDataEntry!(dfg, label, bde)

Add Data Entry to distributed factor graph. Should be extended if DFG variable is not returned by reference.

source
addDataEntry!(var, bde)

Add Data Entry to a DFG variable

source
deleteDataEntry!(var, key)

Delete data entry from the factor graph. Note this doesn't remove it from any data stores.

Notes:

  • users responsibility to delete data in db before deleting entry
source
getDataEntries(var)

Get data entries, Vector{AbstractDataEntry}

source
getDataEntry(var, key)

Get data entry

source
hasDataEntry(var, key)

Does a data entry (element) exist at key.

source
listDataEntries(var)

listDataEntries

source
updateDataEntry!(var, bde)

Update data entry

DevNote

  • DF, unclear if update verb is applicable in this case, see #404
source

Add a data Entry and Blob to a distributed factor graph or BlobStore. Related addDataEntry!

addData!(dfg, blobstore, label, entry, blob; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:73.

addData!(dfg, blobstorekey, label, key, blob)
addData!(dfg, blobstorekey, label, key, blob, timestamp; kwargs...)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:103.

addData!(dfg, blobstore, label, key, blob)
addData!(dfg, blobstore, label, key, blob, timestamp; description, mimeType, id, hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:111.

addData!(dfg, label, entry, blob; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/DataEntryBlob.jl:122.

addData!(, dfg, label, key, folder, blob)
addData!(, dfg, label, key, folder, blob, timestamp; id, hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/FileDataEntryBlob.jl:95.

addData!(dfg, label, entry; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/InMemoryDataEntryBlob.jl:32.

addData!(, dfg, label, key, blob)
addData!(, dfg, label, key, blob, timestamp; id, hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/InMemoryDataEntryBlob.jl:50.

addData!(dfg, lbl, datastore, descr, mimeType, data)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/Deprecated.jl:58.

source

Adds a blob to the blob store or dfg with the given entry.

source

Delete a data entry and blob from the blob store or dfg. Related deleteDataEntry!

deleteData!(dfg, blobstore, label, entry)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:91.

deleteData!(dfg, blobstore, label, key)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:94.

deleteData!(dfg, label, key)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/DataEntryBlob.jl:136.

source

Delete a blob to the blob store or dfg with the given entry.

source

Get the data entry and blob for the specified blobstore or dfg retured as a tuple. Related getDataEntry

getData(dfg, blobstore, label, key; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:66.

getData(dfg, label, key; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/DataEntryBlob.jl:114.

source

Get the data blob for the specified blobstore or dfg.

source

List all ids in the blob store.

source

Update a data entry or blob to the blob store or dfg. Related updateDataEntry!

updateData!(dfg, blobstore, label, entry, blob; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/BlobStores.jl:80.

updateData!(dfg, label, entry, blob; hashfunction)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/DataEntryBlob.jl:129.

updateData!(dfg, label, entry)

defined at /home/travis/build/JuliaRobotics/DistributedFactorGraphs.jl/src/DataBlobs/services/InMemoryDataEntryBlob.jl:39.

source

Update a blob to the blob store or dfg with the given entry.

source
struct FileDataEntry <: AbstractDataEntry

Data Entry in a file.

source
struct InMemoryDataEntry{T} <: AbstractDataEntry

Store data temporary in memory. NOTE: Neither Entry nor Blob will be persisted.

source
buildSourceString(dfg, label)

Function to generate source string - userId|robotId|sessionId|varLabel

source