@@ -2,18 +2,21 @@ using DistributedFactorGraphs
2
2
using IncrementalInference
3
3
using Test
4
4
5
- blank () = return nothing
6
5
dfg = CloudGraphsDFG {NoSolverParams} (" localhost" , 7474 , " neo4j" , " test" ,
7
6
" Bob" , " testRobot" , " testSession" ,
8
7
nothing ,
9
8
nothing ,
10
- blank ,
11
- blank ,
9
+ IncrementalInference . decodePackedType ,
10
+ IncrementalInference . rebuildFactorMetadata! ,
12
11
solverParams= NoSolverParams ())
12
+
13
13
# Nuke the user
14
14
clearUser!! (dfg)
15
+ @test listSessions (dfg) == []
15
16
16
17
# User, robot, and session
18
+ # TODO : Make easier ways to initialize these.
19
+ # NOTE: Wouldn't try the data parameter yet, maybe just leave blank..
17
20
user = User (:Bob , " Bob Zack" , " Description" , Dict {String, String} ())
18
21
robot = Robot (:testRobot , user. id, " Test robot" , " Description" , Dict {String, String} ())
19
22
session = Session (:testSession , robot. id, user. id, " Test Session" , " Description" , Dict {String, String} ())
@@ -30,6 +33,34 @@ v1 = addVariable!(dfg, :a, ContinuousScalar, labels = [:POSE])
30
33
v2 = addVariable! (dfg, :b , ContinuousScalar, labels = [:POSE ])
31
34
v3 = addVariable! (dfg, :c , ContinuousScalar, labels = [:LANDMARK ])
32
35
f1 = addFactor! (dfg, [:a ; :b ], LinearConditional (Normal (50.0 ,2.0 )) )
33
- f1 = addFactor! (dfg, [:a ; :b ; :c ], LinearConditional (Normal (50.0 ,2.0 )) )
36
+ f2 = addFactor! (dfg, [:b ; :c ], LinearConditional (Normal (50.0 ,2.0 )) )
37
+
38
+ sessions = listSessions (dfg)
39
+ @test map (s -> s. id, sessions) == [session. id]
40
+
41
+ # Pull and solve this graph
42
+ dfgLocal = GraphsDFG {SolverParams} (params= SolverParams ())
43
+ DistributedFactorGraphs. getSubgraph (dfg, union (ls (dfg), lsf (dfg)), true , dfgLocal)
44
+
45
+ # Confirm that with sentinels we still have the same graph (doesn't pull in the sentinels)
46
+ @test symdiff (ls (dfgLocal), ls (dfg)) == []
47
+ @test symdiff (lsf (dfgLocal), lsf (dfg)) == []
34
48
35
- listSessions (dfg)
49
+ # Solve it
50
+ tree, smtasks = solveTree! (dfgLocal)
51
+
52
+
53
+ # Make sure we can copy and solve normal orphaned sessions.
54
+ dfgOrphaned = deepcopy (dfg)
55
+ dfgOrphaned. sessionId = " doesntexist"
56
+ # Don't create a session
57
+ # Add some nodes.
58
+ v1 = addVariable! (dfgOrphaned, :a , ContinuousScalar, labels = [:POSE ])
59
+ v2 = addVariable! (dfgOrphaned, :b , ContinuousScalar, labels = [:POSE ])
60
+ v3 = addVariable! (dfgOrphaned, :c , ContinuousScalar, labels = [:LANDMARK ])
61
+ f1 = addFactor! (dfgOrphaned, [:a ; :b ], LinearConditional (Normal (50.0 ,2.0 )) )
62
+ f2 = addFactor! (dfgOrphaned, [:b ; :c ], LinearConditional (Normal (50.0 ,2.0 )) )
63
+ # Solve it
64
+ dfgLocal = GraphsDFG {SolverParams} (params= SolverParams ())
65
+ DistributedFactorGraphs. getSubgraph (dfgOrphaned, union (ls (dfgOrphaned), lsf (dfgOrphaned)), true , dfgLocal)
66
+ tree, smtasks = solveTree! (dfgLocal)
0 commit comments