Skip to content

Commit c0b6dd5

Browse files
authored
Merge pull request #799 from JuliaRobotics/master
v0.15.2-rc1
2 parents ab922f1 + b5b84ff commit c0b6dd5

File tree

8 files changed

+50
-38
lines changed

8 files changed

+50
-38
lines changed

Project.toml

Lines changed: 3 additions & 2 deletions
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.15.1"
3+
version = "0.15.2"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -46,7 +46,8 @@ GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
4646
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
4747
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
4848
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
49+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
4950
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5051

5152
[targets]
52-
test = ["Test", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg"]
53+
test = ["Test", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg", "Statistics"]

src/FileDFG/services/FileDFG.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function loadDFG!(dfgLoadInto::AbstractDFG, dst::AbstractString)
152152
map(f->addFactor!(dfgLoadInto, f), factors)
153153

154154
# Finally, rebuild the CCW's for the factors to completely reinflate them
155+
# NOTE CREATES A NEW DFGFactor IF CCW TYPE CHANGES
155156
@info "Rebuilding CCW's for the factors..."
156157
for factor in factors
157158
rebuildFactorMetadata!(dfgLoadInto, factor)

src/LightDFG/services/LightDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ end
7979
# end
8080

8181

82-
function addFactor!(dfg::LightDFG{<:AbstractParams, <:AbstractDFGVariable, F}, factor::F)::F where F <: AbstractDFGFactor
82+
function addFactor!(dfg::LightDFG{<:AbstractParams, <:AbstractDFGVariable, F}, factor::F) where F <: AbstractDFGFactor
8383
if haskey(dfg.g.factors, factor.label)
8484
error("Factor '$(factor.label)' already exists in the factor graph")
8585
end
8686
# TODO
8787
# @assert FactorGraphs.addFactor!(dfg.g, getVariableOrder(factor), factor)
88-
@assert FactorGraphs.addFactor!(dfg.g, factor._variableOrderSymbols, factor)
88+
@assert FactorGraphs.addFactor!(dfg.g, Symbol[factor._variableOrderSymbols...], factor)
8989
return factor
9090
end
9191

src/entities/DFGFactor.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Designing (WIP)
3838
- in DFG.AbstractRelativeMinimize <: FunctorInferenceType
3939
- in Main.SomeFactor <: AbstractRelativeMinimize
4040
"""
41-
mutable struct GenericFunctionNodeData{T<:Union{PackedInferenceType, FunctorInferenceType, FactorOperationalMemory}}
41+
mutable struct GenericFunctionNodeData{T<:Union{<:PackedInferenceType, <:AbstractFactor, <:FactorOperationalMemory}}
4242
eliminated::Bool
4343
potentialused::Bool
4444
edgeIDs::Vector{Int}
@@ -80,7 +80,7 @@ end
8080
const PackedFunctionNodeData{T} = GenericFunctionNodeData{T} where T <: AbstractPackedFactor
8181
PackedFunctionNodeData(args...) = PackedFunctionNodeData{typeof(args[4])}(args...)
8282

83-
const FunctionNodeData{T} = GenericFunctionNodeData{T} where T <: Union{AbstractFactor, FactorOperationalMemory}
83+
const FunctionNodeData{T} = GenericFunctionNodeData{T} where T <: Union{<:AbstractFactor, <:FactorOperationalMemory}
8484
FunctionNodeData(args...) = FunctionNodeData{typeof(args[4])}(args...)
8585

8686

src/entities/DFGVariable.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ abstract type AbstractPointParametricEst end
226226
Data container to store Parameteric Point Estimate (PPE) for mean and max.
227227
"""
228228
struct MeanMaxPPE <: AbstractPointParametricEst
229-
solveKey::Symbol #repeated because of Sam's request
229+
# repeat key value internally (from a design request by Sam)
230+
solveKey::Symbol
230231
suggested::Vector{Float64}
231232
max::Vector{Float64}
232233
mean::Vector{Float64}

src/services/AbstractDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ getFactorOperationalMemoryType(dfg::AbstractDFG) = getFactorOperationalMemoryTyp
7676
7777
Method must be overloaded by the user for Serialization to work.
7878
"""
79-
rebuildFactorMetadata!(dfg::AbstractDFG{<:AbstractParams}, factor::AbstractDFGFactor) = error("rebuildFactorMetadata! is not implemented for $(typeof(dfg))")
79+
rebuildFactorMetadata!(dfg::AbstractDFG{<:AbstractParams}, factor::AbstractDFGFactor, neighbors=[]) = error("rebuildFactorMetadata! is not implemented for $(typeof(dfg))")
8080

8181
##------------------------------------------------------------------------------
8282
## Setters

src/services/CompareUtils.jl

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,29 @@ end
4343
"""
4444
$(SIGNATURES)
4545
46-
Compare the all fields of T that are not in `skip` for objects `Al` and `Bl`.
46+
Compare the all fields of T that are not in `skip` for objects `Al` and `Bl` and returns `::Bool`.
4747
4848
TODO > add to func_ref.md
4949
"""
50-
function compareFields(Al::T,
51-
Bl::T;
52-
show::Bool=true,
53-
skip::Vector{Symbol}=Symbol[] )::Bool where {T}
54-
for field in fieldnames(T)
50+
function compareFields( Al::T1,
51+
Bl::T2;
52+
show::Bool=true,
53+
skip::Vector{Symbol}=Symbol[] ) where {T1,T2}
54+
#
55+
T1 == T2 ? nothing : @warn("different types in compareFields", T1, T2)
56+
for field in fieldnames(T1)
5557
(field in skip) && continue
5658
tp = compareField(Al, Bl, field)
57-
show && @debug(" $tp : $field")==nothing
59+
show && @debug(" $tp : $field") === nothing
5860
!tp && return false
5961
end
6062
return true
6163
end
6264

63-
function compareFields(Al::T,
64-
Bl::T;
65-
show::Bool=true,
66-
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Union{Number, AbstractString}}
65+
function compareFields( Al::T,
66+
Bl::T;
67+
show::Bool=true,
68+
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Union{Number, AbstractString}}
6769
#
6870
return Al == Bl
6971
end
@@ -130,12 +132,15 @@ function compareAll(Al::T,
130132
return true
131133
end
132134

133-
function compareAll(Al::T, Bl::T; show::Bool=true, skip::Vector{Symbol}=Symbol[]) where T
134-
@debug "Comparing types $T:"
135+
function compareAll(Al::T1, Bl::T2; show::Bool=true, skip::Vector{Symbol}=Symbol[]) where {T1,T2}
136+
@debug "Comparing types $T1, $T2"
137+
if T1 != T2
138+
@warn "Types are different" T1 T2
139+
end
135140
# @debug " Al = $Al"
136141
# @debug " Bl = $Bl"
137142
!compareFields(Al, Bl, show=show, skip=skip) && return false
138-
for field in fieldnames(T)
143+
for field in fieldnames(T1)
139144
field in skip && continue
140145
@debug(" Checking field: $field")
141146
(!isdefined(Al, field) && !isdefined(Al, field)) && return true
@@ -202,10 +207,11 @@ function compareAllSpecial(A::T1,
202207
skip=Symbol[],
203208
show::Bool=true) where {T1 <: GenericFunctionNodeData, T2 <: GenericFunctionNodeData}
204209
if T1 != T2
205-
return false
206-
else
207-
return compareAll(A, B, skip=skip, show=show)
210+
@warn "compareAllSpecial is comparing different types" T1 T2
211+
# return false
212+
# else
208213
end
214+
return compareAll(A, B, skip=skip, show=show)
209215
end
210216

211217

@@ -236,17 +242,20 @@ function compareFactor(A::DFGFactor,
236242
skipsamples::Bool=true,
237243
skipcompute::Bool=true )
238244
#
239-
skip_ =
240-
TP = compareAll(A, B, skip=union([:attributes;:solverData;:_variableOrderSymbols;:_gradients],skip), show=show)
241-
# TP = TP & compareAll(A.attributes, B.attributes, skip=[:data;], show=show)
245+
skip_ = union([:attributes;:solverData;:_variableOrderSymbols;:_gradients],skip)
246+
TP = compareAll(A, B, skip=skip_, show=show)
247+
@debug "compareFactor 1/5" TP
242248
TP = TP & compareAllSpecial(getSolverData(A), getSolverData(B), skip=union([:fnc;:_gradients], skip), show=show)
243-
if :fnc in skip
249+
@debug "compareFactor 2/5" TP
250+
if !TP || :fnc in skip
244251
return TP
245252
end
246253
TP = TP & compareAllSpecial(getSolverData(A).fnc, getSolverData(B).fnc, skip=union([:cpt;:measurement;:params;:varidx;:threadmodel;:_gradients], skip), show=show)
254+
@debug "compareFactor 3/5" TP
247255
if !(:measurement in skip)
248-
TP = TP & (skipsamples || compareAll(getSolverData(A).fnc.measurement, getSolverData(B).fnc.measurement, show=show, skip=skip))
256+
TP = TP & (skipsamples || compareAll(getSolverData(A).fnc.measurement, getSolverData(B).fnc.measurement, show=show, skip=skip))
249257
end
258+
@debug "compareFactor 4/5" TP
250259
if !(:params in skip)
251260
TP = TP & (skipcompute || compareAll(getSolverData(A).fnc.params, getSolverData(B).fnc.params, show=show, skip=skip))
252261
end

src/services/Serialization.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,14 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any})::DFGFactor where G
373373

374374
# Rebuild DFGFactor
375375
#TODO use constuctor to create factor
376-
factor = DFGFactor(Symbol(label),
377-
timestamp,
378-
nstime,
379-
Set(tags),
380-
fullFactorData,
381-
solvable,
382-
Tuple(_variableOrderSymbols))
383-
376+
factor = DFGFactor( Symbol(label),
377+
timestamp,
378+
nstime,
379+
Set(tags),
380+
fullFactorData,
381+
solvable,
382+
Tuple(_variableOrderSymbols))
383+
#
384384

385385
# Note, once inserted, you still need to call rebuildFactorMetadata!
386386
return factor

0 commit comments

Comments
 (0)