pub struct PoseGraph { /* private fields */ }Implementations§
Source§impl PoseGraph
impl PoseGraph
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn node_id(canvas_id: &str, frame: u32) -> String
pub fn node_id(canvas_id: &str, frame: u32) -> String
The node id for a canvas and frame: <canvasId>/<frame padded to 10 digits>.
pub fn get(&self, id: &str) -> Option<&PoseNode>
Sourcepub fn hydrate_node(&mut self, node: PoseNode)
pub fn hydrate_node(&mut self, node: PoseNode)
Takes back one stored node/ row.
Sourcepub fn hydrate_edge(&mut self, key: &str, edge: PoseEdge)
pub fn hydrate_edge(&mut self, key: &str, edge: PoseEdge)
Takes back one stored edge/ row under its full key; the owning node’s id is what the key holds between
edge/ and /<other>/<kind>.
Sourcepub fn add(
&mut self,
canvas_id: &str,
frame: u32,
(x, y): (f64, f64),
previous: Option<&str>,
weight: f64,
) -> Result<(PoseNode, Vec<Write>), PoseGraphError>
pub fn add( &mut self, canvas_id: &str, frame: u32, (x, y): (f64, f64), previous: Option<&str>, weight: f64, ) -> Result<(PoseNode, Vec<Write>), PoseGraphError>
Adds the node for canvas_id at frame, observed at odometry pose (x, y). With a previous node on the
same chain it starts from the correction that node has received so far, links to it with an odometry edge of
weight (a step measured on a thin overlap pulls less) and becomes its next; without one it is pinned.
Sourcepub fn connect(
&mut self,
a_id: &str,
b_id: &str,
dx: f64,
dy: f64,
weight: f64,
kind: EdgeKind,
) -> Result<Vec<Write>, PoseGraphError>
pub fn connect( &mut self, a_id: &str, b_id: &str, dx: f64, dy: f64, weight: f64, kind: EdgeKind, ) -> Result<Vec<Write>, PoseGraphError>
Links a to b by the offset (dx, dy) measured from a, once per pair and kind. A loop edge forward
along a’s own odometry chain also spreads the closure error over the nodes after a, in proportion to
their frame, so relaxation starts near the answer.
Sourcepub fn unpin(&mut self, id: &str) -> Result<Vec<Write>, PoseGraphError>
pub fn unpin(&mut self, id: &str) -> Result<Vec<Write>, PoseGraphError>
Lets a node move under relaxation (a relocalized or attached node starts pinned until its loop edge is wired) and stores it.
Sourcepub fn correction(
&self,
id: &str,
frame: f64,
) -> Result<(f64, f64), PoseGraphError>
pub fn correction( &self, id: &str, frame: f64, ) -> Result<(f64, f64), PoseGraphError>
How far relaxation moved the pose at frame on the chain through node id: that node’s correction,
blended towards its next node’s by how far frame lies between them.
Sourcepub fn begin_optimize(&self) -> Option<Optimizer>
pub fn begin_optimize(&self) -> Option<Optimizer>
Starts relaxing the graph, or returns None when it holds no loop edge (nothing to relax: the outcome is
zero residual after zero iterations, and nothing is written).
Sourcepub fn finish_optimize(
&mut self,
optimizer: Optimizer,
) -> (OptimizeOutcome, Vec<Write>)
pub fn finish_optimize( &mut self, optimizer: Optimizer, ) -> (OptimizeOutcome, Vec<Write>)
Writes a finished relaxation back: every unpinned node with at least one edge takes its relaxed position
and is stored, in node order, FLUSH_CHUNK per putMany.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PoseGraph
impl RefUnwindSafe for PoseGraph
impl Send for PoseGraph
impl Sync for PoseGraph
impl Unpin for PoseGraph
impl UnsafeUnpin for PoseGraph
impl UnwindSafe for PoseGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more