Skip to content

Commit 3f1bd0a

Browse files
authored
Merge pull request #760 from JuliaRobotics/21Q2/enh/getprior
add _getPriorType
2 parents 174473e + 4a3de8a commit 3f1bd0a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.14.1"
3+
version = "0.14.2"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/services/DFGFactor.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ getFactorType(data::GenericFunctionNodeData) = data.fnc.usrfnc!
3232
getFactorType(fct::DFGFactor) = getFactorType(getSolverData(fct))
3333
getFactorType(dfg::AbstractDFG, lbl::Symbol) = getFactorType(getFactor(dfg, lbl))
3434

35+
"""
36+
$SIGNATURES
37+
38+
If you know a variable is `::Type{<:Pose2}` but want to find its default prior `::Type{<:PriorPose2}`.
39+
40+
Assumptions
41+
- The prior type will be defined in the same module as the variable type.
42+
- Not exported per default, but can be used with knowledge of the caveats.
43+
44+
Example
45+
```julia
46+
using RoME
47+
@assert RoME.PriorPose2 == DFG._getPriorType(Pose2)
48+
```
49+
"""
50+
_getPriorType(_type::Type{<:InferenceVariable}) = getfield(_type.name.module, Symbol(:Prior, _type.name.name))
51+
3552

3653
##==============================================================================
3754
## Factors

0 commit comments

Comments
 (0)