Skip to content

Commit 73c7f8a

Browse files
authored
Merge pull request #991 from JuliaRobotics/23Q1/maint/sdkv6
Changes needed for NvaSDK v0.6
2 parents e79bed1 + ae8113b commit 73c7f8a

File tree

5 files changed

+42
-23
lines changed

5 files changed

+42
-23
lines changed

src/DataBlobs/entities/BlobEntry.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,4 @@ StructTypes.StructType(::Type{BlobEntry}) = StructTypes.UnorderedStruct()
3030
StructTypes.idproperty(::Type{BlobEntry}) = :id
3131
StructTypes.omitempties(::Type{BlobEntry}) = (:id,)
3232

33-
34-
3533
_fixtimezone(cts::NamedTuple) = ZonedDateTime(cts.utc_datetime*"+00")

src/DataBlobs/services/BlobEntry.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function assertHash(de::BlobEntry, db; hashfunction::Function = sha256)
4646
end
4747

4848

49-
function Base.show(io::IO, entry::BlobEntry)
49+
function Base.show(io::IO, ::MIME"text/plain", entry::BlobEntry)
5050
println(io, "_type=BlobEntry {")
5151
println(io, " id: ", entry.id)
5252
println(io, " blobId: ", entry.blobId)
@@ -62,10 +62,6 @@ function Base.show(io::IO, entry::BlobEntry)
6262
println(io, "}")
6363
end
6464

65-
Base.show(io::IO, ::MIME"text/plain", entry::BlobEntry) = show(io, entry)
66-
67-
68-
6965
##==============================================================================
7066
## BlobEntry - CRUD
7167
##==============================================================================

src/entities/DFGFactor.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ Base.@kwdef mutable struct GenericFunctionNodeData{T<:Union{<:AbstractPackedFact
4848
inflation::Float64 = 0.0
4949
end
5050

51+
# TODO should we move non FactorOperationalMemory to DFGFactor:
52+
# fnc, multihypo, nullhypo, inflation ?
53+
# that way we split solverData <: FactorOperationalMemory and constants
54+
# TODO see if above ever changes?
55+
56+
5157
## Constructors
5258

5359

@@ -78,8 +84,7 @@ FunctionNodeData(args...; kw...) = FunctionNodeData{typeof(args[4])}(args...; kw
7884

7985
# Packed Factor
8086
Base.@kwdef struct PackedFactor
81-
# NOTE: This has to match the order of the JSON deserializer as we're using OrderedStructs.
82-
id::Union{UUID, Nothing}
87+
id::Union{UUID, Nothing} = nothing
8388
label::Symbol
8489
tags::Vector{Symbol}
8590
_variableOrderSymbols::Vector{Symbol}
@@ -89,7 +94,7 @@ Base.@kwdef struct PackedFactor
8994
solvable::Int
9095
data::String
9196
metadata::String
92-
_version::String
97+
_version::String = string(_getDFGVersion())
9398
end
9499

95100
StructTypes.StructType(::Type{PackedFactor}) = StructTypes.UnorderedStruct()

src/entities/DFGVariable.jl

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ VariableNodeData(variableType::InferenceVariable; kwargs...) = VariableNodeData{
9191

9292
"""
9393
$(TYPEDEF)
94-
Packed VariabeNodeData structure for serializing DFGVariables.
94+
Packed VariableNodeData structure for serializing DFGVariables.
9595
9696
---
9797
Fields:
@@ -179,19 +179,18 @@ getEstimateFields(::MeanMaxPPE) = [:suggested, :max, :mean]
179179

180180
# Packed Variable
181181
Base.@kwdef struct PackedVariable
182-
# NOTE: This has to match the order of the JSON deserializer as we're using OrderedStructs.
183-
id::Union{UUID, Nothing}
182+
id::Union{UUID, Nothing} = nothing
184183
label::Symbol
185-
tags::Vector{Symbol}
186-
timestamp::ZonedDateTime
187-
nstime::Int
188-
ppes::Vector{MeanMaxPPE}
189-
blobEntries::Vector{BlobEntry}
184+
tags::Vector{Symbol} = Symbol[]
185+
timestamp::ZonedDateTime = now(tz"UTC")
186+
nstime::Int = 0
187+
ppes::Vector{MeanMaxPPE} = MeanMaxPPE[]
188+
blobEntries::Vector{BlobEntry} = BlobEntry[]
190189
variableType::String
191-
_version::String
192-
metadata::String
193-
solvable::Int
194-
solverData::Vector{PackedVariableNodeData}
190+
_version::String = string(_getDFGVersion())
191+
metadata::String = "e30="
192+
solvable::Int = 1
193+
solverData::Vector{PackedVariableNodeData} = PackedVariableNodeData[]
195194
end
196195

197196
StructTypes.StructType(::Type{PackedVariable}) = StructTypes.UnorderedStruct()
@@ -344,6 +343,27 @@ Base.@kwdef struct DFGVariableSummary <: AbstractDFGVariable
344343
dataDict::Dict{Symbol, BlobEntry}
345344
end
346345

346+
function DFGVariableSummary(
347+
id,
348+
label,
349+
timestamp,
350+
tags,
351+
::Nothing,
352+
variableTypeName,
353+
::Nothing,
354+
)
355+
return DFGVariableSummary(
356+
id,
357+
label,
358+
timestamp,
359+
tags,
360+
Dict{Symbol, MeanMaxPPE}(),
361+
variableTypeName,
362+
Dict{Symbol, BlobEntry}(),
363+
)
364+
end
365+
366+
StructTypes.names(::Type{DFGVariableSummary}) = ((:variableTypeName, :variableType),)
347367

348368
##------------------------------------------------------------------------------
349369
## SkeletonDFGVariable.jl

test/testBlocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ function VSDTestBlock!(fg, v1)
702702
# - `updateVariableSolverData!`
703703
# - `deleteVariableSolverData!`
704704
#
705-
# > - `getVariableSolverDataAll` #TODO Data is already plural so maybe Variables, All or Dict
705+
# > - `getVariableSolverDataAll` #TODO Data is already plural so maybe Variables, All or Dict, or use Datum for singular
706706
# > - `getVariablesSolverData`
707707
#
708708
# **Set like**

0 commit comments

Comments
 (0)