Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport: Fix and test Pose2Point2 #390

Merged
merged 2 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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", "MM-iSAMv2", "inference", "robotics"]
desc = "Non-Gaussian simultaneous localization and mapping"
version = "0.12.0"
version = "0.12.1"

[deps]
ApproxManifoldProducts = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
Expand Down
2 changes: 1 addition & 1 deletion src/factors/Pose2Point2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function (cfo::CalcFactor{<:Pose2Point2})(res::AbstractVector{<:Real},
wLj )
#

wLj_pred = SE2(wXi)*SE2([meas[1];0.0])
wLj_pred = SE2(wXi)*SE2([meas;0.0])
res[1:2] .= wLj .- se2vee(wLj_pred)[1:2]

res .^= 2
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ testfiles = [
"testpackingconverters.jl";
"TestDefaultFGInitialization.jl";
"testAccumulateFactors.jl";
"testDeadReckoningTether.jl"; ]
"testDeadReckoningTether.jl";
"testPoint2Point2.jl"]

## Tests not ready yet
# "HexagonalLightGraphs.jl"
Expand Down
25 changes: 25 additions & 0 deletions test/testPose2Point2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using RoME
using Test
using Statistics

## MWE Pose2Point2 from #388
@testset "basic Pose2Point2 test" begin

fg = initfg()

addVariable!(fg, :x1, Pose2)
addVariable!(fg, :l1, Point2)

addFactor!(fg, [:x1], PriorPose2(MvNormal([0.,0, 0], [0.01, 0.01, 0.01])))

addFactor!(fg, [:x1; :l1], Pose2Point2(MvNormal([0.0,-1], [0.1,0.1])))

ensureAllInitialized!(fg)

tree, smt, hist = solveTree!(fg)

@test isapprox(mean(getVal(fg, :x1),dims=2), [0,0,0], atol = 0.05)
@test isapprox(mean(getVal(fg, :l1),dims=2), [0,-1], atol = 0.05)
end