Skip to content

Commit

Permalink
Merge pull request #236 from JuliaRobotics/23Q3/en/gadflyext
Browse files Browse the repository at this point in the history
ApproxManiProdGadflyExt refactor
  • Loading branch information
dehann committed Aug 14, 2023
2 parents 60919b3 + 4eada02 commit 46dcc4e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
9 changes: 8 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "ApproxManifoldProducts"
uuid = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
keywords = ["MM-iSAMv2", "SLAM", "inference", "sum-product", "belief-propagation", "nonparametric", "manifolds", "functional"]
version = "0.7.0"
version = "0.7.1"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down Expand Up @@ -34,6 +35,12 @@ TransformUtils = "9b8138ad-1b09-5408-aa39-e87ed6d21b63"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[weakdeps]
Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004"

[extensions]
ApproxManiProdGadflyExt = "Gadfly"

[compat]
CoordinateTransformations = "0.5, 0.6"
DocStringExtensions = "0.7, 0.8, 0.9"
Expand Down
13 changes: 13 additions & 0 deletions ext/ApproxManiProdGadflyExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module ApproxManiProdGadflyExt

using Gadfly
using Colors
using Manifolds
using ApproxManifoldProducts: BallTreeDensity, ManifoldKernelDensity

import ApproxManifoldProducts: plotCircBeliefs, plotKDECircular, plotMKD


include("CircularPlotting.jl")

end
7 changes: 1 addition & 6 deletions src/plotting/CircularPlotting.jl → ext/CircularPlotting.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# plotting functions of manifold beliefs

using .Gadfly
using .Colors

export plotCircBeliefs, plotKDECircular


# import ApproxManifoldProducts: plotCircBeliefs, plotKDECircular

Expand Down Expand Up @@ -98,7 +93,7 @@ function plotKDECircular( bd::BallTreeDensity;
end


plotMKD(mkd::ManifoldKernelDensity{M}) where M <: MB.AbstractManifold = plotKDE(mkd.belief)
plotMKD(mkd::ManifoldKernelDensity{M}) where M <: AbstractManifold = plotKDE(mkd.belief)
plotMKD(mkds::AbstractVector{<:ManifoldKernelDensity}) = plotKDE((x->x.belief).(mkds))


Expand Down
5 changes: 5 additions & 0 deletions ext/WeakdepsPrototypes.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Gadfly.jl
function plotCircBeliefs end
function plotKDECircular end
function plotMKD end
7 changes: 2 additions & 5 deletions src/ApproxManifoldProducts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ include("API.jl")

include("Deprecated.jl")

function __init__()
@require Gadfly="c91e804a-d5a3-530f-b6f0-dfbca275c004" begin
@require Colors="5ae59095-9a9b-59fe-a467-6f913c188581" include("plotting/CircularPlotting.jl")
end
end
# weak dependencies
include("../ext/WeakdepsPrototypes.jl")


end
6 changes: 6 additions & 0 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
## Remove below before v0.8
## ======================================================================================================

# function __init__()
# @require Gadfly="c91e804a-d5a3-530f-b6f0-dfbca275c004" begin
# @require Colors="5ae59095-9a9b-59fe-a467-6f913c188581" include("plotting/CircularPlotting.jl")
# end
# end


@deprecate R(th::Real) _Rot.RotMatrix2(th).mat # = [[cos(th);-sin(th)]';[sin(th);cos(th)]'];
@deprecate R(;x::Real=0.0,y::Real=0.0,z::Real=0.0) (M=SpecialOrthogonal(3);exp(M,identity_element(M),hat(M,Identity(M),[x,y,z]))) # convert(SO3, so3([x,y,z]))
Expand Down
4 changes: 4 additions & 0 deletions src/Legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Base.convert(::Type{<:Tuple}, ::Manifolds.Euclidean{Tuple{N}, ℝ} ) where N = t
Base.convert(::Type{<:Tuple}, ::Manifolds.Circle{ℝ}) = error("#FIXME")#(:Circular,)
Base.convert(::Type{<:Tuple}, ::Manifolds.RealCircleGroup) = (:Circular,)

# included separately downstream as needed
# Base.convert(::Type{<:Tuple}, ::Manifolds.SpecialOrthogonal{2}) = (:Circular,)
# Base.convert(::Type{<:Tuple}, ::Manifolds.SpecialOrthogonal{3}) = tuple([:Circular for _ in 1:3]...)

Base.convert(::Type{<:Tuple}, ::Type{<: typeof(Euclid)}) = (:Euclid,)
Base.convert(::Type{<:Tuple}, ::Type{<: typeof(Euclid2)}) = (:Euclid,:Euclid)
Base.convert(::Type{<:Tuple}, ::Type{<: typeof(Euclid3)}) = (:Euclid,:Euclid,:Euclid)
Expand Down

0 comments on commit 46dcc4e

Please sign in to comment.