Skip to content

Commit 14ef9b1

Browse files
committed
Merge branch 'master' into maint/20Q3/datablob_concepts
2 parents e370ec0 + ed09f96 commit 14ef9b1

19 files changed

+252
-200
lines changed

Project.toml

Lines changed: 3 additions & 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.8.1"
3+
version = "0.9.0"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -17,6 +17,7 @@ Neo4j = "d2adbeaf-5838-5367-8a2f-e46d570981db"
1717
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1818
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1919
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
20+
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
2021
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
2122
Unmarshal = "cbff2730-442d-58d7-89d1-8e530c41eb02"
2223

@@ -31,6 +32,7 @@ LightGraphs = "1.2, 1.3"
3132
Neo4j = "2"
3233
Reexport = "0.2, 0.3, 0.4, 0.5, 1"
3334
Requires = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 1"
35+
TimeZones = "1.3.1"
3436
Unmarshal = "0.3, 0.4"
3537
julia = "1.2"
3638

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# DistributedFactorGraphs.jl
22

3-
Release v0.8 | Dev | Coverage | DFG Docs | Caesar Docs |
4-
---------|-----|----------|------|------------
5-
[![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=release/v0.8)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Codecov Status](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl) | [![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/DistributedFactorGraphs.jl/latest/) | [![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/Caesar.jl/latest/)
3+
Release v0.8 | Release v0.9 | Dev | Coverage | DFG Docs | Caesar Docs |
4+
---------|---------|-----|----------|------|------------
5+
[![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=release/v0.8)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=release/v0.9)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Codecov Status](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl) | [![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/DistributedFactorGraphs.jl/latest/) | [![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/Caesar.jl/latest/)
66

77
DistributedFactorGraphs.jl provides a flexible factor graph API for use in the [Caesar.jl](https://github.com/JuliaRobotics/Caesar.jl) ecosystem. The package supplies:
88
* A standardized API for interacting with factor graphs

docs/src/variable_factor_serialization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using IncrementalInference, RoME
1818

1919
# Make a variable and a factor:
2020
# Make a simple graph
21-
dfg = GraphsDFG{SolverParams}(params=SolverParams())
21+
dfg = LightDFG{SolverParams}(params=SolverParams())
2222
# Add the first pose :x0
2323
x0 = addVariable!(dfg, :x0, Pose2)
2424
# Add at a fixed location PriorPose2 to pin :x0 to a starting location (10,10, pi/4)
@@ -44,7 +44,7 @@ using IncrementalInference, RoME
4444

4545
# Make a variable and a factor:
4646
# Make a simple graph
47-
dfg = GraphsDFG{SolverParams}(params=SolverParams())
47+
dfg = LightDFG{SolverParams}(params=SolverParams())
4848
# Add the first pose :x0
4949
x0 = addVariable!(dfg, :x0, Pose2)
5050
# Add at a fixed location PriorPose2 to pin :x0 to a starting location (10,10, pi/4)

src/Deprecated.jl

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,29 @@
44

55

66
##==============================================================================
7-
## Remove in 0.9
7+
## Remove in 0.10
88
##==============================================================================
99

10-
import Base: *
11-
12-
function *(a::Symbol, b::AbstractString)
13-
@warn "product * on ::Symbol ::String has been deprecated, please use Symbol(string(a,b)) or Symbol(a,b) directly"
14-
Symbol(string(a,b))
15-
end
16-
17-
setTimestamp!(f::FactorDataLevel1, ts::DateTime) = error("setTimestamp!(f::FactorDataLevel1, ts::DateTime) is deprecated")
18-
19-
export GraphsDFG
20-
struct GraphsDFG{AbstractParams}
21-
GraphsDFG{T}() where T = error("GraphsDFG is deprecated, use LightDFG, see https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/398")
10+
# temporary promote with warning
11+
Base.promote_rule(::Type{DateTime}, ::Type{ZonedDateTime}) = DateTime
12+
function Base.convert(::Type{DateTime}, ts::ZonedDateTime)
13+
@warn "DFG now uses ZonedDateTime, temporary promoting and converting to DateTime local time"
14+
return DateTime(ts, Local)
2215
end
23-
GraphsDFG(args...; kwargs...) = GraphsDFG{AbstractParams}()
24-
GraphsDFG{T}(args...; kwargs...) where T = GraphsDFG{T}()
2516

17+
export listSolvekeys
2618

27-
@deprecate getInternalId(args...) error("getInternalId is no longer in use")
19+
@deprecate listSolvekeys(x...) listSolveKeys(x...)
2820

29-
@deprecate loadDFG(source::AbstractString, iifModule::Module, dest::AbstractDFG) loadDFG!(dest, source)
30-
@deprecate loadDFG(dest::AbstractDFG, source::AbstractString) loadDFG!(dest, source)
21+
export InferenceType
22+
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
3123

32-
# leave a bit longer
33-
export buildSubgraphFromLabels!
34-
function buildSubgraphFromLabels!(dfg::AbstractDFG,
35-
syms::Vector{Symbol};
36-
subfg::AbstractDFG=LightDFG(solverParams=getSolverParams(dfg)),
37-
solvable::Int=0,
38-
allowedFactors::Union{Nothing, Vector{Symbol}}=nothing )
39-
error("""buildSubgraphFromLabels! is deprecated
40-
NOTE buildSubgraphFromLabels! does not have a 1-1 replacement in DFG
41-
- if you have a set of variables and factors use copyGraph
42-
- if you want neighbors automatically included use buildSubgraph
43-
- if you want a clique subgraph use buildCliqueSubgraph! from IIF
44-
""")
24+
abstract type InferenceType end
4525

46-
end
47-
48-
49-
##==============================================================================
50-
## Remove in 0.10
51-
##==============================================================================
26+
# These will become AbstractPrior, AbstractRelativeFactor, and AbstractRelativeFactorMinimize in 0.9.
27+
abstract type FunctorSingleton <: FunctorInferenceType end
28+
abstract type FunctorPairwise <: FunctorInferenceType end
29+
abstract type FunctorPairwiseMinimize <: FunctorInferenceType end
5230

5331
# I don't know how to deprecate this, any suggestions?
5432
const AbstractBigDataEntry = AbstractDataEntry

src/DistributedFactorGraphs.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ using Base
1818
using DocStringExtensions
1919
using Requires
2020
using Dates
21+
using TimeZones
2122
using Distributions
2223
using Reexport
2324
using JSON
@@ -55,11 +56,6 @@ export emptyUserData!, emptyRobotData!, emptySessionData!
5556

5657
# Graph Types: exported from modules or @reexport
5758
export InMemoryDFGTypes, DefaultDFG
58-
# LightDFG
59-
# GraphsDFG
60-
61-
# CloudGraphsDFG
62-
# FileDFG
6359

6460
# AbstractDFG Interface
6561
export exists,
@@ -68,7 +64,7 @@ export exists,
6864
updateVariable!, updateFactor!,
6965
deleteVariable!, deleteFactor!,
7066
listVariables, listFactors,
71-
listSolvekeys, listSupersolves,
67+
listSolveKeys, listSupersolves,
7268
getVariables, getFactors,
7369
isVariable, isFactor
7470

@@ -181,8 +177,9 @@ export addData!, fetchData, fetchDataEntryBlob
181177
##------------------------------------------------------------------------------
182178
# Factor Data
183179
export GenericFunctionNodeData, PackedFunctionNodeData, FunctionNodeData
184-
export InferenceType, PackedInferenceType, FunctorInferenceType, FactorOperationalMemory
185-
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
180+
export FunctorInferenceType, PackedInferenceType
181+
export AbstractPrior, AbstractRelativeFactor, AbstractRelativeFactorMinimize
182+
export FactorOperationalMemory
186183

187184
# accessors
188185
export getVariableOrder
@@ -236,8 +233,6 @@ export
236233

237234

238235
## Deprecated exports should be listed in Deprecated.jl if possible, otherwise here
239-
#TODO remove export in DFG v0.8.0
240-
# export ConvolutionObject
241236

242237
## CustomPrinting.jl
243238
export printFactor, printVariable, printNode
@@ -259,7 +254,7 @@ include("entities/AbstractDFGSummary.jl")
259254
include("services/AbstractDFG.jl")
260255

261256
# In Memory Types
262-
# include("GraphsDFG/GraphsDFG.jl")
257+
# include("../attic/GraphsDFG/GraphsDFG.jl")
263258
# @reexport using .GraphsDFGs
264259
include("LightDFG/LightDFG.jl")
265260
@reexport using .LightDFGs

src/entities/DFGFactor.jl

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
## Abstract Types
33
##==============================================================================
44

5-
abstract type InferenceType end
6-
abstract type PackedInferenceType end
7-
85
abstract type FunctorInferenceType <: Function end
6+
abstract type PackedInferenceType end
97

108
# NOTE DF, Convolution is IIF idea, but DFG should know about "FactorOperationalMemory"
119
# DF, IIF.CommonConvWrapper <: FactorOperationalMemory #
@@ -14,9 +12,9 @@ abstract type FactorOperationalMemory <: Function end
1412
# we can add to IIF or have IIF.CommonConvWrapper <: FactorOperationalMemory directly
1513
# abstract type ConvolutionObject <: FactorOperationalMemory end
1614

17-
abstract type FunctorSingleton <: FunctorInferenceType end
18-
abstract type FunctorPairwise <: FunctorInferenceType end
19-
abstract type FunctorPairwiseMinimize <: FunctorInferenceType end
15+
abstract type AbstractPrior <: FunctorInferenceType end
16+
abstract type AbstractRelativeFactor <: FunctorInferenceType end
17+
abstract type AbstractRelativeFactorMinimize <: FunctorInferenceType end
2018

2119
##==============================================================================
2220
## GenericFunctionNodeData
@@ -30,32 +28,39 @@ Notes
3028
3129
Designing (WIP)
3230
- T <: Union{FactorOperationalMemory, PackedInferenceType}
33-
- in IIF.CCW{T <: DFG.InferenceType}
34-
- in IIF.FunctorPairwiseMinimize <: InferenceType # DFG whatever, something, we'll figure it out
35-
- in Main/User, SomeFactor <: FunctorPairwiseMinimize
31+
- in IIF.CCW{T <: DFG.FunctorInferenceType}
32+
- in DFG.AbstractRelativeFactorMinimize <: FunctorInferenceType
33+
- in Main.SomeFactor <: AbstractRelativeFactorMinimize
3634
"""
3735
mutable struct GenericFunctionNodeData{T<:Union{PackedInferenceType, FunctorInferenceType, FactorOperationalMemory}}
3836
eliminated::Bool
3937
potentialused::Bool
4038
edgeIDs::Vector{Int}
4139
fnc::T
42-
multihypo::Vector{Float64} # FIXME likely to moved when GenericWrapParam is refactored #477
40+
multihypo::Vector{Float64} # TODO re-evaluate after refactoring w #477
4341
certainhypo::Vector{Int}
42+
nullhypo::Float64
4443
solveInProgress::Int
44+
45+
# TODO deprecate all these inner constructors at end of DFG v0.9.x (was added for GFND.nullhypo::Float64 breaking change)
46+
GenericFunctionNodeData{T}(el,po,ed,fn,mu::Vector{<:Real},ce::Vector{Int},so::Int) where T = new{T}(el,po,ed,fn,mu,ce,0.0,so)
47+
GenericFunctionNodeData{T}(el,po,ed,fn,mu::Vector{<:Real},ce::Vector{Int},nu::Real,so::Int) where T = new{T}(el,po,ed,fn,mu,ce,nu,so)
4548
end
4649

4750
## Constructors
4851

4952
GenericFunctionNodeData{T}() where T =
50-
GenericFunctionNodeData{T}(false, false, Int[], T(), Float64[], Int[], 0)
51-
52-
function GenericFunctionNodeData(eliminated,
53-
potentialused,
54-
edgeIDs,
55-
fnc,
56-
multihypo=Float64[],
57-
certainhypo=Int[])
58-
return GenericFunctionNodeData(eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, 0)
53+
GenericFunctionNodeData{T}(false, false, Int[], T(), Float64[], Int[], 0, 0)
54+
55+
function GenericFunctionNodeData(eliminated::Bool,
56+
potentialused::Bool,
57+
edgeIDs::Vector{Int},
58+
fnc::T,
59+
multihypo::Vector{<:Real}=Float64[],
60+
certainhypo::Vector{Int}=Int[],
61+
nullhypo::Real=0,
62+
solveInP::Int=0) where T
63+
return GenericFunctionNodeData{T}(eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, nullhypo, solveInP)
5964
end
6065

6166

@@ -100,7 +105,7 @@ struct DFGFactor{T, N} <: AbstractDFGFactor
100105
label::Symbol
101106
"""Variable timestamp.
102107
Accessors: [`getTimestamp`](@ref), [`setTimestamp`](@ref)"""
103-
timestamp::DateTime
108+
timestamp::ZonedDateTime
104109
"""Nano second time, for more resolution on timestamp (only subsecond information)"""
105110
nstime::Nanosecond
106111
"""Factor tags, e.g [:FACTOR].
@@ -116,14 +121,21 @@ struct DFGFactor{T, N} <: AbstractDFGFactor
116121
Accessors: [`getVariableOrder`](@ref)"""
117122
_variableOrderSymbols::NTuple{N,Symbol}
118123
# Inner constructor
119-
DFGFactor{T}(label::Symbol,
120-
timestamp::DateTime,
124+
function DFGFactor{T}(label::Symbol,
125+
timestamp::Union{DateTime,ZonedDateTime},
121126
nstime::Nanosecond,
122127
tags::Set{Symbol},
123128
solverData::GenericFunctionNodeData{T},
124129
solvable::Int,
125-
_variableOrderSymbols::NTuple{N,Symbol}) where {T,N} =
126-
new{T,N}(label, timestamp, nstime, tags, Ref(solverData), Ref(solvable), _variableOrderSymbols)
130+
_variableOrderSymbols::NTuple{N,Symbol}) where {T,N}
131+
132+
#TODO Deprecate remove in v0.10.
133+
if timestamp isa DateTime
134+
Base.depwarn("DFGFactor timestamp field is now a ZonedTimestamp", :DFGFactor)
135+
return new{T,N}(label, ZonedDateTime(timestamp, localzone()), nstime, tags, Ref(solverData), Ref(solvable), _variableOrderSymbols)
136+
end
137+
return new{T,N}(label, timestamp, nstime, tags, Ref(solverData), Ref(solvable), _variableOrderSymbols)
138+
end
127139

128140
end
129141

@@ -136,7 +148,7 @@ $(SIGNATURES)
136148
Construct a DFG factor given a label.
137149
"""
138150
DFGFactor(label::Symbol,
139-
timestamp::DateTime,
151+
timestamp::Union{DateTime,ZonedDateTime},
140152
nstime::Nanosecond,
141153
tags::Set{Symbol},
142154
solverData::GenericFunctionNodeData{T},
@@ -145,15 +157,15 @@ DFGFactor(label::Symbol,
145157
DFGFactor{T}(label, timestamp, nstime, tags, solverData, solvable, _variableOrderSymbols)
146158

147159

148-
DFGFactor{T}(label::Symbol, variableOrderSymbols::Vector{Symbol}, timestamp::DateTime=now(), data::GenericFunctionNodeData{T} = GenericFunctionNodeData{T}()) where {T} =
160+
DFGFactor{T}(label::Symbol, variableOrderSymbols::Vector{Symbol}, timestamp::Union{DateTime,ZonedDateTime}=now(localzone()), data::GenericFunctionNodeData{T} = GenericFunctionNodeData{T}()) where {T} =
149161
DFGFactor(label, timestamp, Nanosecond(0), Set{Symbol}(), data, 1, Tuple(variableOrderSymbols))
150162

151163

152164
DFGFactor(label::Symbol,
153165
variableOrderSymbols::Vector{Symbol},
154166
data::GenericFunctionNodeData{T};
155167
tags::Set{Symbol}=Set{Symbol}(),
156-
timestamp::DateTime=now(),
168+
timestamp::Union{DateTime,ZonedDateTime}=now(localzone()),
157169
solvable::Int=1,
158170
nstime::Nanosecond = Nanosecond(0)) where {T} =
159171
DFGFactor{T}(label, timestamp, nstime, tags, data, solvable, Tuple(variableOrderSymbols))
@@ -173,6 +185,10 @@ end
173185
Base.setproperty!(x::DFGFactor,f::Symbol, val) = begin
174186
if f == :solvable || f == :solverData
175187
getfield(x,f)[] = val
188+
elseif f == :timestamp && val isa DateTime
189+
# #TODO Deprecation - Remove in v0.10
190+
Base.depwarn("DFGFactor timestamp field is now a ZonedTimestamp", :setproperty!)
191+
setfield!(x,:timestamp, ZonedDateTime(val, localzone()))
176192
else
177193
setfield!(x,f,val)
178194
end
@@ -195,7 +211,7 @@ struct DFGFactorSummary <: AbstractDFGFactor
195211
label::Symbol
196212
"""Variable timestamp.
197213
Accessors: [`getTimestamp`](@ref)"""
198-
timestamp::DateTime
214+
timestamp::ZonedDateTime
199215
"""Factor tags, e.g [:FACTOR].
200216
Accessors: [`getTags`](@ref), [`mergeTags!`](@ref), and [`removeTags!`](@ref)"""
201217
tags::Set{Symbol}

0 commit comments

Comments
 (0)