@@ -386,25 +386,26 @@ function DefaultNodeDataParametric(
386
386
# gbw2, Symbol[], sp,
387
387
# dims, false, :_null, Symbol[], variableType, true, 0.0, false, dontmargin)
388
388
else
389
- sp = round .(Int, range (dodims; stop = dodims + dims - 1 , length = dims))
389
+ # dimIDs = round.(Int, range(dodims; stop = dodims + dims - 1, length = dims))
390
390
ϵ = getPointIdentity (variableType)
391
- return VariableNodeData (
392
- [ϵ],
393
- zeros (dims, dims),
394
- Symbol[],
395
- sp,
391
+ return VariableNodeData (;
392
+ id= nothing ,
393
+ val= [ϵ],
394
+ bw= zeros (dims, dims),
395
+ # Symbol[],
396
+ # dimIDs,
396
397
dims,
397
- false ,
398
- :_null ,
399
- Symbol[],
398
+ # false,
399
+ # :_null,
400
+ # Symbol[],
400
401
variableType,
401
- false ,
402
- zeros (dims),
403
- false ,
402
+ initialized = false ,
403
+ infoPerCoord = zeros (dims),
404
+ ismargin = false ,
404
405
dontmargin,
405
- 0 ,
406
- 0 ,
407
- :parametric ,
406
+ # 0,
407
+ # 0,
408
+ solveKey ,
408
409
)
409
410
end
410
411
end
@@ -440,7 +441,7 @@ function setDefaultNodeData!(
440
441
v:: DFGVariable ,
441
442
dodims:: Int ,
442
443
N:: Int ,
443
- dims:: Int ;
444
+ dims:: Int = getDimension (v) ;
444
445
solveKey:: Symbol = :default ,
445
446
gt = Dict (),
446
447
initialized:: Bool = true ,
@@ -453,42 +454,43 @@ function setDefaultNodeData!(
453
454
data = nothing
454
455
isinit = false
455
456
sp = Int[0 ;]
456
- (valpts, bws ) = if initialized
457
+ (val, bw ) = if initialized
457
458
pN = resample (getBelief (v))
458
- bws = getBW (pN)[:, 1 : 1 ]
459
+ bw = getBW (pN)[:, 1 : 1 ]
459
460
pNpts = getPoints (pN)
460
461
isinit = true
461
- (pNpts, bws )
462
+ (pNpts, bw )
462
463
else
463
464
sp = round .(Int, range (dodims; stop = dodims + dims - 1 , length = dims))
464
465
@assert getPointType (varType) != DataType " cannot add manifold point type $(getPointType (varType)) , make sure the identity element argument in @defVariable $varType arguments is correct"
465
- valpts = Vector {getPointType(varType)} (undef, N)
466
- for i = 1 : length (valpts )
467
- valpts [i] = getPointIdentity (varType)
466
+ val = Vector {getPointType(varType)} (undef, N)
467
+ for i = 1 : length (val )
468
+ val [i] = getPointIdentity (varType)
468
469
end
469
- bws = zeros (dims, 1 )
470
+ bw = zeros (dims, 1 )
470
471
#
471
- (valpts, bws )
472
+ (val, bw )
472
473
end
473
474
# make and set the new solverData
474
475
setSolverData! (
475
476
v,
476
- VariableNodeData (
477
- valpts,
478
- bws,
479
- Symbol[],
480
- sp,
477
+ VariableNodeData (;
478
+ id= nothing ,
479
+ val,
480
+ bw,
481
+ # Symbol[],
482
+ # sp,
481
483
dims,
482
- false ,
483
- :_null ,
484
- Symbol[],
485
- varType,
486
- isinit,
487
- zeros (getDimension (v)),
488
- false ,
484
+ # false,
485
+ # :_null,
486
+ # Symbol[],
487
+ variableType = varType,
488
+ initialized = isinit,
489
+ infoPerCoord = zeros (getDimension (v)),
490
+ ismargin = false ,
489
491
dontmargin,
490
- 0 ,
491
- 0 ,
492
+ # 0,
493
+ # 0,
492
494
solveKey,
493
495
),
494
496
solveKey,
@@ -587,14 +589,17 @@ function addVariable!(
587
589
#
588
590
varType = _variableType (varTypeU)
589
591
592
+ _zonedtime (s:: DateTime ) = ZonedDateTime (s, localzone ())
593
+ _zonedtime (s:: ZonedDateTime ) = s
594
+
590
595
union! (tags, [:VARIABLE ])
591
596
v = DFGVariable (
592
597
label,
593
598
varType;
594
599
tags = Set (tags),
595
600
smallData = smalldata,
596
601
solvable = solvable,
597
- timestamp = timestamp,
602
+ timestamp = _zonedtime ( timestamp) ,
598
603
nstime = Nanosecond (nanosecondtime),
599
604
)
600
605
@@ -611,9 +616,7 @@ function addVariable!(
611
616
(:parametric in initsolvekeys) &&
612
617
setDefaultNodeDataParametric! (v, varType; initialized = false , dontmargin = dontmargin)
613
618
614
- DFG. addVariable! (dfg, v)
615
-
616
- return v
619
+ return DFG. addVariable! (dfg, v)
617
620
end
618
621
619
622
function parseusermultihypo (multihypo:: Nothing , nullhypo:: Float64 )
@@ -825,6 +828,9 @@ function DFG.addFactor!(
825
828
826
829
@assert (suppressChecks || length (multihypo) === 0 || length (multihypo) == length (Xi)) " When using multihypo=[...], the number of variables and multihypo probabilies must match. See documentation on how to include fractional data-association uncertainty."
827
830
831
+ _zonedtime (s:: ZonedDateTime ) = s
832
+ _zonedtime (s:: DateTime ) = ZonedDateTime (s, localzone ())
833
+
828
834
varOrderLabels = Symbol[v. label for v in Xi]
829
835
solverData = getDefaultFactorData (
830
836
dfg,
@@ -843,16 +849,16 @@ function DFG.addFactor!(
843
849
solverData;
844
850
tags = Set (union (tags, [:FACTOR ])),
845
851
solvable,
846
- timestamp,
852
+ timestamp = _zonedtime (timestamp) ,
847
853
)
848
854
#
849
855
850
- success = addFactor! (dfg, newFactor)
856
+ factor = addFactor! (dfg, newFactor)
851
857
852
858
# TODO : change this operation to update a conditioning variable
853
859
graphinit && doautoinit! (dfg, Xi; singles = false )
854
860
855
- return newFactor
861
+ return factor
856
862
end
857
863
858
864
function _checkFactorAdd (usrfnc, xisyms)
@@ -879,7 +885,7 @@ function DFG.addFactor!(
879
885
880
886
# variables = getVariable.(dfg, vlbs)
881
887
variables = map (vid -> getVariable (dfg, vid), vlbs)
882
- return addFactor! (dfg, variables, usrfnc; suppressChecks = suppressChecks , kw... )
888
+ return addFactor! (dfg, variables, usrfnc; suppressChecks, kw... )
883
889
end
884
890
885
891
#
0 commit comments