1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Struct & traits for implementing residuals
//!
//! Residuals are the main building block of a
//! [factor](crate::containers::Factor).
//!
//! # Examples
//! Here we make a custom residual for a z-position measurement.
//! The `DimIn` and `DimOut` are the dimensions in and out, respectively,
//! while `V1` represents the type of the variable used (and more higher
//! numbered residuals have `V2`, `V3`, etc).
//!
//! `Differ` is the object that computes our auto-differentation. Out of the box
//! factrs comes with [ForwardProp](factrs::linalg::ForwardProp) and
//! [NumericalDiff](factrs::linalg::NumericalDiff). We recommend
//! [ForwardProp](factrs::linalg::ForwardProp) as it should be faster and more
//! accurate.
//!
//! Finally, the residual is defined through a single function that is generic
//! over the datatype. That's it! factrs handles the rest for you.
//!
//! ```
//! use std::fmt;
//!
//! use factrs::{
//! dtype,
//! linalg::{Const, ForwardProp, Numeric, VectorX},
//! residuals,
//! variables::SE3,
//! };
//!
//! #[derive(Debug, Clone)]
//! # #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
//! struct ZResidual {
//! value: dtype,
//! }
//!
//! #[factrs::mark]
//! impl residuals::Residual1 for ZResidual {
//! type DimIn = Const<6>;
//! type DimOut = Const<1>;
//! type V1 = SE3;
//! type Differ = ForwardProp<Const<6>>;
//!
//! fn residual1<T: Numeric>(&self, x1: SE3<T>) -> VectorX<T> {
//! VectorX::from_element(1, T::from(self.value) - x1.xyz().z)
//! }
//! }
//! ```
pub use tag_residual;
pub use ;
pub use PriorResidual;
pub use BetweenResidual;
pub use ;