Skip to content

Difficulty with 4 doors example, expecting roughly equal modes #1765

Open
@itsDionix

Description

@itsDionix

I am struggling to reproduce the results of the 4 doors example from "Multi-modal and Inertial Sensor Solutions for Navigation-type Factor Graphs", Fourie 2017. This might be related to #1570.

Included is an adapted Minimal Working Example (MWE) and two example figures of the output of the MWE with N=5000 and N=1000. The example is simplified to only 3 doors.

Specifically, I am trying to reproduce the two roughly equal modes in Figure 6-16 from Fourie's 2017 thesis, cited above. The belief for x3 I am getting from the automatic initialization in the MWE (orange dotted line in the attached figures) presents two modes that are similar, which is good. However, the issue is that proceeding to solve the graph makes the result worse, most of the time. The solved belief (solid orange line in the attached figures) places almost all probability on the left mode, when both should be equal.

At the moment, is there a way to get better performance (where both modes are roughly equal) when solving the full graph?

I am seeking to report the results in my Master's thesis, so I want to make sure that I am getting representative results.

Thank you for the time and any help you can give.

I used Julia 1.9 and IncrementalInference 0.34.0.
Next follow example results and the MWE code.

Example output with N=5000:
MWE_5000N

Example output with N=1000:
MWE_1000N

MWE:

using IncrementalInference
using Plots
cv = 3.0
components = [Normal(-100, cv); Normal(0, cv); Normal(100, cv)]
doorPrior = Mixture(Prior,
    components,
    [1 / 3; 1 / 3; 1 / 3])

## Build the factor graph object
fg = initfg()
fg.solverParams.N = 5000   # 500 is enough to see the phenomenon, used more just in case
# fg.solverParams.gibbsIters = 30 # Increasing from the default doesn't seem to help

gr(dpi=300)
plt = Plots.plot()
xlabel!("\$x\$")
ylabel!("Likelihood")
box = (-130, 230)
x = range(box[1], box[2], 2001)
xlims!(box[1], box[2])

# first pose location
v1 = addVariable!(fg, :x1, ContinuousScalar)
# see a door for the first time
addFactor!(fg, [:x1], doorPrior)
## drive to second pose location
addVariable!(fg, :x2, ContinuousScalar)
addFactor!(fg, [:x1; :x2], LinearRelative(Normal(50.0, 2.0)))
# drive to third pose location
v3 = addVariable!(fg, :x3, ContinuousScalar)
addFactor!(fg, [:x2; :x3], LinearRelative(Normal(50.0, 4.0)))
# see a door for the second time
addFactor!(fg, [:x3], doorPrior)

initAll!(fg)

bel = getBelief(fg, :x1).belief
plot!(x, (x) -> bel([x])[1], label="x1 init", ylims=(0, Inf), linestyle=:dot, c=1)
bel = getBelief(fg, :x3).belief
plot!(x, (x) -> bel([x])[1], label="x3 init", ylims=(0, Inf), linestyle=:dot, c=2)
display(plt)

solveTree!(fg)

bel = getBelief(fg, :x1).belief
plot!(x, (x) -> bel([x])[1], label="x1 solved", ylims=(0, Inf), c=1)
bel = getBelief(fg, :x3).belief
plot!(x, (x) -> bel([x])[1], label="x3 solved", ylims=(0, Inf), c=2)
savefig("MWE.png")
display(plt)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions