Skip to content

Commit b0a7699

Browse files
committed
Tests and export softtype,
fix depreciation
1 parent 9fdac6b commit b0a7699

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

src/Common.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function getfnctype(data::GenericFunctionNodeData)
129129
return data.fnc.usrfnc!
130130
end
131131
function getfnctype(fact::DFGFactor; solveKey::Symbol=:default)
132-
data = getData(fact) # TODO , solveKey=solveKey)
132+
data = solverData(fact) # TODO , solveKey=solveKey)
133133
return getfnctype(data)
134134
end
135135
function getfnctype(dfg::T, lbl::Symbol; solveKey::Symbol=:default) where T <: AbstractDFG
@@ -145,7 +145,7 @@ Notes
145145
- Replaces older `getfnctype`.
146146
"""
147147
getFactorType(data::GenericFunctionNodeData) = data.fnc.usrfnc!
148-
getFactorType(fct::DFGFactor) = getFactorType(getData(fct))
148+
getFactorType(fct::DFGFactor) = getFactorType(solverData(fct))
149149
function getFactorType(dfg::G, lbl::Symbol) where G <: AbstractDFG
150150
getFactorType(getFactor(dfg, lbl))
151151
end
@@ -190,7 +190,7 @@ function getSofttype(vnd::VariableNodeData)
190190
return vnd.softtype
191191
end
192192
function getSofttype(v::DFGVariable; solveKey::Symbol=:default)
193-
return getSofttype(getData(v, solveKey=solveKey))
193+
return getSofttype(solverData(v, solveKey))
194194
end
195195

196196
"""

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export AbstractParams, NoSolverParams
2121
export DFGNode, DFGVariable, DFGFactor
2222
export InferenceType, PackedInferenceType, FunctorInferenceType, InferenceVariable, ConvolutionObject
2323
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
24-
export label, timestamp, tags, estimates, estimate, data, solverData, getData, solverDataDict, setSolverData, internalId, smallData, bigData
24+
export label, timestamp, tags, estimates, estimate, data, softtype, solverData, getData, solverDataDict, setSolverData, internalId, smallData, bigData
2525
export DFGVariableSummary, DFGFactorSummary, AbstractDFGSummary
2626

2727
# Services/AbstractDFG Exports

test/LightDFGSummaryTypes.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ append!(v1.tags, [:VARIABLE, :POSE])
1313
append!(v2.tags, [:VARIABLE, :LANDMARK])
1414
append!(f1.tags, [:FACTOR])
1515

16+
#Force softtypename
17+
v1.softtypename = :Pose2
18+
1619
# @testset "Creating Graphs" begin
1720
global dfg,v1,v2,f1
1821
addVariable!(dfg, v1)
@@ -95,6 +98,7 @@ end
9598
@test timestamp(v1) == v1.timestamp
9699
@test estimates(v1) == v1.estimateDict
97100
@test estimate(v1, :notfound) == nothing
101+
@test softtype(v1) == :Pose2
98102
# @test solverData(v1) === v1.solverDataDict[:default]
99103
# @test getData(v1) === v1.solverDataDict[:default]
100104
# @test solverData(v1, :default) === v1.solverDataDict[:default]

test/interfaceTests.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ append!(v1.tags, [:VARIABLE, :POSE])
88
append!(v2.tags, [:VARIABLE, :LANDMARK])
99
append!(f1.tags, [:FACTOR])
1010

11+
#add types for softtypes
12+
st1 = (a=1,b=2)
13+
st2 = (a=1.0,b=2.0)
14+
v1.solverDataDict[:default].softtype = deepcopy(st1)
15+
v2.solverDataDict[:default].softtype = deepcopy(st2)
16+
1117
# @testset "Creating Graphs" begin
1218
global dfg,v1,v2,f1
1319
addVariable!(dfg, v1)
@@ -96,6 +102,10 @@ end
96102
@test solverDataDict(v1) == v1.solverDataDict
97103
@test internalId(v1) == v1._internalId
98104

105+
@test softtype(v1) == Symbol(typeof(st1))
106+
@test softtype(v2) == Symbol(typeof(st2))
107+
@test getSofttype(v1) == st1
108+
99109
@test label(f1) == f1.label
100110
@test tags(f1) == f1.tags
101111
@test solverData(f1) == f1.data
@@ -210,6 +220,11 @@ verts = map(n -> DFGVariable(Symbol("x$n")), 1:numNodes)
210220
#change ready and backendset for x7,x8 for improved tests on x7x8f1
211221
verts[7].ready = 1
212222
verts[8].backendset = 1
223+
224+
#force softytypes to first 2 vertices.
225+
verts[1].solverDataDict[:default].softtype = deepcopy(st1)
226+
verts[2].solverDataDict[:default].softtype = deepcopy(st2)
227+
213228
map(v -> addVariable!(dfg, v), verts)
214229
map(n -> addFactor!(dfg, [verts[n], verts[n+1]], DFGFactor{Int, :Symbol}(Symbol("x$(n)x$(n+1)f1"))), 1:(numNodes-1))
215230

@@ -286,7 +301,7 @@ end
286301
if field != :softtypename
287302
@test getfield(getVariable(dfg, v), field) == getfield(getVariable(summaryGraph, v), field)
288303
else
289-
@info "skipping softtypename check"
304+
@test softtype(getVariable(dfg, v)) == softtype(getVariable(summaryGraph, v))
290305
end
291306
end
292307
end

0 commit comments

Comments
 (0)