# Custom Variables

A handy macro can help define new variables which shows a Pose2 example with 3 degrees of freedom: $X, Y, \theta$. Note that we use Manifolds.jl as fundamental abstraction for numerical operations. Users can choose how to represent data, for example RoME.Pose2 is defined as a Manifolds.SpecialEuclidean(2), and the default data representation is (but doesn't have to be) Manifolds.identity_element(SpecialEuclidean(2)) – i.e. likely an Manifolds.ArrayPartition or Manifolds.ProductRepr (older).

DistributedFactorGraphs.@defVariableMacro
@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) ProductRepr([0;0.0],[1 0; 0 1.0])

The macro generates the necessary code for IncrementalInference to be able to use a new user defined variable – e.g.:

addVariable!(fg, :x0, MyVariable)
Note

Since RoME.jl#244 the Caesar.jl system of packages fundamentally integrated with Manifolds.jl.