Skip to content

Commit f1cea48

Browse files
authored
Refactor State and State Serialization (#1207)
* Refactor State and State Serialization * deprecate getPoint, getCoordinates * Test unpackOldState, lower/lift Complex * missed oldstate test json * Refactor unpackOldState to improve state type handling and clarity
1 parent cecb4ca commit f1cea48

16 files changed

+1281
-358
lines changed

src/Deprecated.jl

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ end
8484

8585
function getTypeFromSerializationModule(::AbstractString)
8686
return error(
87-
"getTypeFromSerializationModule is obsolete, use DFG.parseVariableType or IIF.getTypeFromSerializationModule.",
87+
"getTypeFromSerializationModule is obsolete, use DFG.parseStateKind or IIF.getTypeFromSerializationModule.",
8888
)
8989
end
9090

@@ -129,7 +129,7 @@ end
129129

130130
function getVariableTypeName(v::VariableSummary)
131131
Base.depwarn("getVariableTypeName is deprecated.", :getVariableTypeName)
132-
return v.statetype
132+
return v.statekind
133133
end
134134

135135
function getMetadata(dfg::AbstractDFG, label::Symbol, key::Symbol)
@@ -369,3 +369,58 @@ function getVariable(dfg::AbstractDFG, label::Symbol, stateLabel::Symbol)
369369
return getVariable(dfg, label)
370370
# return getVariable(dfg, label; stateLabelFilter = ==(stateLabel))
371371
end
372+
373+
# Deprecated with new State serialization.
374+
# """
375+
# $SIGNATURES
376+
377+
# Default escalzation from coordinates to a group representation point. Override if defaults are not correct.
378+
# E.g. coords -> se(2) -> SE(2).
379+
380+
# DevNotes
381+
# - TODO Likely remove as part of serialization updates, see #590
382+
# - Used in transition period for Serialization. This function will likely be changed or deprecated entirely.
383+
384+
# Related
385+
386+
# [`getCoordinates`](@ref)
387+
# """
388+
function getPoint(
389+
::Type{T},
390+
v::AbstractVector,
391+
basis = ManifoldsBase.DefaultOrthogonalBasis(),
392+
) where {T <: StateType}
393+
Base.depwarn("getPoint is deprecated. Use get_vector and exp directly.", :getPoint)
394+
M = getManifold(T)
395+
p0 = getPointIdentity(T)
396+
X = ManifoldsBase.get_vector(M, p0, v, basis)
397+
return ManifoldsBase.exp(M, p0, X)
398+
end
399+
400+
# """
401+
# $SIGNATURES
402+
403+
# Default reduction of a variable point value (a group element) into coordinates as `Vector`. Override if defaults are not correct.
404+
405+
# DevNotes
406+
# - TODO Likely remove as part of serialization updates, see #590
407+
# - Used in transition period for Serialization. This function will likely be changed or deprecated entirely.
408+
409+
# Related
410+
411+
# [`getPoint`](@ref)
412+
# """
413+
function getCoordinates(
414+
::Type{T},
415+
p,
416+
basis = ManifoldsBase.DefaultOrthogonalBasis(),
417+
) where {T <: StateType}
418+
Base.depwarn(
419+
"getCoordinates is deprecated. Use log and get_coordinates directly.",
420+
:getCoordinates,
421+
)
422+
M = getManifold(T)
423+
p0 = getPointIdentity(T)
424+
X = ManifoldsBase.log(M, p0, p)
425+
return ManifoldsBase.get_coordinates(M, p0, X, basis)
426+
end

src/DistributedFactorGraphs.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,8 @@ const unstable_functions::Vector{Symbol} = [
474474
:printNode,
475475
:plotDFG,
476476
:packBlob,
477-
:packState,
478477
:hasTags,
479478
:unpackBlob,
480-
:unpackState,
481479
:emptyTags!,
482480
:ls,
483481
:lsf,

0 commit comments

Comments
 (0)