Skip to content

Commit 3dab6e9

Browse files
authored
update docs w sampling data formats
1 parent 78c37a3 commit 3dab6e9

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

docs/src/examples/custom_relative_factors.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ end
2020
```
2121
New relative factors should either inheret from `<:AbstractManifoldMinimize`, `<:AbstractRelativeMinimize`, or `<:AbstractRelativeRoots`. These are all subtypes of `<:AbstractRelative`. There are only two abstract super types, `<:AbstractPrior` and `<:AbstractRelative`.
2222

23+
## Summary of Sampling Data Representation
24+
25+
| Usage | `<:AbstractPrior` | `<:AbstractRelative` |
26+
|-------------|--------------------|-----------------------|
27+
| `getSample` | point `p` on Manifold | tangent `X` at some `p` (e.g. identity) |
28+
29+
| Usage | |
30+
| `sampleTangent` | tangent at point `p` or the identity element for groups |
31+
| `rand` / `sample` | coordinates |
32+
2333
## Specialized Dispatch (`getManifold`, `getSample`)
2434

2535
Relative factors involve computaton, these computations must be performed on some manifold. Custom relative factors require that the [`getManifold`](@ref) function be overridded. Here two examples are given for reference:
@@ -47,7 +57,7 @@ function getSample(cf::CalcFactor{<:Pose2Pose2})
4757
end
4858
```
4959

50-
The return type for `getSample` is unrestricted, and will be passed to the residual function "as-is".
60+
The return type for `getSample` is unrestricted, and will be passed to the residual function "as-is", but must return values representing a tangent vector for `<:AbstractRelative`
5161

5262
!!! note
5363
Default dispatches in `IncrementalInference` will try use `cf.factor.Z` to `samplePoint` on manifold (for `<:AbstractPrior`) or `sampleTangent` (for `<:AbstractRelative`), which simplifies new factor definitions. If, however, you wish to build more complicated sampling processes, then simply define your own `getSample(cf::CalcFactor{<:MyFactor})` function.
@@ -70,11 +80,11 @@ function (cf::CalcFactor{<:Pose2Pose2})(X, p, q)
7080
end
7181
```
7282

83+
It is recommended to leave the incoming types unrestricted. If you must define the types, make sure to allow sufficient dispatch freedom (i.e. dispatch to concrete types) and not force operations to "non-concrete" types. Usage can be very case specific, and hence better to let Julia type-inference automation do the hard work of inferring the concrete types.
84+
7385
!!! note
7486
At present (2021) the residual function should return the residual value as a coordinate (not as tangent vectors or manifold points). Ongoing work is in progress, and likely to return residual values as manifold tangent vectors instead.
7587

76-
It is recommended to leave the incoming types unrestricted. If you must define the types, make sure to allow sufficient dispatch freedom (i.e. dispatch to concrete types) and not force operations to "non-concrete" types. Usage can be very case specific, and hence better to let Julia type-inference automation do the hard work of inferring the concrete types.
77-
7888
### Serialization
7989

8090
Serialization of factors is also discussed in more detail at [Standardized Factor Serialization](@ref factor_serialization).

0 commit comments

Comments
 (0)