pub trait Variable:
Clone
+ Sized
+ Display
+ Debug {
type T: Numeric;
type Dim: DimName;
type Alias<TT: Numeric>: Variable<T = TT>;
const DIM: usize = <Self::Dim>::USIZE;
Show 16 methods
// Required methods
fn identity() -> Self;
fn inverse(&self) -> Self;
fn compose(&self, other: &Self) -> Self;
fn exp(delta: VectorViewX<'_, Self::T>) -> Self;
fn log(&self) -> VectorX<Self::T>;
fn cast<TT: Numeric + SupersetOf<Self::T>>(&self) -> Self::Alias<TT>;
// Provided methods
fn dim(&self) -> usize { ... }
fn oplus(&self, xi: VectorViewX<'_, Self::T>) -> Self { ... }
fn oplus_right(&self, xi: VectorViewX<'_, Self::T>) -> Self { ... }
fn oplus_left(&self, xi: VectorViewX<'_, Self::T>) -> Self { ... }
fn ominus(&self, y: &Self) -> VectorX<Self::T> { ... }
fn ominus_right(&self, y: &Self) -> VectorX<Self::T> { ... }
fn ominus_left(&self, y: &Self) -> VectorX<Self::T> { ... }
fn minus(&self, other: &Self) -> Self { ... }
fn dual_exp<N: DimName>(idx: usize) -> Self::Alias<DualVector<N>>
where AllocatorBuffer<N>: Sync + Send,
DefaultAllocator: DualAllocator<N>,
DualVector<N>: Copy { ... }
fn dual<N: DimName>(&self, idx: usize) -> Self::Alias<DualVector<N>>
where AllocatorBuffer<N>: Sync + Send,
DefaultAllocator: DualAllocator<N>,
DualVector<N>: Copy + SupersetOf<Self::T> { ... }
}
Expand description
Variable trait for Lie groups
All variables must implement this trait to be used in the optimization algorithms. See module level documentation for more details.
Provided Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn exp(delta: VectorViewX<'_, Self::T>) -> Self
fn exp(delta: VectorViewX<'_, Self::T>) -> Self
Exponential map (trivial if a vector space)
Provided Methods§
Sourcefn oplus(&self, xi: VectorViewX<'_, Self::T>) -> Self
fn oplus(&self, xi: VectorViewX<'_, Self::T>) -> Self
Adds value from the tangent space to the group element
By default this uses the “right” version 1 $$ x \oplus \xi = x \cdot \exp(\xi) $$ If the “left” feature is enabled, instead this turns to $$ x \oplus \xi = \exp(\xi) \cdot x $$
Solà, Joan, et al. “A Micro Lie Theory for State Estimation in Robotics.” Arxiv:1812.01537, Dec. 2021 ↩
fn oplus_right(&self, xi: VectorViewX<'_, Self::T>) -> Self
fn oplus_left(&self, xi: VectorViewX<'_, Self::T>) -> Self
Sourcefn ominus(&self, y: &Self) -> VectorX<Self::T>
fn ominus(&self, y: &Self) -> VectorX<Self::T>
Compares two group elements in the tangent space
By default this uses the “right” version 1 $$ x \ominus y = \log(y^{-1} \cdot x) $$ If the “left” feature is enabled, instead this turns to $$ x \ominus y = \log(x \cdot y^{-1}) $$
Solà, Joan, et al. “A Micro Lie Theory for State Estimation in Robotics.” Arxiv:1812.01537, Dec. 2021 ↩
fn ominus_right(&self, y: &Self) -> VectorX<Self::T>
fn ominus_left(&self, y: &Self) -> VectorX<Self::T>
Sourcefn minus(&self, other: &Self) -> Self
fn minus(&self, other: &Self) -> Self
Subtract out portion from other variable.
This can be seen as a “tip-to-tail” computation. IE it computes the transformation between two poses. I like to think of it as “taking away” the portion subtracted out, for example given a chain of poses $a, b, c$, the following “removes” the portion from $a$ to $b$.
$$ {}_a T_c \boxminus {}_a T_b = ({}_a T_b)^{-1} {}_a T_c = {}_b T_c $$
This operation is NOT effected by the left/right feature.
Examples found in repository?
11fn main() {
12 // Make all the values
13 let mut values = Values::new();
14
15 let x = SO2::from_theta(1.0);
16 let y = SO2::from_theta(2.0);
17 values.insert(X(0), SO2::identity());
18 values.insert(X(1), SO2::identity());
19
20 // Make the factors & insert into graph
21 let mut graph = Graph::new();
22 let res = PriorResidual::new(x.clone());
23 let factor = fac![res, X(0)];
24 graph.add_factor(factor);
25
26 let res = BetweenResidual::new(y.minus(&x));
27 let factor = fac![res, (X(0), X(1)), 0.1 as std, Huber::default()];
28 graph.add_factor(factor);
29
30 // Optimize!
31 let mut opt: GaussNewton = GaussNewton::new(graph);
32 let result = opt.optimize(values).unwrap();
33 println!("Results {:#}", result);
34}
Sourcefn dual_exp<N: DimName>(idx: usize) -> Self::Alias<DualVector<N>>
fn dual_exp<N: DimName>(idx: usize) -> Self::Alias<DualVector<N>>
Setup group element correctly using the tangent space
By default this uses the exponential map to propagate dual numbers to the variable to setup the jacobian properly. Can be hardcoded to avoid the repeated computation.
Sourcefn dual<N: DimName>(&self, idx: usize) -> Self::Alias<DualVector<N>>where
AllocatorBuffer<N>: Sync + Send,
DefaultAllocator: DualAllocator<N>,
DualVector<N>: Copy + SupersetOf<Self::T>,
fn dual<N: DimName>(&self, idx: usize) -> Self::Alias<DualVector<N>>where
AllocatorBuffer<N>: Sync + Send,
DefaultAllocator: DualAllocator<N>,
DualVector<N>: Copy + SupersetOf<Self::T>,
Applies the tangent vector in dual space
Takes the results from dual_exp and applies the tangent vector using the right/left oplus operator.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.