@@ -2,7 +2,7 @@ using Revise
2
2
using Neo4j # So that DFG initializes the database driver.
3
3
using RoME
4
4
using DistributedFactorGraphs
5
- using Test
5
+ using Test, Dates
6
6
7
7
# start with an empty factor graph object
8
8
# fg = initfg()
@@ -24,17 +24,6 @@ IncrementalInference.compareVariable(x0, getVariable(cloudFg, :x0))
24
24
25
25
# Add at a fixed location PriorPose2 to pin :x0 to a starting location (10,10, pi/4)
26
26
prior = addFactor! (cloudFg, [:x0 ], PriorPose2 ( MvNormal ([10 ; 10 ; 1.0 / 8.0 ], Matrix (Diagonal ([0.1 ;0.1 ;0.05 ]. ^ 2 ))) ) )
27
- # retPrior = getFactor(cloudFg, :x0f1)
28
- # Do the check
29
- # IncrementalInference.compareFactor(prior, retPrior)
30
- # Testing
31
-
32
- # retPrior.data.fnc.cpt = prior.data.fnc.cpt
33
- # # This one
34
- # prior.data.fnc.cpt[1].factormetadata
35
- # deserialized: Any[Pose2(3, String[], (:Euclid, :Euclid, :Circular))]
36
- # vs.
37
- # original: Pose2[Pose2(3, String[], (:Euclid, :Euclid, :Circular))]
38
27
39
28
# Drive around in a hexagon in the cloud
40
29
for i in 0 : 5
@@ -58,60 +47,27 @@ toDotFile(localFg, "/tmp/localfg.dot")
58
47
# Alrighty! At this point, we should be able to solve locally...
59
48
# perform inference, and remember first runs are slower owing to Julia's just-in-time compiling
60
49
# Can do with graph too!
61
- tree, smt, hist = solveTree! (localFg)
50
+ # tree, smt, hist = solveTree!(localFg)
62
51
63
- wipeBuildNewTree! (localFg)
52
+ # wipeBuildNewTree!(localFg)
64
53
tree, smt, hist = solveTree! (localFg, tree) # Recycle
65
54
# batchSolve!(localFg, drawpdf=true, show=true)
66
55
# Erm, whut? Error = mcmcIterationIDs -- unaccounted variables
67
56
68
57
# Trying new method.
69
- tree, smtasks = batchSolve! (localFg, treeinit= true , drawpdf= true , show= true ,
70
- returntasks= true , limititers= 50 ,
71
- upsolve= true , downsolve= true )
72
-
73
- # ### WIP and general debugging
74
-
75
- # Testing with GenericMarginal
76
- # This will not work because GenericMarginal *shouldn't* really be persisted.
77
- # That would mean we're decomposing the cloud graph...
78
- # genmarg = GenericMarginal()
79
- # Xi = [getVariable(fg, :x0)]
80
- # addFactor!(fg, Xi, genmarg, autoinit=false)
81
-
82
- # For Juno/Jupyter style use
83
- pl = drawPoses (localFg, meanmax= :mean )
84
- plotPose (fg, :x6 )
85
- # For scripting use-cases you can export the image
86
- Gadfly. draw (Gadfly. PDF (" /tmp/test1.pdf" , 20 cm, 10 cm),pl) # or PNG(...)
87
-
88
-
89
- # Add landmarks with Bearing range measurements
90
- addVariable! (fg, :l1 , Point2, labels= [" LANDMARK" ])
91
- p2br = Pose2Point2BearingRange (Normal (0 ,0.1 ),Normal (20.0 ,1.0 ))
92
- addFactor! (fg, [:x0 ; :l1 ], p2br )
93
-
94
-
95
- # Initialize :l1 numerical values but do not rerun solver
96
- ensureAllInitialized! (fg)
97
- pl = drawPosesLandms (fg)
98
- Gadfly. draw (Gadfly. PDF (" /tmp/test2.pdf" , 20 cm, 10 cm),pl) # or PNG(...)
99
-
100
-
101
- # Add landmarks with Bearing range measurements
102
- p2br2 = Pose2Point2BearingRange (Normal (0 ,0.1 ),Normal (20.0 ,1.0 ))
103
- addFactor! (fg, [:x6 ; :l1 ], p2br2 )
104
-
105
-
106
- # solve
107
- batchSolve! (fg, drawpdf= true )
108
-
109
-
110
- # redraw
111
- pl = drawPosesLandms (fg, meanmax= :mean )
112
- Gadfly. draw (Gadfly. PDF (" /tmp/test3.pdf" , 20 cm, 10 cm),pl) # or PNG(...)
113
-
114
-
115
-
58
+ # tree, smtasks = batchSolve!(localFg, treeinit=true, drawpdf=true, show=true,
59
+ # returntasks=true, limititers=50,
60
+ # upsolve=true, downsolve=true )
61
+
62
+ # Testing writing estimates
63
+ for variable in getVariables (localFg)
64
+ means = mean (getData (variable). val, dims= 2 )[:]
65
+ variable. estimateDict[:default ] = Dict {Symbol, VariableEstimate} (:Mean => VariableEstimate (:default , :Mean , means, now ()))
66
+ end
116
67
117
- #
68
+ x0 = getVariable (localFg, :x0 )
69
+ data = getData (x0)
70
+ # Update back to cloud.
71
+ for variable in getVariables (localFg)
72
+ updateVariableSolverData! (cloudFg, variable)
73
+ end
0 commit comments