Skip to content

Commit 4edbe89

Browse files
authored
Merge pull request #1022 from JuliaRobotics/23Q3/enh/dropabsrelroots
drop AbstractRelativeRoots
2 parents 9ac3d94 + f50e853 commit 4edbe89

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

src/DataBlobs/entities/BlobEntry.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Notes:
2424
label::Symbol
2525
""" A hint about where the `Blob` itself might be stored. Remember that a Blob may be duplicated over multiple blobstores. """
2626
blobstore::Symbol
27-
""" A hash value to ensure data consistency which must correspond to the stored hash upon retrieval. [Legacy: some usage functions allow the check to be skipped if needed.] """
27+
""" A hash value to ensure data consistency which must correspond to the stored hash upon retrieval. Use `bytes2hex(sha256(blob))`. [Legacy: some usage functions allow the check to be skipped if needed.] """
2828
hash::String # Probably https://docs.julialang.org/en/v1/stdlib/SHA
2929
""" Context from which a BlobEntry=>Blob was first created. E.g. user|robot|session|varlabel. """
3030
origin::String
@@ -43,7 +43,7 @@ Notes:
4343
""" Use carefully, but necessary to support advanced usage such as time synchronization over Blob data. """
4444
lastUpdatedTimestamp::Union{ZonedDateTime,Nothing} = nothing
4545
""" Self type declaration for when duck-typing happens. """
46-
_type::String = "BlobEntry"
46+
_type::String = "DistributedFactorGraph.BlobEntry"
4747
""" Type version of this BlobEntry. TBD.jl consider upgrading to `::VersionNumber`. """
4848
_version::String = string(_getDFGVersion())
4949
end

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export packBlob, unpackBlob
224224
# Factor Data
225225
export GenericFunctionNodeData, PackedFunctionNodeData, FunctionNodeData
226226
export AbstractFactor, AbstractPackedFactor
227-
export AbstractPrior, AbstractRelative, AbstractRelativeRoots, AbstractRelativeMinimize, AbstractManifoldMinimize
227+
export AbstractPrior, AbstractRelative, AbstractRelativeMinimize, AbstractManifoldMinimize
228228
export FactorOperationalMemory
229229

230230
# accessors

src/entities/DFGFactor.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ abstract type AbstractPackedFactor end
88

99
abstract type AbstractPrior <: AbstractFactor end
1010
abstract type AbstractRelative <: AbstractFactor end
11-
abstract type AbstractRelativeRoots <: AbstractRelative end # NOTE Cannot be used for partials
11+
# abstract type AbstractRelativeRoots <: AbstractRelative end # TODO deprecate
1212
abstract type AbstractRelativeMinimize <: AbstractRelative end
13-
abstract type AbstractManifoldMinimize <: AbstractRelative end # FIXME move here from IIF
13+
abstract type AbstractManifoldMinimize <: AbstractRelative end
1414

1515
# NOTE DF, Convolution is IIF idea, but DFG should know about "FactorOperationalMemory"
1616
# DF, IIF.CommonConvWrapper <: FactorOperationalMemory #

