Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- name: Run tests
env:
IIF_TEST: true
IIF_TEST: false #FIXME skipping until IIF stable again
uses: julia-actions/julia-runtest@latest
- name: Process Coverage
uses: julia-actions/julia-processcoverage@v1
Expand Down
6 changes: 2 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ version = "0.28.0"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand All @@ -16,7 +15,6 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ManifoldsBase = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
NanoDates = "46f1a544-deae-4307-8689-c12aa3c955c6"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Expand All @@ -29,6 +27,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
TensorCast = "02d47bb6-7ce6-556a-be16-bb1710789e2b"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
TimesDates = "bdfc003b-8df8-5c39-adcd-3a9087f5df4a"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[weakdeps]
Expand All @@ -45,7 +44,6 @@ Arrow = "2.7"
Base64 = "1.10"
CSV = "0.10"
CodecZlib = "0.7"
Colors = "0.10, 0.11, 0.12, 0.13"
Dates = "1.10"
Distributions = "0.23, 0.24, 0.25"
DocStringExtensions = "0.8, 0.9"
Expand All @@ -57,7 +55,6 @@ JSON = "1.0.0"
LieGroups = "0.1"
LinearAlgebra = "1.10"
ManifoldsBase = "1, 2"
NanoDates = "1.0.3"
OrderedCollections = "1.4"
Pkg = "1.4, 1.5"
ProgressMeter = "1"
Expand All @@ -72,6 +69,7 @@ Tar = "1.9"
TensorCast = "0.3.3, 0.4"
Test = "1.10"
TimeZones = "1.3.1"
TimesDates = "0.3.3"
UUIDs = "1.10"
julia = "1.10"

Expand Down
3 changes: 1 addition & 2 deletions ext/DFGPlots.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module DFGPlots

using Colors
using Graphs
using DocStringExtensions
using GraphMakie

using GraphMakie.Makie: @colorant_str, RGB
using DistributedFactorGraphs

import DistributedFactorGraphs: plotDFG
Expand Down
3 changes: 1 addition & 2 deletions src/Common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ end
##==============================================================================
## Validation of session, robot, and user labels.
##==============================================================================
global _invalidIds =
["GRAPH", "AGENT", "VARIABLE", "FACTOR", "PPE", "BLOB_ENTRY", "FACTORGRAPH"]
global _invalidIds = ["GRAPH", "AGENT", "VARIABLE", "FACTOR", "BLOB_ENTRY", "FACTORGRAPH"]

const global _validLabelRegex::Regex = r"^[a-zA-Z][-\w\.\@]*$"

Expand Down
33 changes: 28 additions & 5 deletions src/DataBlobs/entities/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,26 @@ StructUtils.@kwarg struct Blobentry
""" Additional information that can help a different user of the Blob. """
description::String = ""
""" MIME description describing the format of binary data in the `Blob`, e.g. 'image/png' or 'application/json'. """
mimetype::String = "application/octet-stream" #FIXME ::MIME = MIME("application/octet-stream")
mimetype::MIME = MIME("application/octet-stream")
""" Storage for a couple of bytes directly in the graph. Use with caution and keep it small and simple."""
metadata::JSONText = JSONText("{}")
""" When the Blob itself was first created. Serialized as an ISO 8601 string."""
timestamp::NanoDate = ndnow(UTC) & (json = (lower = timestamp,),)
timestamp::TimeDateZone = TimeDateZone(now(localzone()))
""" Type version of this Blobentry."""
version::VersionNumber = version(Blobentry)
version::VersionNumber = DFG.version(Blobentry)
end
version(::Type{Blobentry}) = v"0.1.0"

