WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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: 2 additions & 0 deletions IncrementalInference/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
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 Down Expand Up @@ -108,6 +109,7 @@ StatsBase = "0.32, 0.33, 0.34"
StructTypes = "1"
TensorCast = "0.3.3, 0.4"
TimeZones = "1.3.1"
TimesDates = "0.3.3"
julia = "1.10"

[extras]
Expand Down
4 changes: 2 additions & 2 deletions IncrementalInference/src/ExportAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export AbstractDFG,
diagm,
listBlobEntries,
FolderStore,
addBlobStore!,
addBlobstore!,
addData!,
addBlob!,
getData,
VariableCompute,
DFGVariableSummary,
VariableSummary,
FactorCompute,
DFGFactorSummary,
deleteVariableSolverData!
Expand Down
2 changes: 1 addition & 1 deletion IncrementalInference/src/Factors/LinearRelative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ X_2 = X_1 + η_Z
```
"""
DFG.@tags struct LinearRelative{N, T <: SamplableBelief} <: RelativeObservation
Z::T & (lower = DFG.Packed, choosetype = DFG.resolvePackedType)
Z::T & DFG.@packed
end

# need several helper constructors since the dimension over which LinearRelative will be used is unknown at this point
Expand Down
2 changes: 1 addition & 1 deletion IncrementalInference/src/Factors/Mixture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end

DFG.@tags struct PackedMixture
components::NamedTuple & (choosetype = obj->NamedTuple{Tuple(Symbol.(keys(obj))), Tuple{DFG.resolveType.(values(obj))...}}, )
prior & (lower = DFG.Packed, choosetype = DFG.resolvePackedType)
prior & DFG.@packed
end

function DFG.pack(m::Mixture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DFG.@tags struct PartialPriorPassThrough{
B <: Union{<:HeatmapGridDensity, <:LevelSetGridNormal},
T <: Tuple,
} <: AbstractPriorObservation
Z::B & (lower = DFG.Packed, choosetype = DFG.resolvePackedType)
Z::B & DFG.@packed
partial::T & (choosetype = x->NTuple{length(x), Int},)
end

Expand Down
3 changes: 3 additions & 0 deletions IncrementalInference/src/IncrementalInference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ using Dates,
UUIDs,
TensorCast

using TimesDates: TimeDateZone
using TimeZones: ZonedDateTime

using StructTypes

using StaticArrays
Expand Down
58 changes: 32 additions & 26 deletions IncrementalInference/src/services/FactorGraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -566,61 +566,67 @@ fg = initfg()
addVariable!(fg, :x0, Pose2)
```
"""
function addVariable!(
function DFG.addVariable!(
dfg::AbstractDFG,
label::Symbol,
varTypeU::Union{T, Type{T}};
N::Int = getSolverParams(dfg).N,
statetype::Union{T, Type{T}};
tags::Union{Set{Symbol}, Vector{Symbol}} = Set{Symbol}(),
timestamp::Union{TimeDateZone, ZonedDateTime} = DFG.now_tdz(),
solvable::Int = 1,
timestamp::Union{DateTime, ZonedDateTime} = now(localzone()),
nanosecondtime = nothing,
# dontmargin::Bool = false,
tags::Vector{Symbol} = Symbol[],
smalldata = Dict{Symbol, DFG.MetadataTypes}(),
# IIF extras
N::Int = getSolverParams(dfg).N,
checkduplicates::Bool = true,
# dontmargin::Bool = false,
initsolvekeys::Vector{Symbol} = getSolverParams(dfg).algorithms,

#deprecated v0.37
smalldata = nothing,
nanosecondtime = nothing,

# default DFG
bloblets = DFG.Bloblets(),
blobentries = DFG.Blobentries(),
kwargs...,
) where {T <: StateType}

if !isnothing(nanosecondtime)
Base.depwarn(
"nanosecondtime kwarg is deprecated, use `timestamp` instead",
:addVariable!,
)
error("nanosecondtime kwarg is deprecated, use `timestamp` instead")
end

varType = _variableType(varTypeU)

_zonedtime(s::DateTime) = ZonedDateTime(s, localzone())
_zonedtime(s::ZonedDateTime) = s
if !isnothing(smalldata)
error("smalldata kwarg is deprecated, use `bloblets` instead")
end

union!(tags, [:VARIABLE])
v = VariableCompute(
tags = union(Set(tags), [:VARIABLE])
v = VariableDFG(
label,
varType;
tags = Set(tags),
bloblets = smalldata,
solvable = solvable,
timestamp = _zonedtime(timestamp),
statetype;
tags,
bloblets,
blobentries,
solvable,
timestamp,
kwargs...,
)

(:default in initsolvekeys) && setDefaultNodeData!(
v,
0,
N;
initialized = false,
varType = varType,
varType = T(),
# dontmargin = dontmargin,
) # dodims

(:parametric in initsolvekeys) &&
setDefaultNodeDataParametric!(
v,
varType;
T();
initialized = false,
# dontmargin = dontmargin
)

return DFG.addVariable!(dfg, v)
return addVariable!(dfg, v)
end

function parseusermultihypo(multihypo::Nothing, nullhypo::Float64)
Expand Down
2 changes: 1 addition & 1 deletion IncrementalInference/src/services/SolverUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ end
Check if a variable might already be located at the test location, by means of a (default) `refKey=:simulated` PPE stored in the existing variables.

Notes
- Checks, using provided `factor` from `srcLabel` in `fg` to an assumed `dest` variable whcih may or may not yet exist.
- Checks, using provided `factor` from `srcLabel` in `fg` to an assumed `dest` variable which may or may not yet exist.
- This function was written to aid in building simulation code,
- it's use in real world usage may have unexpected behaviour -- hence not exported.
- Return `::Tuple{Bool, Vector{Float64}, Symbol}`, eg. already exists `(true, [refVal], :l17)`, or if a refernce variable does not yet `(false, [refVal], :l28)`.
Expand Down
2 changes: 1 addition & 1 deletion IncrementalInferenceTypes/src/factors/LinearRelative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ X_2 = X_1 + η_Z
```
"""
# @tags struct LinearRelative{T} <: RelativeObservation
# Z::T & (lower = DFG.Packed, choosetype = DFG.resolvePackedType)
# Z::T & DFG.@packed
# end

#TODO
Expand Down
Loading