DistributedFactorGraphs Functions
Abstract DFG
DistributedFactorGraphs.addFactor! — Function
Add a FactorDFG to a DFG. Implement addFactor!(dfg::AbstractDFG, factor::AbstractGraphFactor)
DistributedFactorGraphs.addFactors! — Method
addFactors!(dfg, factors)
Add a Vector{FactorDFG} to a DFG.
DistributedFactorGraphs.addVariable! — Function
Add a VariableDFG to a DFG. Implement addVariable!(dfg::AbstractDFG, variable::AbstractGraphVariable)
DistributedFactorGraphs.addVariables! — Method
addVariables!(dfg, variables)
Add a Vector{VariableDFG} to a DFG. Implement addVariables!(dfg::AbstractDFG, variables::Vector{<:AbstractGraphVariable})
DistributedFactorGraphs.buildSubgraph — Method
buildSubgraph(, dfg, variableFactorLabels; ...)
buildSubgraph(
,
dfg,
variableFactorLabels,
distance;
solvable,
graphLabel,
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.
DistributedFactorGraphs.copyGraph! — Function
copyGraph!(destDFG, sourceDFG; ...)
copyGraph!(destDFG, sourceDFG, variableLabels; ...)
copyGraph!(
destDFG,
sourceDFG,
variableLabels,
factorLabels;
copyGraphMetadata,
overwriteDest,
deepcopyNodes,
verbose,
showprogress
)
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 is deprecated – use agent/graph Bloblets instead. Related:
DistributedFactorGraphs.deepcopyGraph! — Function
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:
DistributedFactorGraphs.deepcopyGraph — Method
deepcopyGraph(, sourceDFG; ...)
deepcopyGraph(, sourceDFG, variableLabels; ...)
deepcopyGraph(
,
sourceDFG,
variableLabels,
factorLabels;
graphLabel,
kwargs...
)
Copy nodes from one graph into a new graph by making deepcopies. see copyGraph! for more detail. Related:
DistributedFactorGraphs.deleteFactor! — Function
Delete a FactorDFG from the DFG using its label. Implement deleteFactor!(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.deleteFactor! — Method
deleteFactor!(dfg, factor)
Delete the referenced Factor from the DFG.
DistributedFactorGraphs.deleteVariable! — Function
Delete a VariableDFG from the DFG. Implement deleteVariable!(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.exists — Method
exists(dfg, label)
True if a variable or factor with label exists in the graph.
DistributedFactorGraphs.getAdjacencyMatrixSymbols — Method
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}}
DistributedFactorGraphs.getAgent — Function
DistributedFactorGraphs.getAgentLabel — Method
getAgentLabel(dfg)
DistributedFactorGraphs.getBiadjacencyMatrix — Method
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}}}
DistributedFactorGraphs.getFactor — Function
Get a FactorDFG from a DFG using its label. Implement getFactor(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.getFactors — Function
List the DFGFactors in the DFG. Optionally specify a label regular expression to retrieves a subset of the factors.
DistributedFactorGraphs.getFactorsSkeleton — Function
Get the skeleton factors from a DFG as a Vector{FactorSkeleton}.
DistributedFactorGraphs.getGraph — Function
DistributedFactorGraphs.getGraphLabel — Method
getGraphLabel(dfg)
DistributedFactorGraphs.getId — Function
DistributedFactorGraphs.getSolverParams — Method
getSolverParams(dfg)
DistributedFactorGraphs.getSummaryGraph — Method
getSummaryGraph(dfg)
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
::GraphsDFG{NoSolverParams, VariableSummary, FactorSummary}
DistributedFactorGraphs.getTypeDFGFactors — Method
getTypeDFGFactors(_)
Function to get the type of the factors in the DFG.
DistributedFactorGraphs.getTypeDFGVariables — Method
getTypeDFGVariables(_)
Function to get the type of the variables in the DFG.
DistributedFactorGraphs.getVariable — Function
Get a VariableDFG from a DFG using its label. Implement getVariable(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.getVariable — Method
getVariable(dfg, label, solveKey)
Get a VariableDFG with a specific solver key. In memory types still return a reference, other types returns a variable with only solveKey.
DistributedFactorGraphs.getVariableSkeleton — Function
Get a VariableSkeleton from a DFG.
DistributedFactorGraphs.getVariableSummary — Function
Get a VariableSummary from a DFG.
DistributedFactorGraphs.getVariables — Function
Get the variables in the DFG as a Vector, supporting various filters.
Arguments
regexFilt: Optional Regex to filter variable labels (deprecated, uselabelFilterinstead).
Keyword arguments
tags: Vector of tags; only variables with at least one matching tag are returned.solvable: Optional Int; only variables withsolvable >= solvableare returned.solvableFilter: Optional function to filter on thesolvableproperty, eg>=(1).labelFilter: Optional function to filter on label e.g.,contains(r"x1").tagsFilter: Optional function to filter on tags, eg.⊇([:x1]).typeFilter: Optional function to filter on the variable type.
Returns
Vector{<:AbstractGraphVariable}matching the filters.
See also: listVariables, ls
DistributedFactorGraphs.getVariablesSkeleton — Function
Get the variables from a DFG as a Vector{VariableSkeleton}.
DistributedFactorGraphs.getVariablesSummary — Function
Get the variables from a DFG as a Vector{VariableSummary}.
DistributedFactorGraphs.hasFactor — Function
True if the factor exists in the graph. Implement hasFactor(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.hasVariable — Function
True if the variable exists in the graph. Implement hasVariable(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.isConnected — Function
Checks if the graph is fully connected, returns true if so. Implement isConnected(dfg::AbstractDFG)
DistributedFactorGraphs.isFactor — Function
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 FactorDFG) Implement isFactor(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.isPathFactorsHomogeneous — Method
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
DistributedFactorGraphs.isVariable — Function
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 VariableDFG) Implement isVariable(dfg::AbstractDFG, label::Symbol)
DistributedFactorGraphs.listNeighborhood — Method
listNeighborhood(dfg, label, distance)
Build a list of all unique neighbors inside 'distance'
Notes
- Returns
Vector{Symbol}
Related:
DistributedFactorGraphs.listNeighbors — Function
Retrieve a list of labels of the immediate neighbors around a given variable or factor specified by its label. Implement listNeighbors(dfg::AbstractDFG, label::Symbol; solvable::Int = 0)
DistributedFactorGraphs.mergeFactor! — Function
Merge a factor into the DFG. If a factor with the same label exists, it will be overwritten; otherwise, the factor will be added to the graph. Implement mergeFactor!(dfg::AbstractDFG, factor::AbstractGraphFactor)
DistributedFactorGraphs.mergeGraph! — Function
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:
DistributedFactorGraphs.mergeVariable! — Function
Merge a variable into the DFG. If a variable with the same label exists, it will be overwritten; otherwise, the variable will be added to the graph. Implement mergeVariable!(dfg::AbstractDFG, variable::AbstractGraphVariable)
DistributedFactorGraphs.rebuildFactorCache! — Function
rebuildFactorCache!(dfg, factor)
rebuildFactorCache!(dfg, factor, neighbors)
Method must be overloaded by the user for Serialization to work.
DistributedFactorGraphs.toDot — Method
toDot(dfg)
Produces a dot-format of the graph for visualization.
Notes
- Returns
::String
DistributedFactorGraphs.toDotFile — Function
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
xdotsystem application. - Based on graphviz.org
Common Accessors
Common Accessors to both variable and factor nodes
DistributedFactorGraphs.getDescription — Method
getDescription(node)
DistributedFactorGraphs.getLabel — Method
getLabel(node)
Get the label of the node.
DistributedFactorGraphs.getSolvable — Method
getSolvable(dfg, sym)
Get 'solvable' parameter for either a variable or factor.
DistributedFactorGraphs.getSolvable — Method
getSolvable(node)
Variables or factors may or may not be 'solvable', depending on a user definition. Useful for ensuring atomic transactions.
Related:
- isSolveInProgress
DistributedFactorGraphs.getTimestamp — Method
getTimestamp(node)
Get the timestamp of a AbstractGraphNode.
DistributedFactorGraphs.isSolvable — Method
isSolvable(node)
Variables or factors may or may not be 'solvable', depending on a user definition. returns true if getSolvable > 0 Related:
getSolvable(@ref)
DistributedFactorGraphs.setSolvable! — Method
setSolvable!(node, solvable)
Set the solvable parameter for either a variable or factor.
Common
DistributedFactorGraphs.listFactors — Method
listFactors(dfg, args; kwargs...)
Get a list of the labels of the DFGFactors in the DFG. Optionally specify a label regular expression to retrieves a subset of the factors.
DistributedFactorGraphs.listVariables — Method
listVariables(dfg, args; kwargs...)
Get a list of labels of the DFGVariables in the graph. 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;])See also: ls
DistributedFactorGraphs.ls — Function
ls(dfg; ...)
ls(
dfg,
regexFilter;
tags,
solvable,
solvableFilter,
tagsFilter,
typeFilter,
labelFilter
)
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}
DistributedFactorGraphs.ls — Method
ls(dfg, node; solvable)
Retrieve a list of labels of the immediate neighbors around a given variable or factor.
DistributedFactorGraphs.ls2 — Method
ls2(dfg, label)
Helper to return neighbors at distance 2 around a given node.
DistributedFactorGraphs.lsTypes — Method
lsTypes(dfg)
Return Vector{DataType} of all unique variable types in factor graph.
DistributedFactorGraphs.lsTypesDict — Method
lsTypesDict(dfg)
Return ::Dict{DataType, Vector{Symbol}} of all unique variable types with labels in a factor graph.
DistributedFactorGraphs.lsf — Function
lsf(dfg; ...)
lsf(
dfg,
regexFilter;
tags,
solvable,
solvableFilter,
tagsFilter,
typeFilter,
labelFilter
)
List the DFGFactors in the DFG. Optionally specify a label regular expression to retrieves a subset of the factors.
Notes
- Return
Vector{Symbol}
DistributedFactorGraphs.lsf — Method
lsf(dfg, _)
Lists the factors of a specific type in the factor graph. Example, list all the Point2Point2 factors in the factor graph dfg: lsf(dfg, Point2Point2)
Notes
- Return
Vector{Symbol}
DistributedFactorGraphs.lsfPriors — Method
lsfPriors(dfg)
Return vector of prior factor symbol labels in factor graph dfg.
Notes:
- Returns
Vector{Symbol}
DistributedFactorGraphs.lsfTypes — Method
lsfTypes(dfg)
Return Vector{Symbol} of all unique factor types in factor graph.
DistributedFactorGraphs.lsfTypesDict — Method
lsfTypesDict(dfg)
Return ::Dict{DataType, Vector{Symbol}} of all unique factors types with labels in a factor graph.
DistributedFactorGraphs.findClosestTimestamp — Method
findClosestTimestamp(setA, setB)
Find and return the closest timestamp from two sets of Tuples. Also return the minimum delta-time (::Nanosecond) and how many elements match from the two sets are separated by the minimum delta-time.
DistributedFactorGraphs.findFactorsBetweenNaive — Function
findFactorsBetweenNaive(dfg, from, to)
findFactorsBetweenNaive(dfg, from, to, assertSingles)
Relatively naive function counting linearly from-to
DevNotes
- Convert to using Graphs shortest path methods instead.
DistributedFactorGraphs.findShortestPathDijkstra — Function
Speciallized function available to only GraphsDFG at this time.
Notes
- Has option for various types of filters (increases memory usage)
Example
using IncrementalInference
# canonical example graph as example
fg = generateGraph_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, Graphs.dijkstra_shortest_paths
DistributedFactorGraphs.findVariableNearTimestamp — Function
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}, Nanosecond}}
DevNotes:
- TODO
numbershould allow returning more than one for k-nearest matches. - Future versions likely will require some optimization around the internal
getVariablecall.- Perhaps a dedicated/efficient
getVariableTimestampfor all DFG flavors.
- Perhaps a dedicated/efficient
Related
ls, listVariables, findClosestTimestamp
DistributedFactorGraphs.deleteTags! — Method
deleteTags!(node, tags)
Remove the tags from the node (setdiff)
DistributedFactorGraphs.emptyTags! — Method
emptyTags!(node)
Empty all tags from the node (empty)
DistributedFactorGraphs.hasTags — Method
hasTags(dfg, sym, tags)
Determine if the variable or factor neighbors have the tags::Vector{Symbol}`.
DistributedFactorGraphs.listTags — Method
listTags(node)
DistributedFactorGraphs.listVariableTags — Method
listVariableTags(dfg, sym)
List the tags for a variable.
DistributedFactorGraphs.mergeTags! — Method
mergeTags!(node, tags)
Merge add tags to a variable or factor (union)
DistributedFactorGraphs.addBloblet! — Method
addBloblet!(node, bloblet)
DistributedFactorGraphs.deleteBloblet! — Method
deleteBloblet!(node, label)
DistributedFactorGraphs.getBloblet — Method
getBloblet(node, label)
DistributedFactorGraphs.getBloblets — Method
getBloblets(node)
DistributedFactorGraphs.listBloblets — Method
listBloblets(node)
List all Bloblet keys for a variable label in dfg
DistributedFactorGraphs.mergeBloblet! — Method
mergeBloblet!(node, bloblet)
DistributedFactorGraphs.addAgentBloblet! — Method
addAgentBloblet!(dfg, bloblet)
DistributedFactorGraphs.addAgentBloblets! — Method
addAgentBloblets!(dfg, bloblets)
DistributedFactorGraphs.addFactorBloblet! — Method
addFactorBloblet!(dfg, fac_label, bloblet)
DistributedFactorGraphs.addFactorBloblets! — Method
addFactorBloblets!(dfg, fac_label, bloblets)
DistributedFactorGraphs.addGraphBloblet! — Method
addGraphBloblet!(dfg, bloblet)
DistributedFactorGraphs.addGraphBloblets! — Method
addGraphBloblets!(dfg, bloblets)
DistributedFactorGraphs.addVariableBloblet! — Method
addVariableBloblet!(dfg, var_label, bloblet)
DistributedFactorGraphs.addVariableBloblets! — Method
addVariableBloblets!(dfg, var_label, bloblets)
DistributedFactorGraphs.deleteAgentBloblet! — Method
deleteAgentBloblet!(dfg, label)
DistributedFactorGraphs.deleteAgentBloblets! — Method
deleteAgentBloblets!(dfg, labels)
DistributedFactorGraphs.deleteFactorBloblet! — Method
deleteFactorBloblet!(dfg, fac_label, label)
DistributedFactorGraphs.deleteFactorBloblets! — Method
deleteFactorBloblets!(dfg, fac_label, labels)
DistributedFactorGraphs.deleteGraphBloblet! — Method
deleteGraphBloblet!(dfg, label)
DistributedFactorGraphs.deleteGraphBloblets! — Method
deleteGraphBloblets!(dfg, labels)
DistributedFactorGraphs.deleteVariableBloblet! — Method
deleteVariableBloblet!(dfg, var_label, label)
DistributedFactorGraphs.deleteVariableBloblets! — Method
deleteVariableBloblets!(dfg, var_label, labels)
DistributedFactorGraphs.getAgentBloblet — Method
getAgentBloblet(dfg, label)
DistributedFactorGraphs.getAgentBloblets — Method
getAgentBloblets(dfg)
DistributedFactorGraphs.getFactorBloblet — Method
getFactorBloblet(dfg, fac_label, label)
DistributedFactorGraphs.getFactorBloblets — Method
getFactorBloblets(dfg, fac_label)
DistributedFactorGraphs.getGraphBloblet — Method
getGraphBloblet(dfg, label)
DistributedFactorGraphs.getGraphBloblets — Method
getGraphBloblets(dfg)
DistributedFactorGraphs.getVariableBloblet — Method
getVariableBloblet(dfg, var_label, label)
DistributedFactorGraphs.getVariableBloblets — Method
getVariableBloblets(dfg, var_label)
DistributedFactorGraphs.listAgentBloblets — Method
listAgentBloblets(dfg)
DistributedFactorGraphs.listFactorBloblets — Method
listFactorBloblets(dfg, fac_label)
DistributedFactorGraphs.listGraphBloblets — Method
listGraphBloblets(dfg)
DistributedFactorGraphs.listVariableBloblets — Method
listVariableBloblets(dfg, var_label)
DistributedFactorGraphs.mergeAgentBloblet! — Method
mergeAgentBloblet!(dfg, bloblet)
DistributedFactorGraphs.mergeAgentBloblets! — Method
mergeAgentBloblets!(dfg, bloblets)
DistributedFactorGraphs.mergeFactorBloblet! — Method
mergeFactorBloblet!(dfg, fac_label, bloblet)
DistributedFactorGraphs.mergeFactorBloblets! — Method
mergeFactorBloblets!(dfg, fac_label, bloblets)
DistributedFactorGraphs.mergeGraphBloblet! — Method
mergeGraphBloblet!(dfg, bloblet)
DistributedFactorGraphs.mergeGraphBloblets! — Method
mergeGraphBloblets!(dfg, bloblets)
DistributedFactorGraphs.mergeVariableBloblet! — Method
mergeVariableBloblet!(dfg, var_label, bloblet)
DistributedFactorGraphs.mergeVariableBloblets! — Method
mergeVariableBloblets!(dfg, var_label, bloblets)
DFG Variable Accessors CRUD and SET opperations
DistributedFactorGraphs.addState! — Method
addState!(dfg, variableLabel, state)
Add variable solver data, errors if it already exists.
DistributedFactorGraphs.addStates! — Method
addStates!(dfg, variableLabel, states)
Add variable States by calling addState!. NOTE: If an error occurs while adding one of the states, previously added states will not be rolled back.
DistributedFactorGraphs.deleteState! — Method
deleteState!(dfg, variableLabel, label)
Delete the variable State by label, returns the number of deleted elements.
DistributedFactorGraphs.deleteStates! — Method
deleteStates!(dfg, variableLabel, labels)
Delete the variable States by label, returns the number of deleted elements.
DistributedFactorGraphs.getCoordinates — Method
getCoordinates(, p)
getCoordinates(, p, basis)
Default reduction of a variable point value (a group element) into coordinates as Vector. Override if defaults are not correct.
DevNotes
- TODO Likely remove as part of serialization updates, see #590
- Used in transition period for Serialization. This function will likely be changed or deprecated entirely.
Related
DistributedFactorGraphs.getDimension — Function
Interface function to return the variableType dimension of an StateType, extend this function for all Types<:StateType.
DistributedFactorGraphs.getManifold — Method
getManifold(_)
Interface function to return the <:ManifoldsBase.AbstractManifold object of variableType<:StateType.
DistributedFactorGraphs.getPoint — Method
getPoint(, v)
getPoint(, v, basis)
Default escalzation from coordinates to a group representation point. Override if defaults are not correct. E.g. coords -> se(2) -> SE(2).
DevNotes
- TODO Likely remove as part of serialization updates, see #590
- Used in transition period for Serialization. This function will likely be changed or deprecated entirely.
Related
DistributedFactorGraphs.getPointIdentity — Function
Interface function to return the user provided identity point for this StateType manifold, extend this function for all Types<:StateType.
Notes
- Used in transition period for Serialization. This function will likely be changed or deprecated entirely.
DistributedFactorGraphs.getPointType — Function
Interface function to return the manifold point type of an StateType, extend this function for all Types<:StateType.
DistributedFactorGraphs.getSolvedCount — Method
getSolvedCount(v)
Get the number of times a variable has been inferred – i.e. solvedCount.
Related
isSolved, setSolvedCount!
DistributedFactorGraphs.getState — Method
getState(dfg, variableLabel, label)
Get the variable State for a given state label.
DistributedFactorGraphs.getStateKind — Method
getStateKind(_)
Get the kind of the variable's state, eg. Pose2, Point3, etc. as an instance of StateType.
DistributedFactorGraphs.isInitialized — Function
isInitialized(var)
isInitialized(var, key)
Returns state of variable data .initialized flag.
Notes:
- used by both factor graph variable and Bayes tree clique logic.
DistributedFactorGraphs.isMarginalized — Function
isMarginalized(vert)
isMarginalized(vert, solveKey)
Return ::Bool on whether this variable has been marginalized.
Notes:
- State default
solveKey=:default
DistributedFactorGraphs.isSolved — Method
isSolved(v)
Boolean on whether the variable has been solved.
Related
getSolved, setSolved!
DistributedFactorGraphs.listStates — Method
listStates(v; labelFilter)
List all the variable state labels.
DistributedFactorGraphs.mergeState! — Method
mergeState!(dfg, variableLabel, vnd)
Update the variable state if it exists, otherwise add it.
Related
mergeStates!
DistributedFactorGraphs.setMarginalized! — Method
setMarginalized!(vnd, val)
Mark a variable as marginalized true or false.
DistributedFactorGraphs.setSolvedCount! — Method
setSolvedCount!(v, val)
Update/set the solveCount value.
Related
getSolved, isSolved
DistributedFactorGraphs.@defStateType — Macro
@defStateType StructName manifold point_identityA macro to create a new variable type with name StructName associated with a given manifold and identity point.
StructNameis the name of the new variable type, which will be defined as a subtype ofStateType.manifoldis an object that must be a subtype ofManifoldsBase.AbstractManifold.point_identityis the identity point on the manifold, used as a reference for operations.
This macro is useful for defining variable types that are not parameterized by dimension, and for associating them with a specific manifold and identity point.
See the Manifolds.jl documentation on creating your own manifolds for more information.
Example:
DFG.@defStateType Pose2 SpecialEuclideanGroup(2) ArrayPartition([0;0.0],[1 0; 0 1.0])DistributedFactorGraphs.@defStateTypeN — Macro
@defStateTypeN StructName manifold point_identityA macro to create a new variable type with name StructName that is parameterized by N and associated with a given manifold and identity point.
StructNameis the name of the new variable type, which will be defined as a subtype ofStateType{N}.manifoldis an object that must be a subtype ofManifoldsBase.AbstractManifold.point_identityis the identity point on the manifold, used as a reference for operations.
This macro is useful for defining variable types that are parameterized by dimension or other type parameters (e.g., Pose{N}), and for associating them with a specific manifold and identity point.
See the Manifolds.jl documentation on creating your own manifolds for more information.
Example:
DFG.@defStateTypeN Pose{N} SpecialEuclideanGroup(N) ArrayPartition(zeros(SVector{N, Float64}), SMatrix{N, N, Float64}(I))DFG Factor Accessors CRUD and SET opperations
DistributedFactorGraphs._getPriorType — Method
_getPriorType(T)
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)DistributedFactorGraphs.getCache — Method
getCache(f)
Return the solver cache for a factor, which is used to store intermediate results during the solving process. This is useful for caching results that can be reused across multiple solves, such as Jacobians or other computed values.
DistributedFactorGraphs.getObservation — Method
getObservation(f)
Return the observation of a factor, which is the user-defined data structure that contains the information about the factor, such as the measurement, prior, or relative pose.
DistributedFactorGraphs.getRecipehyper — Method
getRecipehyper(f)
Return the hyperparameters associated with a factor in the factor graph. These hyperparameters may include settings such as multi-hypothesis handling, null hypothesis thresholds, and inflation factors that influence the behavior of the factor during optimization.
DistributedFactorGraphs.getRecipestate — Method
getRecipestate(f)
Return factor recipe state from factor graph.
DistributedFactorGraphs.getVariableOrder — Method
getVariableOrder(fct)
Get the variable ordering for this factor. Should be equivalent to listNeighbors unless something was deleted in the graph.
DistributedFactorGraphs.isPrior — Method
isPrior(_)
isPrior(_)
Return ::Bool on whether given factor fc::Symbol is a prior in factor graph dfg.
DistributedFactorGraphs.setCache! — Method
setCache!(f, solvercache)
Set the solver cache for a factor, which is used to store intermediate results during the solving process. This is useful for caching results that can be reused across multiple solves, such as Jacobians or other computed values.
DistributedFactorGraphs.@defObservationType — Macro
@defObservationType StructName factortype<:AbstractObservation manifolds<:AbstractManifoldA macro to create a new factor function with name StructName and manifold. Note that the manifold is an object and must be a subtype of ManifoldsBase.AbstractManifold. See documentation in Manifolds.jl on making your own.
Example:
DFG.@defObservationType Pose2Pose2 RelativeObservation SpecialEuclideanGroup(2)Printing
DistributedFactorGraphs.printFactor — Method
printFactor(dfg, sym; kwargs...)
Display and return to console the user factor identified by tag name.
DistributedFactorGraphs.printVariable — Method
printVariable(dfg, sym; kwargs...)
Display the content of State to console for a given factor graph and variable tag::Symbol.
Dev Notes
- TODO split as two show macros between AMP and DFG
Compare Utilities
DistributedFactorGraphs.compareAll — Method
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
DistributedFactorGraphs.compareAllVariables — Method
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
DistributedFactorGraphs.compareFactor — Method
compareFactor(A, B; show, skip, skipsamples, skipcompute)
Compare that all fields are the same in a ::FactorGraph factor.
DevNotes
- TODO
getSolverData(A).fnc.varValsAll / varidxare only defined downstream, so should should this function not be in IIF?
DistributedFactorGraphs.compareFactorGraphs — Method
compareFactorGraphs(
fgA,
fgB;
skipsamples,
skipcompute,
skip,
show
)
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.
DistributedFactorGraphs.compareFields — Method
compareFields(Al, Bl; show, skip)
Compare the all fields of T that are not in skip for objects Al and Bl and returns ::Bool.
TODO > add to func_ref.md
DistributedFactorGraphs.compareSimilarFactors — Method
compareSimilarFactors(
fgA,
fgB;
skipsamples,
skipcompute,
skip,
show
)
Compare similar factors between ::FactorGraphs A and B.
Related:
compareFactorGraphs, compareSimilarVariables, compareAllVariables, ls.
DistributedFactorGraphs.compareSimilarVariables — Method
compareSimilarVariables(fgA, fgB; skip, show, skipsamples)
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.
DistributedFactorGraphs.compareVariable — Method
compareVariable(A, B; skip, show, skipsamples)
Compare that all fields are the same in a ::FactorGraph variable.
Common Functions
DistributedFactorGraphs.filterDFG! — Function
Filter nodes in a DFG based on a predicate function. This function modifies the input nodes vector in place, removing nodes that do not satisfy the predicate.
For cross-backend compatibility: Use only the standard predicates (
==,<,<=,>,>=,in,contains,startswith,endswith) when you need your code to work with both in-memory and database-backed DFGs. These are likely to be supported by database query languages and are defined instd_numeric_predicatesandstd_string_predicates.For in-memory only operations: You can use any Julia predicate, since you have full access to the data and Julia's capabilities. This is more flexible but will not work if you later switch to a database backend or another programming language.
Standard predicates
- Numeric predicates:
==,<,<=,>,>=,in - String predicates:
==,contains,startswith,endswith,in
DistributedFactorGraphs.getVariableLabelNumber — Function
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_") # 10DevNotes
- make prefix Regex based for longer – i.e.
:apriltag578,:lm1_4
DistributedFactorGraphs.isValidLabel — Method
isValidLabel(id)
Returns true if the label is valid for node.
DistributedFactorGraphs.solveGraph! — Function
Default non-parametric graph solution.
DistributedFactorGraphs.solveGraphParametric! — Function
Standard parametric graph solution (Experimental).
DistributedFactorGraphs.sortDFG — Method
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