Skip to content

Commit 3bb9cf0

Browse files
committed
fixing #232 breaks stuff
1 parent beb012a commit 3bb9cf0

File tree

6 files changed

+67
-30
lines changed

6 files changed

+67
-30
lines changed

src/Common.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,6 @@ function lsfPriors(dfg::G)::Vector{Symbol} where G <: AbstractDFG
185185
return priors
186186
end
187187

188-
"""
189-
$(SIGNATURES)
190-
191-
Variable nodes softtype information holding a variety of meta data associated with the type of variable stored in that node of the factor graph.
192-
193-
Related
194-
195-
getVariableType
196-
"""
197-
function getSofttype(vnd::VariableNodeData)
198-
return vnd.softtype
199-
end
200-
function getSofttype(v::DFGVariable; solveKey::Symbol=:default)
201-
return getSofttype(solverData(v, solveKey))
202-
end
203188

204189
"""
205190
$SIGNATURES

src/CommonAccessors.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ export getTimestamp, setTimestamp!, timestamp
88
export getInternalId, interalId
99

1010

11-
const FactorDataLevel0 = Union{DFGFactor, DFGFactorSummary, SkeletonDFGFactor}
12-
const FactorDataLevel1 = Union{DFGFactor, DFGFactorSummary}
13-
# const FactorDataLevel2 = Union{DFGFactor}
14-
1511
const DataLevel0 = Union{VariableDataLevel0, FactorDataLevel0}
1612
const DataLevel1 = Union{VariableDataLevel1, FactorDataLevel1}
1713
const DataLevel2 = Union{VariableDataLevel2, FactorDataLevel2}
@@ -106,6 +102,6 @@ Return the internal ID for a variable.
106102
DEPRECATED, internalId -> getInternalId
107103
"""
108104
function internalId(v::DataLevel1)
109-
@warn "Deprecated interalId, use getInternalId instead."
110-
getInternalId(v)
105+
@warn "Deprecated interalId, use getInternalId instead."
106+
getInternalId(v)
111107
end

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export
7979
include("services/AbstractDFG.jl")
8080
include("services/DFGVariable.jl")
8181
include("services/DFGFactor.jl")
82+
include("CommonAccessors.jl")
8283
include("services/CompareUtils.jl")
8384

8485
# Include the Graphs.jl API.

src/entities/DFGFactor.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ end
8686
#NOTE I feel like a want to force a variableOrderSymbols
8787
SkeletonDFGFactor(label::Symbol, variableOrderSymbols::Vector{Symbol} = Symbol[]) = SkeletonDFGFactor(label, Symbol[], variableOrderSymbols)
8888

89+
90+
8991
# Accessors
9092

93+
const FactorDataLevel0 = Union{DFGFactor, DFGFactorSummary, SkeletonDFGFactor}
94+
const FactorDataLevel1 = Union{DFGFactor, DFGFactorSummary}
95+
const FactorDataLevel2 = Union{DFGFactor}
9196

9297

9398
"""

src/entities/DFGVariable.jl

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,46 +185,89 @@ end
185185

186186
SkeletonDFGVariable(label::Symbol) = SkeletonDFGVariable(label, Symbol[])
187187

188+
188189
# Accessors
189190

190191
const VariableDataLevel0 = Union{DFGVariable, DFGVariableSummary, SkeletonDFGVariable}
191192
const VariableDataLevel1 = Union{DFGVariable, DFGVariableSummary}
193+
const VariableDataLevel2 = Union{DFGVariable}
194+
195+
196+
"""
197+
$SIGNATURES
192198
199+
Return the estimates for a variable.
200+
"""
201+
getEstimates(v::VariableDataLevel1) = v.estimateDict
193202

194203
"""
195204
$SIGNATURES
196205
197206
Return the estimates for a variable.
207+
208+
DEPRECATED, estimates -> getEstimates
198209
"""
199-
estimates(v::VariableDataLevel1) = v.estimateDict
210+
function estimates(v::VariableDataLevel1)
211+
@warn "Deprecated estimates, use getEstimates instead."
212+
getEstimates(v)
213+
end
200214

201215
"""
202216
$SIGNATURES
203217
204218
Return a keyed estimate (default is :default) for a variable.
205219
"""
206-
estimate(v::VariableDataLevel1, key::Symbol=:default) = haskey(v.estimateDict, key) ? v.estimateDict[key] : nothing
220+
getEstimate(v::VariableDataLevel1, key::Symbol=:default) = haskey(v.estimateDict, key) ? v.estimateDict[key] : nothing
207221

208222
"""
209-
$SIGNATURES
223+
$SIGNATURES
210224
211-
Return the softtype name for a variable.
225+
Return a keyed estimate (default is :default) for a variable.
212226
"""
213-
softtype(v::DFGVariableSummary)::Symbol = v.softtypename
227+
function estimate(v::VariableDataLevel1, key::Symbol=:default)
228+
@warn "DEPRECATED estimate, use getEstimate instead."
229+
getEstimate(v, key)
230+
end
231+
232+
"""
233+
$(SIGNATURES)
234+
235+
Variable nodes softtype information holding a variety of meta data associated with the type of variable stored in that node of the factor graph.
236+
237+
Related
238+
239+
getVariableType
240+
"""
241+
function getSofttype(vnd::VariableNodeData)
242+
return vnd.softtype
243+
end
244+
function getSofttype(v::DFGVariable; solveKey::Symbol=:default)
245+
return getSofttype(solverData(v, solveKey))
246+
end
214247

215248
"""
216249
$SIGNATURES
217250
218251
Retrieve the soft type name symbol for a DFGVariable or DFGVariableSummary. ie :Point2, Pose2, etc.
252+
253+
TODO, DO NOT USE v.softtypename in DFGVariableSummary
219254
"""
220-
softtype(v::DFGVariable)::Symbol = Symbol(typeof(getSofttype(v)))
255+
getSofttype(v::DFGVariableSummary) = v.softtypename
256+
257+
221258

222259
"""
223-
$SIGNATURES
260+
$SIGNATURES
224261
225-
Return the internal ID a variable.
262+
Return the softtype name for a variable.
263+
264+
DEPRECATED, softtype -> getSofttype
226265
"""
227-
internalId(v::VariableDataLevel1) = v._internalId
266+
function softtype(v::VariableDataLevel1)::Symbol
267+
@warn "Deprecated softtype, use getSofttype instead."
268+
getSofttype(v)
269+
end
270+
228271

229272
"""
230273
$SIGNATURES

test/interfaceTests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# global testDFGAPI = GraphsDFG
2+
13
dfg = testDFGAPI{NoSolverParams}()
24

35
#add types for softtypes
@@ -76,6 +78,11 @@ end
7678
# Additional testing for https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/201
7779
@test symdiff([:a, :b], getVariableIds(dfg, solvable=0)) == []
7880
@test getVariableIds(dfg, solvable=1) == [:b]
81+
# WHAT -- still does not work?
82+
# v2b = deepcopy(v2)
83+
# setTags!(v2b, [:VARIABLE; :LANDMARK])
84+
# setSolvable!(v2b, 1)
85+
# setTimestamp!(v2b, getTimestamp(getVariables(dfg, solvable=1)[1]))
7986
@test getVariables(dfg, solvable=1) == [v2]
8087
@test getFactorIds(dfg) == [:f1]
8188
@test getFactorIds(dfg, solvable=1) == []

0 commit comments

Comments
 (0)