Skip to content

Commit 7167be9

Browse files
dehannpvazteixeira
andcommitted
approxConv issue
Co-authored-by: Pedro Vaz Teixeira <[email protected]>
1 parent a35d802 commit 7167be9

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

examples/dev/scalar/boxy.jl

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ function driveLeg!( fg,
6666
start,
6767
v,
6868
terr,
69-
direction::Symbol)
69+
direction::Symbol;
70+
trueY::Real=0.0)
7071
# fg - factor graph object
7172
# startingPose
7273
# start -
@@ -78,7 +79,7 @@ function driveLeg!( fg,
7879
newPose = nextPose(startingPose)
7980
addVariable!(fg, newPose, Point2, tags=[:POSE,direction])
8081

81-
addFactor!(fg, [newPose;], PartialPrior(Normal(0.1, 0.1),(2,)))
82+
addFactor!(fg, [newPose;], PartialPrior(Normal(trueY, 0.1),(2,)))
8283

8384
p2p = Point2Point2(MvNormal(v, [1.0; 1.0]))
8485
addFactor!(fg, [startingPose; newPose], p2p, tags=[:ODOMETRY; direction])
@@ -96,7 +97,7 @@ function driveLeg!( fg,
9697
@assert !isapprox( Statistics.median(diff(x_seq)), 0, atol=1e-6) "why is x_seq[1:5]=$(x_seq[1:5])"
9798

9899
someDict = Dict(:x_seq => x_seq, :z_seq => z_seq, :x_seq_n => x_seq_n, :z_seq_n => z_seq_n)
99-
addData!(fg, :default_folder_store, newPose, :elevationSequences, Vector{UInt8}(JSON2.write( someDict )), mimeType="application/json/octet-stream" )
100+
addData!(fg, :default_folder_store, startingPose, :elevationSequences, Vector{UInt8}(JSON2.write( someDict )), mimeType="application/json/octet-stream" )
100101

101102
return newPose
102103
end
@@ -202,19 +203,19 @@ function driveOneBox!(fg;
202203
start_x, start_y = (start...,)
203204

204205
# drive North NS units (northbound uses west slice)
205-
lastPose = driveLeg!(fg, lastPose, start_x, [NS;0.0] ,terrW, :NORTH)
206+
lastPose = driveLeg!(fg, lastPose, start_x, [NS;0.0] ,terrW, :NORTH, trueY=0.0)
206207
start_x = start_x+NS
207208

208209
# drive East EW units (terrain does not matter here)
209-
lastPose = driveLeg!(fg, lastPose, start_y ,[0.0; EW], terrW, :EAST)
210+
lastPose = driveLeg!(fg, lastPose, start_y ,[0.0; EW], terrW, :EAST, trueY=15.0)
210211
start_y = start_y + EW
211212

212213
# drive South 0.7NS units
213-
lastPose = driveLeg!(fg, lastPose, start_x, [-runback*NS;0.0],terrE, :SOUTH)
214+
lastPose = driveLeg!(fg, lastPose, start_x, [-runback*NS;0.0],terrE, :SOUTH, trueY=15.0)
214215
start_x = start_x - runback*NS
215216

216217
# drive West EW units (terrain does not matter here)
217-
lastPose = driveLeg!(fg, lastPose, start_y, [0.0; -EW], terrE, :WEST)
218+
lastPose = driveLeg!(fg, lastPose, start_y, [0.0; -EW], terrE, :WEST, trueY=0.0)
218219
start_y = start_y - EW
219220

220221
# cop-out early on first run, or debug
@@ -276,18 +277,29 @@ driveOneBox!(fg, runback=runback, start=[(1-runback)*NS;0], NS=NS, docorr=false)
276277

277278
##
278279
# 1st match: north-bound legs on first and second loop
279-
xsq, f_ = matchLeg!(fg, [:x1, :x5],:NORTH, odoPredictedAlign=0, dofactor=false)
280-
p=Gadfly.plot(st)
281-
push!(p,layer(x=xsq[1], y=xsq[2], Geom.line))
280+
xsq, f_ = matchLeg!(fg, [:x0, :x4],:NORTH, odoPredictedAlign=0, kappa=3, dofactor=true)
281+
# xsq, f_ = matchLeg!(fg, [:x1, :x5],:NORTH, odoPredictedAlign=0, kappa=3, dofactor=true)
282+
# p=Gadfly.plot(st)
283+
# push!(p,layer(x=xsq[1], y=xsq[2], Geom.line))
282284

283285

284286
# 2nd match: south-bound legs on first and second loop
285-
xsq, f_ = matchLeg!(fg, [:x3, :x7],:SOUTH, odoPredictedAlign=-3, dofactor=false)
287+
xsq, f_ = matchLeg!(fg, [:x2, :x6],:SOUTH, odoPredictedAlign=0, kappa=3, dofactor=true)
288+
289+
290+
291+
## TEMPORARY CORRELATION DEV
292+
293+
294+
tree, _, _ = solveTree!(fg)
295+
296+
297+
##
298+
286299

287-
## ## TEMPORARY CORRELATION DEV
300+
plotKDE(fg, [:x0;:x1;:x2;:x3;:x4], levels=1)
288301

289302

290-
# addFactor!(fg, legs, plr, tags=[:TERRAIN, :MATCH])
291303

292304
##
293305

0 commit comments

Comments
 (0)