function Blobentry(label::Symbol, blobstore = :default; kwargs...)
return Blobentry(; label, blobstore, kwargs...)
function Blobentry(
label::Symbol,
blobstore = :default;
metadata = JSONText("{}"),
kwargs...,
)
if !(metadata isa JSONText)
metadata = JSONText(JSON.json(metadata))
end
return Blobentry(; label, blobstore, metadata, kwargs...)
end
# construction helper from existing Blobentry for user overriding via kwargs
function Blobentry(
Expand Down Expand Up @@ -123,3 +131,18 @@ function Base.setproperty!(x::Blobentry, f::Symbol, val)
end

const Blobentries = OrderedDict{Symbol, Blobentry}

function StructUtils.lower(entries::Blobentries)
return map(collect(values(entries))) do (entry)
return StructUtils.lower(entry)
end
end

function StructUtils.makedict(s::StructUtils.StructStyle, T::Type{Blobentries}, json_vector)
entries = T()
foreach(json_vector) do obj
entry, _ = StructUtils.make(s, Blobentry, obj)
return push!(entries, Symbol(obj.label[]) => entry)
end
return entries, nothing
end
73 changes: 37 additions & 36 deletions src/DataBlobs/services/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ Also see: [`addBlobentry!`](@ref), [`getBlob`](@ref), [`listBlobentries`](@ref)
"""
function getBlobentry(var::AbstractGraphVariable, key::Symbol)
if !hasBlobentry(var, key)
throw(LabelNotFoundError("Blobentry", key, collect(keys(var.dataDict))))
throw(LabelNotFoundError("Blobentry", key, collect(keys(var.blobentries))))
end
return var.dataDict[key]
return var.blobentries[key]
end

function getBlobentry(var::VariableDFG, key::Symbol)
if !hasBlobentry(var, key)
throw(LabelNotFoundError("Blobentry", key))
end
return var.blobEntries[findfirst(x -> x.label == key, var.blobEntries)]
end
# function getBlobentry(var::VariableDFG, key::Symbol)
# if !hasBlobentry(var, key)
# throw(LabelNotFoundError("Blobentry", key))
# end
# return var.blobEntries[findfirst(x -> x.label == key, var.blobEntries)]
# end

"""
$(SIGNATURES)
Expand Down Expand Up @@ -131,18 +131,19 @@ Should be extended if DFG variable is not returned by reference.
Also see: [`getBlobentry`](@ref), [`addBlob!`](@ref), [`mergeBlobentry!`](@ref)
"""
function addBlobentry!(var::VariableCompute, entry::Blobentry)
haskey(var.dataDict, entry.label) && throw(LabelExistsError("Blobentry", entry.label))
var.dataDict[entry.label] = entry
return entry
end

function addBlobentry!(var::VariableDFG, entry::Blobentry)
entry.label in getproperty.(var.blobEntries, :label) &&
haskey(var.blobentries, entry.label) &&
throw(LabelExistsError("Blobentry", entry.label))
push!(var.blobEntries, entry)
var.blobentries[entry.label] = entry
return entry
end

# function addBlobentry!(var::VariableDFG, entry::Blobentry)
# entry.label in getproperty.(var.blobEntries, :label) &&
# throw(LabelExistsError("Blobentry", entry.label))
# push!(var.blobEntries, entry)
# return entry
# end

function addBlobentry!(dfg::AbstractDFG, vLbl::Symbol, entry::Blobentry)
return addBlobentry!(getVariable(dfg, vLbl), entry)
end
Expand All @@ -158,10 +159,10 @@ If the Blobentry does not exist, it will be added.
Notes:
"""
function mergeBlobentry!(var::AbstractGraphVariable, bde::Blobentry)
if !haskey(var.dataDict, bde.label)
if !haskey(var.blobentries, bde.label)
addBlobentry!(var, bde)
else
var.dataDict[bde.label] = bde
var.blobentries[bde.label] = bde
end
return 1
end
Expand All @@ -179,15 +180,15 @@ Notes:
"""
function deleteBlobentry!(var::VariableCompute, key::Symbol)
!hasBlobentry(var, key) && throw(LabelNotFoundError("Blobentry", key))
delete!(var.dataDict, key)
delete!(var.blobentries, key)
return 1
end

function deleteBlobentry!(var::VariableDFG, key::Symbol)
!hasBlobentry(var, key) && throw(LabelNotFoundError("Blobentry", key))
deleteat!(var.blobEntries, findfirst(x -> x.label == key, var.blobEntries))
return 1
end
# function deleteBlobentry!(var::VariableDFG, key::Symbol)
# !hasBlobentry(var, key) && throw(LabelNotFoundError("Blobentry", key))
# deleteat!(var.blobEntries, findfirst(x -> x.label == key, var.blobEntries))
# return 1
# end

function deleteBlobentry!(dfg::AbstractDFG, label::Symbol, key::Symbol)
return deleteBlobentry!(getVariable(dfg, label), key)
Expand Down Expand Up @@ -223,24 +224,24 @@ end

Does a blob entry exist with `blobLabel`.
"""
hasBlobentry(v::VariableCompute, blobLabel::Symbol) = haskey(v.dataDict, blobLabel)
hasBlobentry(v::VariableCompute, blobLabel::Symbol) = haskey(v.blobentries, blobLabel)

function hasBlobentry(v::VariableDFG, label::Symbol)
return label in getproperty.(v.blobEntries, :label)
end
# function hasBlobentry(v::VariableDFG, label::Symbol)
# return label in getproperty.(v.blobEntries, :label)
# end

"""
$(SIGNATURES)

Get blob entries, returns a `Vector{Blobentry}`.
"""
function getBlobentries(v::VariableCompute)
return collect(values(v.dataDict))
return collect(values(v.blobentries))
end

function getBlobentries(v::VariableDFG)
return copy(v.blobEntries)
end
# function getBlobentries(v::VariableDFG)
# return copy(v.blobEntries)
# end

function getBlobentries(
v::AbstractGraphVariable;
Expand Down Expand Up @@ -289,12 +290,12 @@ const collectBlobentries = gatherBlobentries
List the blob entries associated with a particular variable.
"""
function listBlobentries(var::AbstractGraphVariable)
return collect(keys(var.dataDict))
return collect(keys(var.blobentries))
end

function listBlobentries(var::VariableDFG)
return getproperty.(var.blobEntries, :label)
end
# function listBlobentries(var::VariableDFG)
# return getproperty.(var.blobEntries, :label)
# end

function listBlobentries(dfg::AbstractDFG, label::Symbol)
return listBlobentries(getVariable(dfg, label))
Expand Down
21 changes: 15 additions & 6 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function getSolveInProgress(
)
# Variable
if var isa VariableCompute
if haskey(getSolverDataDict(var), solveKey)
return getSolverDataDict(var)[solveKey].solveInProgress
if haskey(refStates(var), solveKey)
return refStates(var)[solveKey].solveInProgress
else
return 0
end
Expand Down Expand Up @@ -148,6 +148,15 @@ function _getDuplicatedEmptyDFG(
# DFG.setDescription!(newDfg, "(Copy of) $(DFG.getDescription(dfg))")
return newDfg
end

#TODO is Type correct
@deprecate getVariableType(args...) getStateType(args...)

function getVariableTypeName(v::VariableSummary)
Base.depwarn("getVariableTypeName is deprecated.", :getVariableTypeName)
return v.statetype
end

## ================================================================================
## Deprecated in v0.28
##=================================================================================
Expand Down Expand Up @@ -190,7 +199,7 @@ function setSolverData!(v::VariableCompute, data::State, key::Symbol = :default)
:setSolverData!,
)
@assert key == data.solveKey "State.solveKey=:$(data.solveKey) does not match requested :$(key)"
return v.solverDataDict[key] = data
return v.states[key] = data
end

@deprecate mergeVariableSolverData!(args...; kwargs...) mergeState!(args...; kwargs...)
Expand Down Expand Up @@ -289,7 +298,7 @@ end

# Related

# [`listSolveKeys`](@ref), [`getSolverDataDict`](@ref), [`listVariables`](@ref)
# [`listSolveKeys`](@ref), [`refStates`](@ref), [`listVariables`](@ref)
# """
function listSolveKeys(
variable::VariableCompute,
Expand All @@ -298,7 +307,7 @@ function listSolveKeys(
)
Base.depwarn("listSolveKeys is deprecated, use listStates instead.", :listSolveKeys)
#
for ky in keys(getSolverDataDict(variable))
for ky in keys(refStates(variable))
push!(skeys, ky)
end

Expand Down Expand Up @@ -328,7 +337,7 @@ function listSolveKeys(
#
skeys = Set{Symbol}()
varList = listVariables(dfg, filterVariables; tags = tags, solvable = solvable)
for vs in varList #, ky in keys(getSolverDataDict(getVariable(dfg, vs)))
for vs in varList #, ky in keys(refStates(getVariable(dfg, vs)))
listSolveKeys(dfg, vs, filterSolveKeys, skeys)
end

Expand Down
Loading
Loading