Skip to content

Commit 0b239b8

Browse files
committed
rm deprecated User/Robot/Session completely
1 parent 7708ecd commit 0b239b8

File tree

9 files changed

+41
-240
lines changed

9 files changed

+41
-240
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Listing news on any major breaking changes in DFG. For regular changes, see integrated Github.com project milestones for DFG.
2+
# v0.28
3+
- Reading or deserialzing of factor graphs created prior to v0.25 are no longer suppoted with the complete removal of User/Robot/Session
24

35
# v0.27
46
- `delete` returns number of nodes deleted and no longer the object that was deleted.

src/GraphsDFG/entities/GraphsDFG.jl

Lines changed: 1 addition & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ mutable struct GraphsDFG{
1313
} <: AbstractDFG{T}
1414
g::FactorGraph{Int, V, F}
1515
description::String
16-
# ------ deprecated fields ---------
17-
userLabel::Union{Nothing, String}
18-
robotLabel::Union{Nothing, String}
19-
sessionLabel::Union{Nothing, String}
20-
userData::Union{Nothing, Dict{Symbol, SmallDataTypes}}
21-
robotData::Union{Nothing, Dict{Symbol, SmallDataTypes}}
22-
sessionData::Union{Nothing, Dict{Symbol, SmallDataTypes}}
23-
userBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}}
24-
robotBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}}
25-
sessionBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}}
26-
# ---------------------------------
2716
addHistory::Vector{Symbol} #TODO: Discuss more - is this an audit trail?
2817
solverParams::T # Solver parameters
2918
blobStores::Dict{Symbol, AbstractBlobstore}
@@ -45,43 +34,6 @@ function DFG.setMetadata!(dfg::GraphsDFG, metadata::Dict{Symbol, SmallDataTypes}
4534
return merge!(dfg.graphMetadata, metadata)
4635
end
4736

48-
deprecatedDfgFields = [
49-
:userLabel,
50-
:robotLabel,
51-
:sessionLabel,
52-
:userData,
53-
:robotData,
54-
:sessionData,
55-
:userBlobEntries,
56-
:robotBlobEntries,
57-
:sessionBlobEntries,
58-
]
59-
60-
function Base.propertynames(x::GraphsDFG, private::Bool = false)
61-
return setdiff(fieldnames(GraphsDFG), deprecatedDfgFields)
62-
end
63-
64-
# deprected in v0.25
65-
function Base.getproperty(dfg::GraphsDFG, f::Symbol)
66-
if f in deprecatedDfgFields
67-
Base.depwarn(
68-
"Field $f is deprecated as part of removing user/robot/session. Replace with Agent or Factorgraph [Label/Metadata/BlobEntries].",
69-
:getproperty,
70-
)
71-
end
72-
return getfield(dfg, f)
73-
end
74-
75-
function Base.setproperty!(dfg::GraphsDFG, f::Symbol, val)
76-
if f in deprecatedDfgFields
77-
Base.depwarn(
78-
"Field $f is deprecated as part of removing user/robot/session. Replace with Agent or Factorgraph [Label/Metadata/BlobEntries].",
79-
:setproperty!,
80-
)
81-
end
82-
return setfield!(dfg, f, val)
83-
end
84-
8537
"""
8638
$(SIGNATURES)
8739
@@ -115,52 +67,15 @@ function GraphsDFG{T, V, F}(
11567
agentMetadata,
11668
agentBlobEntries,
11769
),
118-
119-
#Deprecated fields
120-
userLabel::Union{Nothing, String} = nothing,
121-
robotLabel::Union{Nothing, String} = nothing,
122-
sessionLabel::Union{Nothing, String} = nothing,
123-
userData::Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing,
124-
robotData::Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing,
125-
sessionData::Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing,
126-
userBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing,
127-
robotBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing,
128-
sessionBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing,
12970
) where {T <: AbstractParams, V <: AbstractDFGVariable, F <: AbstractDFGFactor}
130-
if any([
131-
!isnothing(userLabel),
132-
!isnothing(robotLabel),
133-
!isnothing(sessionLabel),
134-
!isnothing(userData),
135-
!isnothing(robotData),
136-
!isnothing(sessionData),
137-
!isnothing(userBlobEntries),
138-
!isnothing(robotBlobEntries),
139-
!isnothing(sessionBlobEntries),
140-
])
141-
#deprecated in v0.25
142-
Base.depwarn(
143-
"Kwargs with user/robot/session is deprecated. Replace with agent[Label/Metadata/BlobEntries] or graph[Label/Metadata/BlobEntries].",
144-
:GraphsDFG,
145-
)
146-
end
14771

148-
# Validate the userLabel, robotLabel, and sessionLabel
72+
# Validate the graphLabel and agentLabel
14973
!isValidLabel(graphLabel) && error("'$graphLabel' is not a valid label")
15074
!isValidLabel(agentLabel) && error("'$agentLabel' is not a valid label")
15175

15276
return GraphsDFG{T, V, F}(
15377
g,
15478
graphDescription,
155-
userLabel,
156-
robotLabel,
157-
sessionLabel,
158-
userData,
159-
robotData,
160-
sessionData,
161-
userBlobEntries,
162-
robotBlobEntries,
163-
sessionBlobEntries,
16479
addHistory,
16580
solverParams,
16681
blobStores,
@@ -196,64 +111,3 @@ function GraphsDFG(
196111
) where {T}
197112
return GraphsDFG{T, VariableCompute, FactorCompute}(g; solverParams, kwargs...)
198113
end
199-
200-
function GraphsDFG(
201-
description::String,
202-
userLabel::String,
203-
robotLabel::String,
204-
sessionLabel::String,
205-
userData::Dict{Symbol, SmallDataTypes},
206-
robotData::Dict{Symbol, SmallDataTypes},
207-
sessionData::Dict{Symbol, SmallDataTypes},
208-
solverParams::AbstractParams,
209-
blobStores = Dict{Symbol, AbstractBlobstore}(),
210-
)
211-
#deprecated in v0.25
212-
Base.depwarn(
213-
"user/robot/session is deprecated. Replace with agent[Label/Metadata/BlobEntries] or graph[Label/Metadata/BlobEntries].",
214-
:GraphsDFG,
215-
)
216-
return GraphsDFG{typeof(solverParams), VariableCompute, FactorCompute}(
217-
FactorGraph{Int, VariableCompute, FactorCompute}();
218-
description,
219-
userLabel,
220-
robotLabel,
221-
sessionLabel,
222-
userData,
223-
robotData,
224-
sessionData,
225-
solverParams,
226-
blobStores,
227-
)
228-
end
229-
230-
function GraphsDFG{T, V, F}(
231-
description::String,
232-
userLabel::String,
233-
robotLabel::String,
234-
sessionLabel::String,
235-
userData::Dict{Symbol, SmallDataTypes},
236-
robotData::Dict{Symbol, SmallDataTypes},
237-
sessionData::Dict{Symbol, SmallDataTypes},
238-
solverParams::T,
239-
blobStores = Dict{Symbol, AbstractBlobstore}(),
240-
) where {T <: AbstractParams, V <: AbstractDFGVariable, F <: AbstractDFGFactor}
241-
242-
#deprecated in v0.25
243-
Base.depwarn(
244-
"user/robot/session is deprecated. Replace with agent[Label/Metadata/BlobEntries] or graph[Label/Metadata/BlobEntries].",
245-
:GraphsDFG,
246-
)
247-
return GraphsDFG{T, V, F}(
248-
FactorGraph{Int, V, F}();
249-
description,
250-
userLabel,
251-
robotLabel,
252-
sessionLabel,
253-
userData,
254-
robotData,
255-
sessionData,
256-
solverParams,
257-
blobStores,
258-
)
259-
end

src/GraphsDFG/services/GraphsDFGSerialization.jl

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,17 @@ using InteractiveUtils
22

33
@kwdef struct PackedGraphsDFG{T <: AbstractParams}
44
description::String
5-
# ------ deprecated fields v0.25 ---------
6-
userLabel::Union{Nothing, String} = nothing
7-
robotLabel::Union{Nothing, String} = nothing
8-
sessionLabel::Union{Nothing, String} = nothing
9-
userData::Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing
10-
robotData::Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing
11-
sessionData::Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing
12-
userBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing
13-
robotBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing
14-
sessionBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing
15-
# ---------------------------------
165
addHistory::Vector{Symbol}
176
solverParams::T
187
solverParams_type::String = string(nameof(typeof(solverParams)))
198
typePackedVariable::Bool = false # Are variables packed or full
209
typePackedFactor::Bool = false # Are factors packed or full
2110
blobStores::Union{Nothing, Dict{Symbol, FolderStore{Vector{UInt8}}}}
22-
23-
# new structure to replace URS
24-
#TODO remove union nothing after v0.25
25-
graphLabel::Union{Nothing, Symbol}
26-
graphTags::Union{Nothing, Vector{Symbol}}
27-
graphMetadata::Union{Nothing, Dict{Symbol, SmallDataTypes}}
28-
graphBlobEntries::Union{Nothing, OrderedDict{Symbol, Blobentry}}
29-
agent::Union{Nothing, Agent}
11+
graphLabel::Symbol
12+
graphTags::Vector{Symbol}
13+
graphMetadata::Dict{Symbol, SmallDataTypes}
14+
graphBlobEntries::OrderedDict{Symbol, Blobentry}
15+
agent::Agent
3016
end
3117

3218
StructTypes.StructType(::Type{PackedGraphsDFG}) = StructTypes.AbstractType()
@@ -49,7 +35,7 @@ Packing function to serialize DFG metadata from.
4935
function packDFGMetadata(fg::GraphsDFG)
5036
commonfields = intersect(fieldnames(PackedGraphsDFG), fieldnames(GraphsDFG))
5137

52-
setdiff!(commonfields, [deprecatedDfgFields; :blobStores])
38+
setdiff!(commonfields, [:blobStores])
5339
blobStores = Dict{Symbol, FolderStore{Vector{UInt8}}}()
5440
foreach(values(fg.blobStores)) do store
5541
if store isa FolderStore{Vector{UInt8}}
@@ -76,57 +62,13 @@ function unpackDFGMetadata(packed::PackedGraphsDFG)
7662
# blobStores = Dict{Symbol, AbstractBlobstore}()
7763
# !isnothing(packed.blobStores) && merge!(blobStores, packed.blobStores)
7864

79-
setdiff!(commonfields, [deprecatedDfgFields; :blobStores])
65+
setdiff!(commonfields, [:blobStores])
8066
blobStores = packed.blobStores
8167

82-
if isnothing(packed.agent)
83-
agentBlobEntries = nothing
84-
agentMetadata = nothing
85-
agentLabel = nothing
86-
graphBlobEntries = nothing
87-
graphMetadata = nothing
88-
graphLabel = nothing
89-
90-
for f in deprecatedDfgFields
91-
if !isnothing(getproperty(packed, f))
92-
if f == :robotBlobEntries
93-
agentBlobEntries = getproperty(packed, f)
94-
@warn "Converting deprecated $f to agentBlobEntries"
95-
elseif f == :robotData
96-
agentMetadata = getproperty(packed, f)
97-
@warn "Converting deprecated $f to agentMetadata"
98-
elseif f == :robotLabel
99-
agentLabel = Symbol(getproperty(packed, f))
100-
@warn "Converting deprecated $f to agentLabel"
101-
elseif f == :sessionBlobEntries
102-
graphBlobEntries = getproperty(packed, f)
103-
@warn "Converting deprecated $f to graphBlobEntries"
104-
elseif f == :sessionData
105-
graphMetadata = getproperty(packed, f)
106-
@warn "onverting deprecated $f to graphMetadata"
107-
elseif f == :sessionLabel
108-
graphLabel = Symbol(getproperty(packed, f))
109-
@warn "Converting deprecated $f to graphLabel"
110-
else
111-
@warn """
112-
Field $f is deprecated as part of removing user/robot/session. Replace with Agent or Factorgraph [Label/Metadata/BlobEntries]
113-
No conversion done for $f
114-
"""
115-
end
116-
end
117-
end
118-
119-
agent = Agent(;
120-
label = agentLabel,
121-
blobEntries = agentBlobEntries,
122-
metadata = agentMetadata,
123-
)
124-
else
125-
agent = packed.agent
126-
graphBlobEntries = packed.graphBlobEntries
127-
graphMetadata = packed.graphMetadata
128-
graphLabel = packed.graphLabel
129-
end
68+
agent = packed.agent
69+
graphBlobEntries = packed.graphBlobEntries
70+
graphMetadata = packed.graphMetadata
71+
graphLabel = packed.graphLabel
13072

13173
_isfolderstorepath(s) = false
13274
_isfolderstorepath(s::FolderStore) = ispath(s.folder)
@@ -170,9 +112,7 @@ end
170112
function unpackDFGMetadata!(dfg::GraphsDFG, packed::PackedGraphsDFG)
171113
commonfields = intersect(fieldnames(GraphsDFG), fieldnames(PackedGraphsDFG))
172114

173-
#FIXME Deprecate remove Nothing union in DFG v0.24
174-
#FIXME also remove deprectedDFG fields depr in v0.25
175-
setdiff!(commonfields, [deprecatedDfgFields; :blobStores])
115+
setdiff!(commonfields, [:blobStores])
176116
!isnothing(packed.blobStores) && merge!(dfg.blobStores, packed.blobStores)
177117

178118
props = (k => getproperty(packed, k) for k in commonfields)

src/services/AbstractDFG.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@ Base.Broadcast.broadcastable(dfg::AbstractDFG) = Ref(dfg)
1111
##==============================================================================
1212
## Interface for an AbstractDFG
1313
##==============================================================================
14-
# TODO update to remove URS
14+
# TODO update to include graph and agent extras.
1515
# Standard recommended fields to implement for AbstractDFG
1616
# - `description::String`
17-
# - `userLabel::String`
18-
# - `robotLabel::String`
19-
# - `sessionLabel::String`
20-
# - `userData::Dict{Symbol, String}`
21-
# - `robotData::Dict{Symbol, String}`
22-
# - `sessionData::Dict{Symbol, String}`
2317
# - `solverParams::T<:AbstractParams`
2418
# - `addHistory::Vector{Symbol}`
2519
# - `blobStores::Dict{Symbol, AbstractBlobstore}`
@@ -1582,9 +1576,8 @@ function getSummaryGraph(dfg::G) where {G <: AbstractDFG}
15821576
#TODO fix deprecated constructor
15831577
summaryDfg = GraphsDFG{NoSolverParams, VariableSummary, FactorSummary}(;
15841578
description = "Summary of $(getDescription(dfg))",
1585-
userLabel = dfg.userLabel,
1586-
robotLabel = dfg.robotLabel,
1587-
sessionLabel = dfg.sessionLabel,
1579+
agent = dfg.agent,
1580+
graphLabel = Symbol(getGraphLabel(dfg), "_summary_$(string(uuid4())[1:6])"),
15881581
)
15891582
deepcopyGraph!(summaryDfg, dfg)
15901583
# for v in getVariables(dfg)
File renamed without changes.

test/iifInterfaceTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ end
5858
# dfg to copy to
5959
# creating a whole new graph with the same labels
6060
T = typeof(dfg)
61-
dfg2 = T(; solverParams = SolverParams(), userLabel = "test@navability.io")
61+
dfg2 = T(; solverParams = SolverParams(), graphLabel = :testGraph)
6262

6363
# Build a new in-memory IIF graph to transfer into the new graph.
6464
iiffg = initfg()

test/interfaceTests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ end
150150
# order up to here is important, TODO maybe make independant
151151
##
152152
@testset "Adjacency Matrices" begin
153-
fg = testDFGAPI(; userLabel = "test@navability.io")
153+
fg = testDFGAPI(; graphLabel = :testGraph)
154154
addVariable!(fg, var1)
155155
setSolvable!(fg, :a, 1)
156156
addVariable!(fg, var2)
@@ -192,7 +192,7 @@ end
192192

193193
@testset "Copy Functions" begin
194194
rand(6)
195-
fg = testDFGAPI(; userLabel = "test@navability.io")
195+
fg = testDFGAPI(; graphLabel = :testGraph)
196196
addVariable!(fg, var1)
197197
addVariable!(fg, var2)
198198
addVariable!(fg, var3)
@@ -203,7 +203,7 @@ end
203203
# @test getVariableOrder(fg,:f1) == getVariableOrder(fgcopy,:f1)
204204

205205
#test copyGraph, deepcopyGraph[!]
206-
fgcopy = testDFGAPI(; userLabel = "test@navability.io")
206+
fgcopy = testDFGAPI(; graphLabel = :testGraph)
207207
DFG.deepcopyGraph!(fgcopy, fg)
208208
@test getVariableOrder(fg, :abf1) == getVariableOrder(fgcopy, :abf1)
209209

test/runtests.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,22 @@ end
6363
if get(ENV, "IIF_TEST", "true") == "true"
6464

6565
# Switch to our upstream test branch.
66+
#FIXME This is a temporary fix to use the develop branch of IIF.
67+
# Pkg.add(PackageSpec(; name = "IncrementalInference", rev = "upstream/dfg_integration_test"))
68+
# Pkg.add(PackageSpec(; name = "IncrementalInference", rev = "develop"))
6669
Pkg.add(
67-
#FIXME This is a temporary fix to use the refactored factor branch.
68-
# PackageSpec(; name = "IncrementalInference", rev = "upstream/dfg_integration_test"),
69-
PackageSpec(; name = "IncrementalInference", rev = "develop"),
70+
PackageSpec(;
71+
url = "https://github.com/JuliaRobotics/IncrementalInference.jl.git",
72+
subdir = "IncrementalInferenceTypes",
73+
rev = "develop",
74+
),
75+
)
76+
Pkg.add(
77+
PackageSpec(;
78+
url = "https://github.com/JuliaRobotics/IncrementalInference.jl.git",
79+
subdir = "IncrementalInference",
80+
rev = "develop",
81+
),
7082
)
7183
@info "------------------------------------------------------------------------"
7284
@info "These tests are using IncrementalInference to do additional driver tests"

0 commit comments

Comments
 (0)