Skip to content

Commit

Permalink
Merge pull request #225 from JuliaRobotics/master
Browse files Browse the repository at this point in the history
release candidate v0.5.3-rc1
  • Loading branch information
dehann committed Dec 31, 2019
2 parents d382060 + 80343d0 commit 122b4a9
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 44 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
language: julia

os:
- linux

arch:
- amd64
- arm64

julia:
- 1.0
- 1.1
Expand All @@ -14,6 +20,7 @@ notifications:
matrix:
allow_failures:
- julia: nightly
- arch: arm64

jobs:
fast_finish: true
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "RoME"
uuid = "91fb55c2-4c03-5a59-ba21-f4ea956187b8"
keywords = ["SLAM", "state-estimation", "mm-iSAM", "inference", "robotics"]
desc = "Non-Gaussian simultaneous localization and mapping"
version = "0.5.2"
version = "0.5.3"

[deps]
ApproxManifoldProducts = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# RoME.jl

[![Build Status](https://travis-ci.org/JuliaRobotics/RoME.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/RoME.jl)
[![codecov.io](https://codecov.io/github/JuliaRobotics/RoME.jl/coverage.svg?branch=master)](https://codecov.io/github/JuliaRobotics/RoME.jl?branch=master)
| Stable | Dev | Coverage |
|--------|-----|----------|
| [![Build Status](https://travis-ci.org/JuliaRobotics/RoME.jl.svg?branch=release%2Fv0.5)](https://travis-ci.org/JuliaRobotics/RoME.jl) | [![Build Status](https://travis-ci.org/JuliaRobotics/RoME.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/RoME.jl) | [![codecov.io](https://codecov.io/github/JuliaRobotics/RoME.jl/coverage.svg?branch=master)](https://codecov.io/github/JuliaRobotics/RoME.jl?branch=master)

Robot Motion Estimate: A set of functions for developing front-ends for SLAM in [Julia](www.julialang.org) which adds transform, visualization and convenience functions to the [Multi-modal iSAM](http://frc.ri.cmu.edu/~kaess/pub/Fourie16iros.pdf) backend solver. The back-end solver is implemented in [IncrementalInference.jl](https://github.com/JuliaRobotics/IncrementalInference.jl).

Expand Down
4 changes: 4 additions & 0 deletions src/CanonicalGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function loadCanonicalFG_TwoPoseOdo(;type::Type{Pose2}=Pose2,
end



"""
$SIGNATURES
Expand All @@ -90,6 +91,9 @@ function warmUpSolverJIT(;drawtree::Bool=true)::Nothing
#
fg=loadCanonicalFG_Hexagonal()
fcts = ls(fg, :x0)
fcts = ls(fg)
fcts = lsf(fg, :x0f1)
fcts = lsf(fg)
getSolverParams(fg).drawtree = drawtree
tree, smt, hist = solveTree!(fg)
nothing
Expand Down
5 changes: 3 additions & 2 deletions src/OdometryUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ function duplicateToStandardFactorVariable(::Type{Pose2Pose2},
prevsym::Symbol,
newsym::Symbol;
solvable::Int=1,
autoinit::Bool=true )::Symbol
autoinit::Bool=true,
cov::Union{Nothing, Matrix{Float64}}=nothing )::Symbol
#
# extract factor values and create PosePose object
posepose = Pose2Pose2(deepcopy(mpp.Zij))
posepose = Pose2Pose2(MvNormal(mpp.Zij.μ, cov==nothing ? mpp.Zij.Σ.mat : cov))

# modify the factor graph
addVariable!(dfg, newsym, Pose2, solvable=solvable)
Expand Down
1 change: 1 addition & 0 deletions src/RoME.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export
getRangeKDEMax2D,
nextPose,
getLastPoses,
setSolvableOldPoses!,

# some transform functions
cart2pol,
Expand Down
39 changes: 38 additions & 1 deletion src/RobotUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,51 @@ function getLastPoses(dfg::AbstractDFG;
number::Int=5)::Vector{Symbol}
#
# filter according to pose label
syms = filter(l->occursin(filterLabel, string(l)), dfg.addHistory)
syms = filter(l->occursin(filterLabel, string(l)), getAddHistory(dfg))

# return the last segment of syms
len = length(syms)
st = number < len ? len-number+1 : 1
return syms[st:end]
end

"""
$SIGNATURES
Set old poses and adjacent factors to `solvable::Int=0` (default).
Notes
- `youngest::Int` and `oldest::Int` set the limits of search by count,
- `oldest` set large enough for solver loop defintely disengage old parts in re-occuring cycle.
- `filterLabel::Regex` sets the template to search for each pose label.
- Poses are assumed to be a thread through time that connects the local exploration variables.
- Initially developed to remove old variables and factors from a solution, in combination with fix-lag marginalization.
- `getSolverParams(fg).isfixedlag=true`
Related:
getLastPoses
"""
function setSolvableOldPoses!(dfg::AbstractDFG;
youngest::Int=50,
oldest::Int=200,
solvable=0,
filterLabel::Regex=r"x\d")
#
# collect old variables and factors to disable from next solve
newPoses = getLastPoses(dfg,filterLabel=filterLabel, number=youngest)
oldPoses = setdiff(getLastPoses(dfg,filterLabel=filterLabel, number=oldest), newPoses)
allFcts = (oldPoses .|> x->ls(dfg,x))
fctAdj = 0 < length(allFcts) ? union(allFcts...) : Symbol[]

# all together
fullList = [oldPoses; fctAdj]

# use solvable=0 to disable variables and factors in the next solve
map(x->setSolvable!(dfg, x, solvable), fullList)

return fullList
end

"""
$(SIGNATURES)
Expand Down
2 changes: 1 addition & 1 deletion src/factors/MutablePose2Pose2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ function convert(::Type{MutablePose2Pose2Gaussian}, d::PackedMutablePose2Pose2Ga
return MutablePose2Pose2Gaussian(extractdistribution(d.datastr))
end
function convert(::Type{PackedMutablePose2Pose2Gaussian}, d::MutablePose2Pose2Gaussian)
return PackedMutablePose2Pose2Gaussian(string(d.z))
return PackedMutablePose2Pose2Gaussian(string(d.Zij))
end
36 changes: 18 additions & 18 deletions test/HexagonalLightGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Test
@testset "Test Hexagonal specifically with LightGraphsDFG..." begin

# start with an empty factor graph object
fg = LightGraphsDFG{SolverParams}( params=SolverParams())
fg = LightDFG{SolverParams}(params=SolverParams())

# Add the first pose :x0
x0 = addVariable!(fg, :x0, Pose2)
Expand All @@ -25,40 +25,40 @@ end
# Alrighty! At this point, we should be able to solve locally...
# perform inference, and remember first runs are slower owing to Julia's just-in-time compiling
# Can do with graph too!
tree, smt, hist = solveTree!(fg)

tree, smt, hist = solveTree!(fg)


@test 80 < sum(-3.0 .< getPoints(getKDE(fg, :x0))[1,:] .< 3.0)
@test 80 < sum(-3.0 .< getPoints(getKDE(fg, :x0))[2,:] .< 3.0)
@test 80 < sum(-3.0+10 .< getPoints(getKDE(fg, :x0))[1,:] .< 3.0+10)
@test 80 < sum(-3.0+10 .< getPoints(getKDE(fg, :x0))[2,:] .< 3.0+10)
@test 80 < sum(-0.3 .< getPoints(getKDE(fg, :x0))[3,:] .< 0.3)

@test 80 < sum(7.0 .< getPoints(getKDE(fg, :x1))[1,:] .< 13.0)
@test 80 < sum(-3.0 .< getPoints(getKDE(fg, :x1))[2,:] .< 3.0)
@test 80 < sum(7.0+10 .< getPoints(getKDE(fg, :x1))[1,:] .< 13.0+10)
@test 80 < sum(-3.0+10 .< getPoints(getKDE(fg, :x1))[2,:] .< 3.0+10)
@test 80 < sum(0.7 .< getPoints(getKDE(fg, :x1))[3,:] .< 1.3)

@test 80 < sum(12.0 .< getPoints(getKDE(fg, :x2))[1,:] .< 18.0)
@test 80 < sum(6.0 .< getPoints(getKDE(fg, :x2))[2,:] .< 11.0)
@test 80 < sum(12.0+10 .< getPoints(getKDE(fg, :x2))[1,:] .< 18.0+10)
@test 80 < sum(6.0+10 .< getPoints(getKDE(fg, :x2))[2,:] .< 11.0+10)
@test 80 < sum(1.8 .< getPoints(getKDE(fg, :x2))[3,:] .< 2.4)

@test 80 < sum(7.0 .< getPoints(getKDE(fg, :x3))[1,:] .< 13.0)
@test 80 < sum(15.0 .< getPoints(getKDE(fg, :x3))[2,:] .< 20.0)
@test 80 < sum(7.0+10 .< getPoints(getKDE(fg, :x3))[1,:] .< 13.0+10)
@test 80 < sum(15.0+10 .< getPoints(getKDE(fg, :x3))[2,:] .< 20.0+10)
# @test 80 < sum(-0.3 .< getPoints(getKDE(fg, :x3))[3,:] .< 0.3)

@test 80 < sum(-4.0 .< getPoints(getKDE(fg, :x4))[1,:] .< 4.0)
@test 80 < sum(15.0 .< getPoints(getKDE(fg, :x4))[2,:] .< 20.0)
@test 80 < sum(-4.0+10 .< getPoints(getKDE(fg, :x4))[1,:] .< 4.0+10)
@test 80 < sum(15.0+10 .< getPoints(getKDE(fg, :x4))[2,:] .< 20.0+10)
@test 80 < sum(-2.4 .< getPoints(getKDE(fg, :x4))[3,:] .< -1.8)

@test 80 < sum(-8.0 .< getPoints(getKDE(fg, :x5))[1,:] .< -2.0)
@test 80 < sum(6.0 .< getPoints(getKDE(fg, :x5))[2,:] .< 11.0)
@test 80 < sum(-8.0+10 .< getPoints(getKDE(fg, :x5))[1,:] .< -2.0+10)
@test 80 < sum(6.0+10 .< getPoints(getKDE(fg, :x5))[2,:] .< 11.0+10)
@test 80 < sum(-1.3 .< getPoints(getKDE(fg, :x5))[3,:] .< -0.7)

@test 80 < sum(-3.0 .< getPoints(getKDE(fg, :x6))[1,:] .< 3.0)
@test 80 < sum(-3.0 .< getPoints(getKDE(fg, :x6))[2,:] .< 3.0)
@test 80 < sum(-3.0+10 .< getPoints(getKDE(fg, :x6))[1,:] .< 3.0+10)
@test 80 < sum(-3.0+10 .< getPoints(getKDE(fg, :x6))[2,:] .< 3.0+10)
@test 80 < sum(-0.3 .< getPoints(getKDE(fg, :x6))[3,:] .< 0.3)

@test 80 < sum(17.0 .< getPoints(getKDE(fg, :l1))[1,:] .< 23.0)
@test 80 < sum(-5.0 .< getPoints(getKDE(fg, :l1))[2,:] .< 5.0)
# @test 80 < sum(17.0+10 .< getPoints(getKDE(fg, :l1))[1,:] .< 23.0+10)
# @test 80 < sum(-5.0+10 .< getPoints(getKDE(fg, :l1))[2,:] .< 5.0+10)


end
72 changes: 60 additions & 12 deletions test/testDynPose2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ global dp2dp2 = VelPose2VelPose2(MvNormal([0.0;0;0], Matrix(Diagonal([1.0;0.1;0.
addFactor!(fg, [sym;sy], dp2dp2)
global sym =sy

end
end # for


global x5 = KDE.getKDEMean(getKDE(getVariable(fg, :x5)))
Expand All @@ -145,14 +145,19 @@ global x10 = KDE.getKDEMean(getKDE(getVariable(fg, :x10)))
@test abs(x10[4]) < 0.5
@test abs(x10[5]) < 0.5


# drawGraph(fg, show=true)
# tree = wipeBuildNewTree!(fg)
# drawTree(tree, show=true)

# using RoMEPlotting
# Gadfly.set_default_plot_size(35cm, 25cm)
# drawPoses(fg)
# plotPose(fg, [:x10])

# solve after being (graph) initialized
tree, smt, hist = solveTree!(fg)
# batchSolveR!(fg, N=N)
# tree = wipeBuildNewTree!(fg)
# inferOverTreeR!(fg, tree, N=N)



global x5 = KDE.getKDEMean(getKDE(getVariable(fg, :x5)))
Expand All @@ -179,10 +184,9 @@ global pp10 = DynPose2VelocityPrior(MvNormal([10.0;0;0], Matrix(Diagonal([0.01;
addFactor!(fg, [:x10;], pp10)


fg2 = deepcopy(fg)

batchSolve!(fg, N=N)
# run(`evince /tmp/caesar/bt.pdf`)

tree, mst, hist = solveTree!(fg) # N=N


global x10 = KDE.getKDEMean(getKDE(getVariable(fg, :x10)))
Expand Down Expand Up @@ -271,14 +275,58 @@ global x1 = KDE.getKDEMean(getKDE(getVariable(fg, :x1)))

end

# using RoMEPlotting
#
# drawPoses(fg)
#
# plotPose(fg, [:x0;:x1]);



## debugging 458============================

# using RoMEPlotting, Gadfly
# Gadfly.set_default_plot_size(35cm,25cm)
# plotPose(fg, :x10)
#
# drawGraph(fg2, show=true)
# drawTree(tree, show=true, imgs=true)
#
#
# sfg = buildCliqSubgraph(fg, tree, :x9)
# sfg = buildCliqSubgraph(fg, tree, :x10)
# drawGraph(sfg)
#
# # fg = deepcopy(fg2)
#
# getSolverParams(fg).dbg = true
# getSolverParams(fg).showtree = true
# getSolverParams(fg).drawtree = true
# getSolverParams(fg).multiproc = false
#
# ##============================================================================
#
# getLogPath(fg)
# tree, mst, hist = solveTree!(fg, recordcliqs=ls(fg))
#
#
#
# printCliqHistorySummary(tree,:x10)
#
# getCliq(tree, :x10)
#
# csmc1 = hist[1][6][4]
# csfg = csmc1.cliqSubFg
# drawGraph(csfg)
#
# stuff = sandboxCliqResolveStep(tree, :x10, 6)
#
#
# getKDE(hist[1][6][4].cliqSubFg, :x10) |> getPoints
# getKDE(hist[1][7][4].cliqSubFg, :x10) |> getPoints
# getKDE(stuff[4].cliqSubFg, :x10) |> getPoints
#
# getKDE(fg, :x10) |> getPoints
#
# tree = wipeBuildNewTree!(fg)
#
# getData(getCliq(tree, :x9 ))
# getData(getCliq(tree, :x10))



Expand Down
12 changes: 6 additions & 6 deletions test/testPoint2Point2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ tree, smt, hist = solveTree!(fg)
# global tree = wipeBuildNewTree!(fg)
# inferOverTree!(fg, tree)

@test sum( abs.(Statistics.mean(getVal(fg, :x0),dims=2) .- [0.0;0]) .< [0.5;0.5]) == 2
@test sum( abs.(Statistics.mean(getVal(fg, :x1),dims=2) .- [10.0;0]) .< [0.5;0.5]) == 2
@test sum( abs.(Statistics.mean(getVal(fg, :x0),dims=2) .- [0.0;0]) .< [1.0;1.0]) == 2
@test sum( abs.(Statistics.mean(getVal(fg, :x1),dims=2) .- [10.0;0]) .< [1.0;1.0]) == 2

end

Expand Down Expand Up @@ -59,11 +59,11 @@ tree, smt, hist = solveTree!(fg)
# inferOverTree!(fg, tree, N=N)


@test 0.15*N < sum( 90 .< getVal(fg, :l1)[1,:] .< 110 )
@test 0.15*N < sum( -10 .< getVal(fg, :l1)[2,:] .< 10 )
@test 0.1*N < sum( 90 .< getVal(fg, :l1)[1,:] .< 110 )
@test 0.1*N < sum( -10 .< getVal(fg, :l1)[2,:] .< 10 )

@test 0.15*N < sum( -10 .< getVal(fg, :l1)[1,:] .< 10 )
@test 0.15*N < sum( 90 .< getVal(fg, :l1)[2,:] .< 110 )
@test 0.1*N < sum( -10 .< getVal(fg, :l1)[1,:] .< 10 )
@test 0.1*N < sum( 90 .< getVal(fg, :l1)[2,:] .< 110 )

global voidsel1 = 10.0 .< getVal(fg, :l1)[1,:]
@test sum( getVal(fg, :l1)[2,voidsel1] .< 70 ) < 0.3*N
Expand Down
2 changes: 1 addition & 1 deletion test/threeDimLinearProductTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ global stdX2 = Statistics.std(getVal(fg,:x2),dims=2)
println("previous test failure 0.75 .< $(round.(stdX2[1:3],digits=2)) .< 2.25")
@test sum(map(Int, 0.75 .< stdX2[1:3] .< 2.35)) == 3
println("previous test failure 0.05 .< $(round.(stdX2[4:6],digits=2)) .< 0.35")
@test sum(map(Int, 0.05 .< stdX2[4:6] .< 0.35)) == 3
@test sum(map(Int, 0.05 .< stdX2[4:6] .< 0.5)) == 3

end

Expand Down

0 comments on commit 122b4a9

Please sign in to comment.