Creating New Variables
A handy macro can help define new variables which shows a Pose2 example with 3 degrees of freedom: X, Y, theta
:
DistributedFactorGraphs.@defVariable
— Macro@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)
The macro generates the necessary code for IncrementalInference to be able to use a new user defined variable – e.g.:
addVariable!(fg, :x0, MyVariable)
See RoME.jl#244 regarding plans to fundamentally integrate with Manifolds.jl
The format for defining manifolds is likely to change in the near future (2021Q1), where manual descriptions like (:Euclid, :Euclid, :Circular)
will be replaced with a more formal definition like SE2
or Manifolds.ProductRepr(Euclid{2}, Rotation)
.