src/services/AbstractDFG.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -950,20 +950,22 @@ Related:
950950
- [`getNeighborhood`](@ref)
951951
- [`mergeGraph!`](@ref)
952952
"""
953-
function copyGraph!(destDFG::AbstractDFG,
954-
sourceDFG::AbstractDFG,
955-
variableLabels::Vector{Symbol},
956-
factorLabels::Vector{Symbol};
957-
copyGraphMetadata::Bool=false,
958-
overwriteDest::Bool=false,
959-
deepcopyNodes::Bool=false,
960-
verbose::Bool = false)
953+
function copyGraph!(
954+
destDFG::AbstractDFG,
955+
sourceDFG::AbstractDFG,
956+
variableLabels::AbstractVector{Symbol}=listVariables(sourceDFG),
957+
factorLabels::AbstractVector{Symbol}=listFactors(sourceDFG);
958+
copyGraphMetadata::Bool=false,
959+
overwriteDest::Bool=false,
960+
deepcopyNodes::Bool=false,
961+
verbose::Bool = false
962+
)
961963
# Split into variables and factors
962964
sourceVariables = map(vId->getVariable(sourceDFG, vId), variableLabels)
963965
sourceFactors = map(fId->getFactor(sourceDFG, fId), factorLabels)
964966

965967
# Now we have to add all variables first,
966-
for variable in sourceVariables
968+
@showprogress "copy variables" for variable in sourceVariables
967969
variableCopy = deepcopyNodes ? deepcopy(variable) : variable
968970
if !exists(destDFG, variable)
969971
addVariable!(destDFG, variableCopy)
@@ -974,7 +976,7 @@ function copyGraph!(destDFG::AbstractDFG,
974976
end
975977
end
976978
# And then all factors to the destDFG.
977-
for factor in sourceFactors
979+
@showprogress "copy factors" for factor in sourceFactors
978980
# Get the original factor variables (we need them to create it)
979981
sourceFactorVariableIds = collect(factor._variableOrderSymbols)
980982
# Find the labels and associated variables in our new subgraph

src/services/CompareUtils.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ end
3333
## Compare
3434
##==============================================================================
3535

36-
function compareField(Allc, Bllc, syms)::Bool
36+
function compareField(Allc, Bllc, syms)
3737
(!isdefined(Allc, syms) && !isdefined(Bllc, syms)) && return true
3838
!isdefined(Allc, syms) && return false
3939
!isdefined(Bllc, syms) && return false
4040
a = getproperty(Allc, syms)
4141
b = getproperty(Bllc, syms)
42+
@debug "Comparing field directly a vs b" syms a b
4243
if a isa Base.RefValue
4344
return a[] == b[]
4445
else
@@ -72,23 +73,23 @@ end
7273
function compareFields( Al::T,
7374
Bl::T;
7475
show::Bool=true,
75-
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Union{Number, AbstractString}}
76+
skip::Vector{Symbol}=Symbol[] ) where {T <: Union{Number, AbstractString}}
7677
#
7778
return Al == Bl
7879
end
7980

8081
function compareAll(Al::T,
8182
Bl::T;
8283
show::Bool=true,
83-
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Union{AbstractString,Symbol}}
84+
skip::Vector{Symbol}=Symbol[] ) where {T <: Union{AbstractString,Symbol}}
8485
#
8586
return Al == Bl
8687
end
8788

8889
function compareAll(Al::T,
8990
Bl::T;
9091
show::Bool=true,
91-
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Union{Array{<:Number}, Number}}
92+
skip::Vector{Symbol}=Symbol[] ) where {T <: Union{Array{<:Number}, Number}}
9293
#
9394
(length(Al) != length(Bl)) && return false
9495
return norm(Al - Bl) < 1e-6
@@ -97,7 +98,7 @@ end
9798
function compareAll(Al::T,
9899
Bl::T;
99100
show::Bool=true,
100-
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Array}
101+
skip::Vector{Symbol}=Symbol[] ) where {T <: Array}
101102
#
102103
(length(Al) != length(Bl)) && return false
103104
for i in 1:length(Al)
@@ -131,7 +132,7 @@ end
131132
function compareAll(Al::T,
132133
Bl::T;
133134
show::Bool=true,
134-
skip::Vector{Symbol}=Symbol[] )::Bool where {T <: Dict}
135+
skip::Vector{Symbol}=Symbol[] ) where {T <: Dict}
135136
#
136137
(length(Al) != length(Bl)) && return false
137138
for (id, val) in Al

test/testBlocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct TestFunctorInferenceType1 <: AbstractRelative end
3232
struct TestFunctorInferenceType2 <: AbstractRelative end
3333

3434
struct TestAbstractPrior <: AbstractPrior end
35-
struct TestAbstractRelativeFactor <: AbstractRelativeRoots end
35+
# struct TestAbstractRelativeFactor <: AbstractRelativeRoots end
3636
struct TestAbstractRelativeFactorMinimize <: AbstractRelativeMinimize end
3737

3838
Base.@kwdef struct PackedTestFunctorInferenceType1 <: AbstractPackedFactor

0 commit comments

Comments
 (0)