Skip to content

Commit c2cba43

Browse files
authored
Merge pull request #724 from JuliaRobotics/master
v0.11.3-rc1
2 parents bbe8f12 + 5a084b7 commit c2cba43

File tree

9 files changed

+40
-29
lines changed

9 files changed

+40
-29
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.11.2"
3+
version = "0.11.3"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ export addData!
193193
##------------------------------------------------------------------------------
194194
# Factor Data
195195
export GenericFunctionNodeData, PackedFunctionNodeData, FunctionNodeData
196-
export FunctorInferenceType, PackedInferenceType
196+
export AbstractFactor, AbstractPackedFactor
197+
export FunctorInferenceType, PackedInferenceType # NOTE might be deprecated in the future (const aliases)
197198
export AbstractPrior, AbstractRelative, AbstractRelativeRoots, AbstractRelativeMinimize
198199
export FactorOperationalMemory
199200

src/LightDFG/services/LightDFG.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function savedot_attributes(io::IO, dfg::LightDFG)
336336
write(io, "$vl [color=red, shape=ellipse];\n")
337337
end
338338
for fl in listFactors(dfg)
339-
write(io, "$fl [color=blue, shape=box];\n")
339+
write(io, "$fl [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\n")
340340
end
341341

342342
for e in edges(dfg.g)
@@ -407,7 +407,6 @@ function findShortestPathDijkstra( dfg::LightDFG,
407407
for type_ in typeList
408408
union!(thelist_, listfnc(type_))
409409
end
410-
@show thelist_
411410
intersect( thelist, thelist_ )
412411
end
413412

@@ -439,11 +438,11 @@ function findShortestPathDijkstra( dfg::LightDFG,
439438
dfg
440439
end
441440

442-
# LightDFG internally uses Integers
443-
if !haskey(dfg_.g.labels, from) || !haskey(dfg_.g.labels, from)
441+
if !exists(dfg_, from) || !exists(dfg_, to)
444442
# assume filters excluded either `to` or `from` and hence no shortest path
445443
return Symbol[]
446444
end
445+
# LightDFG internally uses Integers
447446
frI = dfg_.g.labels[from]
448447
toI = dfg_.g.labels[to]
449448

src/entities/DFGFactor.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
##==============================================================================
44

55
# TODO consider changing this to AbstractFactor
6-
abstract type FunctorInferenceType <: Function end
7-
abstract type PackedInferenceType end
6+
abstract type AbstractFactor end
7+
const FunctorInferenceType = AbstractFactor
8+
abstract type AbstractPackedFactor end
9+
const PackedInferenceType = AbstractPackedFactor
810

9-
abstract type AbstractPrior <: FunctorInferenceType end
10-
abstract type AbstractRelative <: FunctorInferenceType end
11+
abstract type AbstractPrior <: AbstractFactor end
12+
abstract type AbstractRelative <: AbstractFactor end
1113
abstract type AbstractRelativeRoots <: AbstractRelative end
1214
abstract type AbstractRelativeMinimize <: AbstractRelative end
1315

1416
# NOTE DF, Convolution is IIF idea, but DFG should know about "FactorOperationalMemory"
1517
# DF, IIF.CommonConvWrapper <: FactorOperationalMemory #
18+
# TODO resolve whether `<: Function` is really needed here
1619
abstract type FactorOperationalMemory <: Function end
1720
# TODO to be removed from DFG,
1821
# we can add to IIF or have IIF.CommonConvWrapper <: FactorOperationalMemory directly
@@ -31,8 +34,8 @@ Notes
3134
Designing (WIP)
3235
- T <: Union{FactorOperationalMemory, PackedInferenceType}
3336
- in IIF.CCW{T <: DFG.FunctorInferenceType}
34-
- in DFG.AbstractRelativeFactorMinimize <: FunctorInferenceType
35-
- in Main.SomeFactor <: AbstractRelativeFactorMinimize
37+
- in DFG.AbstractRelativeMinimize <: FunctorInferenceType
38+
- in Main.SomeFactor <: AbstractRelativeMinimize
3639
"""
3740
mutable struct GenericFunctionNodeData{T<:Union{PackedInferenceType, FunctorInferenceType, FactorOperationalMemory}}
3841
eliminated::Bool

src/services/AbstractDFG.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ end
632632

633633
function ls(dfg::G, ::Type{T}) where {G <: AbstractDFG, T <: FunctorInferenceType}
634634
xx = getFactors(dfg)
635-
names = getfield.(typeof.(getFactorType.(xx)), :name) .|> Symbol
635+
names = typeof.(getFactorType.(xx)) .|> nameof
636636
vxx = view(xx, names .== Symbol(T))
637637
map(x->x.label, vxx)
638638
end
@@ -694,7 +694,7 @@ function lsWho(dfg::AbstractDFG, type::Symbol)
694694
vars = getVariables(dfg)
695695
labels = Symbol[]
696696
for v in vars
697-
varType = typeof(getVariableType(v)).name |> Symbol
697+
varType = typeof(getVariableType(v)) |> nameof
698698
varType == type && push!(labels, v.label)
699699
end
700700
return labels
@@ -721,7 +721,7 @@ function lsfWho(dfg::AbstractDFG, type::Symbol)
721721
facs = getFactors(dfg)
722722
labels = Symbol[]
723723
for f in facs
724-
facType = typeof(getFactorType(f)).name |> Symbol
724+
facType = typeof(getFactorType(f)) |> nameof
725725
facType == type && push!(labels, f.label)
726726
end
727727
return labels
@@ -740,7 +740,7 @@ function lsTypes(dfg::AbstractDFG)
740740
vars = getVariables(dfg)
741741
alltypes = Set{Symbol}()
742742
for v in vars
743-
varType = typeof(getVariableType(v)).name |> Symbol
743+
varType = typeof(getVariableType(v)) |> nameof
744744
push!(alltypes, varType)
745745
end
746746
return collect(alltypes)
@@ -756,7 +756,7 @@ function lsTypesDict(dfg::AbstractDFG)
756756
vars = getVariables(dfg)
757757
alltypes = Dict{Symbol,Vector{Symbol}}()
758758
for v in vars
759-
varType = typeof(getVariableType(v)).name |> Symbol
759+
varType = typeof(getVariableType(v)) |> nameof
760760
d = get!(alltypes, varType, Symbol[])
761761
push!(d, v.label)
762762
end
@@ -772,7 +772,7 @@ function lsfTypes(dfg::AbstractDFG)
772772
facs = getFactors(dfg)
773773
alltypes = Set{Symbol}()
774774
for f in facs
775-
facType = typeof(getFactorType(f)).name |> Symbol
775+
facType = typeof(getFactorType(f)) |> nameof
776776
push!(alltypes, facType)
777777
end
778778
return collect(alltypes)
@@ -787,7 +787,7 @@ function lsfTypesDict(dfg::AbstractDFG)
787787
facs = getFactors(dfg)
788788
alltypes = Dict{Symbol,Vector{Symbol}}()
789789
for f in facs
790-
facType = typeof(getFactorType(f)).name |> Symbol
790+
facType = typeof(getFactorType(f)) |> nameof
791791
d = get!(alltypes, facType, Symbol[])
792792
push!(d, f.label)
793793
end
@@ -1099,7 +1099,7 @@ Related
10991099
function isPathFactorsHomogeneous(dfg::AbstractDFG, from::Symbol, to::Symbol)
11001100
# FIXME, must consider all paths, not just shortest...
11011101
pth = intersect(findShortestPathDijkstra(dfg, from, to), lsf(dfg))
1102-
types = getFactorType.(dfg, pth) .|> typeof .|> x->(x).name
1102+
types = getFactorType.(dfg, pth) .|> typeof .|> x->(x).name #TODO this might not be correct in julia 1.6
11031103
utyp = unique(types)
11041104
(length(utyp) == 1), utyp
11051105
end

test/iifCompareTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ using Test
5656
# fg2 has been solved, so it should fail on the estimate dictionary
5757
@test !compareSimilarVariables(fg, fg2, skipsamples=true, skip=Symbol[:initialized;:inferdim])
5858

59-
tree = resetBuildTree!(fg2)
59+
tree = buildTreeReset!(fg2)
6060

6161
@test compareSimilarFactors(fg, fg2, skipsamples=true, skipcompute=true)
6262

test/iifInterfaceTests.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ end
2222
#test before anything changes
2323
@testset "Producing Dot Files" begin
2424
global dfg
25-
todotstr = toDot(dfg)
25+
@show todotstr = toDot(dfg)
2626
#TODO consider using a regex, but for now test all orders
2727
todota = todotstr == "graph graphname {\n2 [\"label\"=\"a\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n2 -- 3\n3 [\"label\"=\"abf1\",\"shape\"=\"box\",\"fillcolor\"=\"blue\",\"color\"=\"blue\"]\n1 [\"label\"=\"b\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n1 -- 3\n}\n"
2828
todotb = todotstr == "graph graphname {\n2 [\"label\"=\"b\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n2 -- 3\n3 [\"label\"=\"abf1\",\"shape\"=\"box\",\"fillcolor\"=\"blue\",\"color\"=\"blue\"]\n1 [\"label\"=\"a\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n1 -- 3\n}\n"
2929
todotc = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\na -- abf1\nb -- abf1\n}\n"
3030
todotd = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\nb -- abf1\na -- abf1\n}\n"
31-
@test (todota || todotb || todotc || todotd)
32-
@test toDotFile(dfg, "something.dot") == nothing
31+
todote = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\na -- abf1\nb -- abf1\n}\n"
32+
@test (todota || todotb || todotc || todotd || todote)
33+
@test toDotFile(dfg, "something.dot") === nothing
3334
Base.rm("something.dot")
3435
end
3536

test/interfaceTests.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ end
6363
@test printFactor(fac1) === nothing
6464

6565
@test printVariable(iobuf, var1, skipfields=[:timestamp, :solver, :ppe, :nstime]) === nothing
66-
@test String(take!(iobuf)) == "DFGVariable{TestVariableType1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol,Union{Bool, Float64, Int64, Array{Bool,1}, Array{Float64,1}, Array{Int64,1}, Array{String,1}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol,AbstractDataEntry}()\nsolvable:\n0\n"
66+
67+
if VERSION < v"1.6.0-beta1"
68+
# for julia < v1.6
69+
@test String(take!(iobuf)) == "DFGVariable{TestVariableType1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol,Union{Bool, Float64, Int64, Array{Bool,1}, Array{Float64,1}, Array{Int64,1}, Array{String,1}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol,AbstractDataEntry}()\nsolvable:\n0\n"
70+
else
71+
# for julia v1.6
72+
@test String(take!(iobuf)) == "DFGVariable{TestVariableType1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol, AbstractDataEntry}()\nsolvable:\n0\n"
73+
end
6774

6875
@test printVariable(iobuf, var1, short=true) === nothing
6976
varstr = String(take!(iobuf))

test/testBlocks.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ struct TestFunctorInferenceType1 <: AbstractRelative end
2424
struct TestFunctorInferenceType2 <: AbstractRelative end
2525

2626
struct TestAbstractPrior <: AbstractPrior end
27-
struct TestAbstractRelativeFactor <: AbstractRelativeFactor end
28-
struct TestAbstractRelativeFactorMinimize <: AbstractRelativeFactorMinimize end
27+
struct TestAbstractRelativeFactor <: AbstractRelativeRoots end
28+
struct TestAbstractRelativeFactorMinimize <: AbstractRelativeMinimize end
2929

3030
struct PackedTestFunctorInferenceType1 <: PackedInferenceType
3131
s::String
@@ -1409,8 +1409,8 @@ function ProducingDotFiles(testDFGAPI,
14091409
#NOTE hardcoded toDot will have different results so test LightGraphs seperately
14101410
if testDFGAPI <: LightDFG || testDFGAPI <: CloudGraphsDFG
14111411
todotstr = toDot(dotdfg)
1412-
todota = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\na -- abf1\nb -- abf1\n}\n"
1413-
todotb = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\nb -- abf1\na -- abf1\n}\n"
1412+
todota = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\na -- abf1\nb -- abf1\n}\n"
1413+
todotb = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\nb -- abf1\na -- abf1\n}\n"
14141414
@test (todota || todotb)
14151415
else
14161416
@test toDot(dotdfg) == "graph graphname {\n2 [\"label\"=\"b\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n2 -- 3\n3 [\"label\"=\"abf1\",\"shape\"=\"box\",\"fillcolor\"=\"blue\",\"color\"=\"blue\"]\n1 [\"label\"=\"a\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n1 -- 3\n}\n"

0 commit comments

Comments
 (0)