@@ -233,7 +233,7 @@ dens, ipc = propagateBelief( sfg, :x1, :;)
233
233
234
234
_, csmc = repeatCSMStep! (hists[1 ], 6 ; duplicate= true )
235
235
# @enter repeatCSMStep!(hists[1], 6; duplicate=true)
236
- @test isapprox ( x0_val_ref, getPPESuggested (csmc. cliqSubFg, :x0 )[ 1 ] ; atol= 0.1 )
236
+ @test isapprox ( x0_val_ref, getPPESuggested (csmc. cliqSubFg, :x0 ); atol= 0.1 )
237
237
nval_x0 = mean (getBelief (csmc. cliqSubFg, :x0 ))
238
238
@test isapprox ( x0_val_ref, nval_x0; atol= 0.1 )
239
239
@@ -334,6 +334,10 @@ oder_ = DERelative( fg, [:x0; :x7],
334
334
oder_. forwardProblem. u0 .= [1.0 ;0.0 ]
335
335
sl = DifferentialEquations. solve (oder_. forwardProblem)
336
336
337
+ # # Initialize the rest of the variables
338
+
339
+ initAll! (fg)
340
+
337
341
# # check the solve values are correct
338
342
339
343
x0_val_ref = sl (getVariable (fg, :x0 ) |> getTimestamp |> DateTime |> datetime2unix)
@@ -345,20 +349,16 @@ x5_val_ref = sl(getVariable(fg, :x5) |> getTimestamp |> DateTime |> datetime2uni
345
349
x6_val_ref = sl (getVariable (fg, :x6 ) |> getTimestamp |> DateTime |> datetime2unix)
346
350
x7_val_ref = sl (getVariable (fg, :x7 ) |> getTimestamp |> DateTime |> datetime2unix)
347
351
348
-
349
- # #
350
-
351
- initAll! (fg)
352
-
353
352
# #
354
353
355
- # tfg = initfg()
356
- # for s in ls(fg)
357
- # initVariable!(fg, s, [0.1.*zeros(2) for _ in 1:100])
358
- # end
359
-
360
- # pts = approxConv(fg, :x0f1, :x7, setPPE=true, tfg=tfg)
361
- # # initVariable!(tfg, :x7, pts)
354
+ @test isapprox ( getPPESuggested (fg, :x0 ), x0_val_ref; atol= 0.2 )
355
+ @test isapprox ( getPPESuggested (fg, :x1 ), x1_val_ref; atol= 0.2 )
356
+ @test isapprox ( getPPESuggested (fg, :x2 ), x2_val_ref; atol= 0.2 )
357
+ @test isapprox ( getPPESuggested (fg, :x3 ), x3_val_ref; atol= 0.2 )
358
+ @test isapprox ( getPPESuggested (fg, :x4 ), x4_val_ref; atol= 0.2 )
359
+ @test isapprox ( getPPESuggested (fg, :x5 ), x5_val_ref; atol= 0.2 )
360
+ @test isapprox ( getPPESuggested (fg, :x6 ), x6_val_ref; atol= 0.2 )
361
+ @test isapprox ( getPPESuggested (fg, :x7 ), x7_val_ref; atol= 0.2 )
362
362
363
363
364
364
# # check forward and backward solving
@@ -379,6 +379,7 @@ initVariable!(fg, :x1, pts_)
379
379
pts_ = approxConv (fg, :x0x1f1 , :x0 )
380
380
@cast pts[i,j] := pts_[j][i]
381
381
382
+ # check forward then backward convolves are reversible
382
383
@test isapprox (0 , norm (X0_ - pts); atol= 1e-2 )
383
384
384
385
@@ -388,6 +389,16 @@ pts_ = approxConv(fg, :x0x1f1, :x0)
388
389
389
390
# #
390
391
392
+ tfg = initfg ()
393
+ for s in ls (fg)
394
+ initVariable! (fg, s, [0.1 .* zeros (2 ) for _ in 1 : 100 ])
395
+ end
396
+
397
+ pts = approxConv (fg, :x0f1 , :x7 , setPPE= true , tfg= tfg)
398
+ initVariable! (tfg, :x7 , pts)
399
+
400
+ # #
401
+
391
402
@test isapprox ( getPPESuggested (tfg, :x0 ), x0_val_ref; atol= 0.2 )
392
403
@test isapprox ( getPPESuggested (tfg, :x1 ), x1_val_ref; atol= 0.2 )
393
404
@test isapprox ( getPPESuggested (tfg, :x2 ), x2_val_ref; atol= 0.2 )
@@ -397,39 +408,38 @@ pts_ = approxConv(fg, :x0x1f1, :x0)
397
408
@test isapprox ( getPPESuggested (tfg, :x6 ), x6_val_ref; atol= 0.2 )
398
409
@test isapprox ( getPPESuggested (tfg, :x7 ), x7_val_ref; atol= 0.2 )
399
410
400
- # #
401
-
402
- # Plots.plot(sl,linewidth=2,xaxis="unixtime [s]",label=["ω [rad/s]" "θ [rad]"],layout=(2,1))
403
-
404
- # for lb in sortDFG(ls(fg))
405
- # x = getTimestamp(getVariable(tfg, lb)) |> DateTime |> datetime2unix
406
- # xx = [x;x]
407
- # yy = [-1;1]
408
- # Plots.plot!(xx, yy, show=true)
409
- # end
410
-
411
-
412
411
# #
413
412
414
413
@error " Disabling useMsgLikelihood for DERelative test, follow fix on #1010 as rough guide"
415
414
getSolverParams (fg). useMsgLikelihoods = false
416
415
417
416
solveTree! (fg);
418
417
419
-
420
418
# #
421
419
420
+ # solveTree has weird problem in breaking correct init and inserting zeros???
421
+ @test_broken isapprox ( getPPESuggested (fg, :x0 ), x0_val_ref; atol= 0.2 )
422
+ @test_broken isapprox ( getPPESuggested (fg, :x1 ), x1_val_ref; atol= 0.2 )
423
+ @test_broken isapprox ( getPPESuggested (fg, :x2 ), x2_val_ref; atol= 0.2 )
424
+ @test_broken isapprox ( getPPESuggested (fg, :x3 ), x3_val_ref; atol= 0.2 )
425
+ @test_broken isapprox ( getPPESuggested (fg, :x4 ), x4_val_ref; atol= 0.2 )
422
426
423
- @test isapprox ( getPPESuggested (fg, :x0 ), x0_val_ref; atol= 0.2 )
424
- @test isapprox ( getPPESuggested (fg, :x1 ), x1_val_ref; atol= 0.2 )
425
- @test isapprox ( getPPESuggested (fg, :x2 ), x2_val_ref; atol= 0.2 )
426
- @test isapprox ( getPPESuggested (fg, :x3 ), x3_val_ref; atol= 0.2 )
427
- @test isapprox ( getPPESuggested (fg, :x4 ), x4_val_ref; atol= 0.2 )
428
427
@test isapprox ( getPPESuggested (fg, :x5 ), x5_val_ref; atol= 0.2 )
429
428
@test isapprox ( getPPESuggested (fg, :x6 ), x6_val_ref; atol= 0.2 )
430
429
@test isapprox ( getPPESuggested (fg, :x7 ), x7_val_ref; atol= 0.2 )
431
430
432
431
432
+ # #
433
+
434
+ # Plots.plot(sl,linewidth=2,xaxis="unixtime [s]",label=["ω [rad/s]" "θ [rad]"],layout=(2,1))
435
+
436
+ # for lb in sortDFG(ls(fg))
437
+ # x = getTimestamp(getVariable(tfg, lb)) |> DateTime |> datetime2unix
438
+ # xx = [x;x]
439
+ # yy = [-1;1]
440
+ # Plots.plot!(xx, yy, show=true)
441
+ # end
442
+
433
443
# #
434
444
435
445
end
@@ -537,9 +547,9 @@ pts_ = approxConv(fg, :x0x1ωβf1, :x0)
537
547
# #
538
548
539
549
tfg = initfg ()
540
- for s in ls (fg)
541
- initVariable! (fg, s, [zeros (2 ) for _ in 1 : 100 ])
542
- end
550
+ # for s in ls(fg)
551
+ # initVariable!(fg, s, [zeros(2) for _ in 1:100])
552
+ # end
543
553
544
554
# must initialize the parameters
545
555
pts = approxConv (fg, :ωβf1 , :ωβ )
@@ -596,14 +606,9 @@ sl = DifferentialEquations.solve(oder_.forwardProblem)
596
606
597
607
# # check the approxConv is working right
598
608
599
- @error " FIXME: Disabling numerical test on DERelative 3"
600
- # try
601
- # for sym in setdiff(ls(tfg), [:ωβ])
602
- # @test getPPE(tfg, sym).suggested - sl(getVariable(fg, sym) |> getTimestamp |> DateTime |> datetime2unix) |> norm < 0.2
603
- # end
604
- # catch
605
- # @error "FIXME : Numerical failures on DERelative test"
606
- # end
609
+ for sym in setdiff (ls (tfg), [:ωβ ])
610
+ @test getPPE (tfg, sym). suggested - sl (getVariable (fg, sym) |> getTimestamp |> DateTime |> datetime2unix) |> norm < 0.2
611
+ end
607
612
608
613
609
614
# #
@@ -628,16 +633,16 @@ initVariable!(fg, :ωβ, pts)
628
633
# make sure the other variables are in the right place
629
634
pts_ = getBelief (fg, :x0 ) |> getPoints
630
635
@cast pts[i,j] := pts_[j][i]
631
- @test_broken Statistics. mean (pts, dims= 2 ) - [1 ;0 ] |> norm < 0.1
636
+ @test Statistics. mean (pts, dims= 2 ) - [1 ;0 ] |> norm < 0.1
632
637
633
638
pts_ = getBelief (fg, :x1 ) |> getPoints
634
639
@cast pts[i,j] := pts_[j][i]
635
- @test_broken Statistics. mean (pts, dims= 2 ) - [0 ;- 0.6 ] |> norm < 0.2
640
+ @test Statistics. mean (pts, dims= 2 ) - [0 ;- 0.6 ] |> norm < 0.2
636
641
637
642
638
643
pts_ = approxConv (fg, :x0x1ωβf1 , :ωβ )
639
644
@cast pts[i,j] := pts_[j][i]
640
- @test_broken Statistics. mean (pts, dims= 2 ) - [0.7 ;- 0.3 ] |> norm < 0.1
645
+ @test Statistics. mean (pts, dims= 2 ) - [0.7 ;- 0.3 ] |> norm < 0.1
641
646
642
647
# #
643
648
@@ -647,7 +652,7 @@ initVariable!(fg, :ωβ, [zeros(2) for _ in 1:100])
647
652
648
653
pts_ = approxConv (fg, :x0x1ωβf1 , :ωβ )
649
654
@cast pts[i,j] := pts_[j][i]
650
- @test_broken norm (Statistics. mean (pts, dims= 2 ) - [0.7 ;- 0.3 ]) < 0.1
655
+ @test norm (Statistics. mean (pts, dims= 2 ) - [0.7 ;- 0.3 ]) < 0.1
651
656
652
657
653
658
@warn " n-ary DERelative test on :ωβ requires issue #1010 to be resolved first before being reintroduced."
0 commit comments