|
| 1 | +#FIXME This is discouraged in the julia style guide, rather standardize to instance or type |
| 2 | +const InstanceType{T} = Union{Type{<:T}, <:T} |
| 3 | + |
| 4 | +## Euclid 1 |
| 5 | + |
| 6 | +""" |
| 7 | + $TYPEDEF |
| 8 | +
|
| 9 | +Continuous Euclidean variable of dimension `N` representing a Position in cartesian space. |
| 10 | +""" |
| 11 | +struct Position{N} <: InferenceVariable end |
| 12 | + |
| 13 | +Position(N::Int) = Position{N}() |
| 14 | + |
| 15 | +# not sure if these overloads are necessary since DFG 775? |
| 16 | +DFG.getManifold(::InstanceType{Position{N}}) where {N} = TranslationGroup(N) |
| 17 | +function DFG.getDimension(val::InstanceType{Position{N}}) where {N} |
| 18 | + return manifold_dimension(getManifold(val)) |
| 19 | +end |
| 20 | +DFG.getPointType(::Type{Position{N}}) where {N} = SVector{N, Float64} |
| 21 | +DFG.getPointIdentity(M_::Type{Position{N}}) where {N} = @SVector(zeros(N)) # identity_element(getManifold(M_), zeros(N)) |
| 22 | + |
| 23 | + |
| 24 | +# |
| 25 | + |
| 26 | +""" |
| 27 | +$(TYPEDEF) |
| 28 | +
|
| 29 | +Most basic continuous scalar variable in a `::DFG.AbstractDFG` object. |
| 30 | +
|
| 31 | +Alias of `Position{1}` |
| 32 | +""" |
| 33 | +const ContinuousScalar = Position{1} |
| 34 | +const ContinuousEuclid{N} = Position{N} |
| 35 | + |
| 36 | +const Position1 = Position{1} |
| 37 | +const Position2 = Position{2} |
| 38 | +const Position3 = Position{3} |
| 39 | +const Position4 = Position{4} |
| 40 | + |
| 41 | +#TODO maybe just use @defVariable for all Position types? |
| 42 | +# @defVariable Position1 TranslationGroup(1) @SVector(zeros(1)) |
| 43 | +# @defVariable Position2 TranslationGroup(2) @SVector(zeros(2)) |
| 44 | +# @defVariable Position3 TranslationGroup(3) @SVector(zeros(3)) |
| 45 | +# @defVariable Position4 TranslationGroup(4) @SVector(zeros(4)) |
| 46 | + |
| 47 | +## Circular |
| 48 | + |
| 49 | +""" |
| 50 | +$(TYPEDEF) |
| 51 | +
|
| 52 | +Circular is a `Manifolds.Circle{ℝ}` mechanization of one rotation, with `theta in [-pi,pi)`. |
| 53 | +""" |
| 54 | +@defVariable Circular RealCircleGroup() [0.0;] |
| 55 | +#TODO This is an example of what we want working, possible issue upstream in Manifolds.jl |
| 56 | +# @defVariable Circular RealCircleGroup() Scalar(0.0) |
| 57 | + |
| 58 | +# |
0 commit comments