Skip to content

Commit 47a74da

Browse files
authored
Merge pull request #895 from JuliaRobotics/22Q3/docs/samplingformat
update docs w sampling data formats
2 parents 322392f + b44bd69 commit 47a74da

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

docs/src/examples/custom_relative_factors.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ 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+
|-------------------|----|
31+
| `sampleTangent` | tangent at point `p` or the identity element for groups |
32+
| `rand` / `sample` | coordinates |
33+
2334
## Specialized Dispatch (`getManifold`, `getSample`)
2435

2536
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 +58,7 @@ function getSample(cf::CalcFactor{<:Pose2Pose2})
4758
end
4859
```
4960

50-
The return type for `getSample` is unrestricted, and will be passed to the residual function "as-is".
61+
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`
5162

5263
!!! note
5364
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 +81,11 @@ function (cf::CalcFactor{<:Pose2Pose2})(X, p, q)
7081
end
7182
```
7283

84+
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.
85+
7386
!!! note
7487
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.
7588

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-
7889
### Serialization
7990

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

0 commit comments

Comments
 (0)