@@ -6,22 +6,21 @@ $(TYPEDEF)
66"""
77mutable struct Point2Point2Range{D <: IIF.SamplableBelief } <: IncrementalInference.AbstractRelativeMinimize
88 Z:: D
9- Point2Point2Range {D} () where {D} = new {D} ()
10- Point2Point2Range {D} (d:: D ) where {D <: IIF.SamplableBelief } = new {D} (d)
9+ # Point2Point2Range{D}() where {D} = new{D}()
10+ # Point2Point2Range{D}(d::D) where {D <: IIF.SamplableBelief} = new{D}(d)
1111end
12- Point2Point2Range (d:: D ) where {D <: IIF.SamplableBelief } = Point2Point2Range {D} (d)
12+ # Point2Point2Range(d::D) where {D <: IIF.SamplableBelief} = Point2Point2Range{D}(d)
13+
1314function getSample (cfo:: CalcFactor{<:Point2Point2Range} , N:: Int = 1 )
14- return (reshape (rand (cfo. factor. Z,N),1 ,N), 2 * pi * rand (N))
15- end
16- function (cfo:: CalcFactor{<:Point2Point2Range} )(rho, theta, xi, lm)
17- #
18- XX = lm[1 ] - (rho[1 ]* cos (theta[1 ]) + xi[1 ])
19- YY = lm[2 ] - (rho[1 ]* sin (theta[1 ]) + xi[2 ])
20- # TODO JT - Should this have a sqrt for parametric?
21- # return XX^2 + YY^2
22- return sqrt (XX^ 2 + YY^ 2 )
15+ return (reshape (rand (cfo. factor. Z,N),1 ,N),)
2316end
2417
18+ function (cfo:: CalcFactor{<:Point2Point2Range} )(rho, xi, lm)
19+ # Basically `EuclidDistance`
20+ # must return all dimensions
21+ return rho .- norm (lm[1 : 2 ] .- xi[1 : 2 ])
22+ # return [rho[1] - norm(lm[1:2] .- xi[1:2])]
23+ end
2524
2625passTypeThrough (d:: FunctionNodeData{Point2Point2Range} ) = d
2726
@@ -30,8 +29,8 @@ $(TYPEDEF)
3029"""
3130mutable struct PackedPoint2Point2Range <: IncrementalInference.PackedInferenceType
3231 str:: String
33- PackedPoint2Point2Range () = new ()
34- PackedPoint2Point2Range (s:: AS ) where {AS <: AbstractString } = new (s)
32+ # PackedPoint2Point2Range() = new()
33+ # PackedPoint2Point2Range(s::AS) where {AS <: AbstractString} = new(s)
3534end
3635function convert (:: Type{PackedPoint2Point2Range} , d:: Point2Point2Range )
3736 return PackedPoint2Point2Range (convert (PackedSamplableBelief, d. Z))
4746
4847Range only measurement from Pose2 to Point2 variable.
4948"""
50- mutable struct Pose2Point2Range{T} <: IIF.AbstractRelativeMinimize
49+ mutable struct Pose2Point2Range{T <: IIF.SamplableBelief } <: IIF.AbstractRelativeMinimize
5150 Z:: T
5251 partial:: Tuple{Int,Int}
53- Pose2Point2Range {T} () where T = new ()
54- Pose2Point2Range {T} (Z:: T ) where {T <: IIF.SamplableBelief } = new {T} (Z, (1 ,2 ))
52+ # Pose2Point2Range{T}() where T = new()
5553end
56- Pose2Point2Range (Z:: T ) where {T <: IIF.SamplableBelief } = Pose2Point2Range {T} (Z)
54+ Pose2Point2Range (Z:: T ) where {T <: IIF.SamplableBelief } = Pose2Point2Range {T} (Z, (1 ,2 ))
55+ # Pose2Point2Range(Z::T) where {T <: IIF.SamplableBelief} = Pose2Point2Range{T}(Z)
5756
5857function getSample (cfo:: CalcFactor{<:Pose2Point2Range} , N:: Int = 1 )
59- return (reshape (rand (cfo. factor. Z,N),1 ,N) , 2 * pi * rand (N))
60- end
61- function (pp2r:: CalcFactor{<:Pose2Point2Range} )(rho,
62- theta,
63- xi,
64- lm )
65- #
66- # DONE in IIF -- still need to add multi-hypotheses support here
67- # this is the noisy range
68- XX = lm[1 ] - (rho[1 ]* cos (theta[1 ]) + xi[1 ])
69- YY = lm[2 ] - (rho[1 ]* sin (theta[1 ]) + xi[2 ])
70- return sqrt (XX^ 2 + YY^ 2 )
58+ return (reshape (rand (cfo. factor. Z,N),1 ,N), )
7159end
7260
61+ function (cfo:: CalcFactor{<:Pose2Point2Range} )(rho, xi, lm)
62+ # Basically `EuclidDistance`
63+ return rho .- norm (lm[1 : 2 ] .- xi[1 : 2 ])
64+ # return [rho[1] - norm(lm[1:2] .- xi[1:2])]
65+ end
7366
7467
7568mutable struct PackedPose2Point2Range <: IncrementalInference.PackedInferenceType
7669 str:: String
77- PackedPose2Point2Range () = new ()
78- PackedPose2Point2Range (s:: AS ) where {AS <: AbstractString } = new (s)
70+ # PackedPose2Point2Range() = new()
71+ # PackedPose2Point2Range(s::AS) where {AS <: AbstractString} = new(s)
7972end
8073function convert (:: Type{PackedPose2Point2Range} , d:: Pose2Point2Range )
8174 return PackedPose2Point2Range (convert (PackedSamplableBelief, d. Z))
0 commit comments