Skip to content

Commit 6edbdb4

Browse files
committed
partial working
1 parent 7167be9 commit 6edbdb4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

examples/dev/scalar/boxy.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function matchLeg!( fg::AbstractDFG,
172172
# intensity = _mySSDCorr(zseq_a, zseq_b)
173173

174174
bel = AliasingScalarSampler(qr, pv)
175-
plr = PartialLinearRelative(bel, (1,))
175+
plr = Point2Point2Northing(bel, (1,))
176176

177177
f_ = if dofactor
178178
addFactor!(fg, legs, plr, tags=[:TERRAIN,:MATCH,direction])
@@ -228,23 +228,23 @@ end
228228
##
229229

230230
"""
231-
PartialLinearRelative
231+
Point2Point2Northing
232232
233233
IIF will deal with partials,
234234
235235
DevNotes
236236
- FIXME ongoing (2021Q2), see #1206, likely also #1010
237237
"""
238-
struct PartialLinearRelative{B <: IIF.SamplableBelief, T <: Tuple} <: IIF.AbstractRelativeMinimize
238+
struct Point2Point2Northing{B <: IIF.SamplableBelief, T <: Tuple} <: IIF.AbstractRelativeMinimize
239239
Z::B
240240
partial::T # which dimension the partial applies to
241241
end
242242

243-
function IIF.getSample(s::CalcFactor{<:PartialLinearRelative}, N::Int=1)
243+
function IIF.getSample(s::CalcFactor{<:Point2Point2Northing}, N::Int=1)
244244
return ( reshape(rand(s.factor.Z,N),1,N), )
245245
end
246246

247-
(s::CalcFactor{<:PartialLinearRelative})(z, x1, x2) = z .- (x2 .- x1)
247+
(s::CalcFactor{<:Point2Point2Northing})(z, x1, x2) = z .- (x2[1] - x1[1])
248248

249249

250250
# trajectory parameters
@@ -287,6 +287,12 @@ xsq, f_ = matchLeg!(fg, [:x0, :x4],:NORTH, odoPredictedAlign=0, kappa=3, dofacto
287287
xsq, f_ = matchLeg!(fg, [:x2, :x6],:SOUTH, odoPredictedAlign=0, kappa=3, dofactor=true)
288288

289289

290+
##
291+
292+
pts = approxConv(fg, :x0x4f1, :x4)
293+
294+
# should peak at +5 to make the relative factor represent the change between x0 dn x4
295+
Gadfly.plot(x=pts[1,:], Geom.histogram)
290296

291297
## TEMPORARY CORRELATION DEV
292298

@@ -308,13 +314,13 @@ plotKDE(fg, [:x0;:x1;:x2;:x3;:x4], levels=1)
308314
# curr_seq = terrE(curr_x_seq)
309315
# prev_seq = terrE(prev_x_seq)
310316
# # compute SSDcorr wrt sequence 4 poses before
311-
# # add PartialLinearRelative between the two
317+
# # add Point2Point2Northing between the two
312318
# intensity = _mySSDCorr(curr_seq, prev_seq)
313319

314320
plr = ScalarFieldSequenceFactorNorthSouth(x_seq_, z_seq, (1,))
315321
addFactor!(fg, [:x0; :x4], plr, tags=[:TERRAIN,:MATCH])
316322
# plr = ScalarFieldSequenceFactorNorthSouth(x_seq, z_seq, (1,))
317-
# # # plr = PartialLinearRelative(grid, AliasingScalarSampler(intensity))
323+
# # # plr = Point2Point2Northing(grid, AliasingScalarSampler(intensity))
318324
# addFactor!(fg, [prevPose newPose], plr, tags=[:TERRAIN,:MATCH])
319325

320326

@@ -334,7 +340,7 @@ addFactor!(fg, [:x0; :x4], plr, tags=[:TERRAIN,:MATCH])
334340
bel = Normal(10,1.0)
335341
bel = AliasingScalarSampler(..., ...)
336342

337-
plr = PartialLinearRelative(bel, (1,))
343+
plr = Point2Point2Northing(bel, (1,))
338344

339345

340346

0 commit comments

Comments
 (0)