pub trait KinematicInterface: Sized {
Show 14 methods // Required methods fn get_root_link(&self) -> Arc<RwLock<Link>>; fn get_newest_link(&self) -> Arc<RwLock<Link>>; fn get_links(&self) -> Arc<RwLock<HashMap<String, Weak<RwLock<Link>>>>>; fn get_joints(&self) -> Arc<RwLock<HashMap<String, Weak<RwLock<Joint>>>>>; fn get_materials( &self ) -> Arc<RwLock<HashMap<String, Arc<RwLock<MaterialData>>>>>; fn get_link(&self, name: &str) -> Option<Arc<RwLock<Link>>>; fn get_joint(&self, name: &str) -> Option<Arc<RwLock<Joint>>>; fn get_material(&self, name: &str) -> Option<Material>; fn purge_links(&self); fn purge_joints(&self); fn purge_materials( &self ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Arc<RwLock<MaterialData>>>>>>; // Provided methods fn yank_link(&self, name: &str) -> Option<Chained<LinkBuilder>> { ... } fn yank_root(self) -> Result<Chained<LinkBuilder>, YankLinkError> { ... } fn yank_joint(&self, name: &str) -> Option<Chained<JointBuilder>> { ... }
}
Expand description

A trait which allows for the existance of multiple different Kinematic Structures, such as Robot and KinematicTree.

Required Methods§

Returns the root link of the Kinematic Tree

Example
let tree = Link::builder("the root link").build_tree();

/// This is equivalent to `get_root_link` in this case, since this is a new tree/Link.
tree.get_newest_link().try_write().unwrap().try_attach_child(
    JointBuilder::new("just a joint", JointType::Fixed),
    LinkBuilder::new("his one and only child")
).unwrap();

assert_eq!(tree.get_root_link().try_read().unwrap().name(), "the root link")

Returns the newest link of the Kinematic Tree

Example
let tree = Link::builder("the root link").build_tree();

assert_eq!(tree.get_newest_link().try_read().unwrap().name(), "the root link");

tree.get_newest_link().try_write().unwrap().try_attach_child(
    JointBuilder::new("just a joint", JointType::Fixed),
    LinkBuilder::new("his one and only child")
).unwrap();

assert_eq!(tree.get_newest_link().try_read().unwrap().name(), "his one and only child");

let long_sub_tree = LinkBuilder::new("the other child").build_tree();

long_sub_tree.get_newest_link().try_write().unwrap().try_attach_child(
    JointBuilder::new("second joint", JointType::Fixed),
    Link::builder("the latest child")
).unwrap();

tree.get_root_link().try_write().unwrap().try_attach_child(
    JointBuilder::new("third joint", JointType::Fixed),
    long_sub_tree
).unwrap();

assert_eq!(tree.get_newest_link().try_read().unwrap().name(), "the latest child");

Retrieves the Link-index of the Kinematic structure.

source

fn get_joints(&self) -> Arc<RwLock<HashMap<String, Weak<RwLock<Joint>>>>>

Retrieves the Joint-index of the Kinematic structure.

source

fn get_materials( &self ) -> Arc<RwLock<HashMap<String, Arc<RwLock<MaterialData>>>>>

Get the Link with the specified name.

If the Link does not exist None is returned.

source

fn get_joint(&self, name: &str) -> Option<Arc<RwLock<Joint>>>

Get the Joint with the specified name.

If the Joint does not exist None is returned.

source

fn get_material(&self, name: &str) -> Option<Material>

Get the Material with the specified name.

If the Material does not exist None is returned.

Cleans up orphaned/broken Link entries from the links HashMap.

This mostly happens automatically, but is exposed for use in other methods.

TODO: DOCTEST/EXAMPLE

source

fn purge_joints(&self)

Cleans up orphaned/broken Joint entries from the joints HashMap.

This mostly happens automatically, but is exposed for use in other methods.

TODO: DOCTEST/EXAMPLE

source

fn purge_materials( &self ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Arc<RwLock<MaterialData>>>>>>

Cleans up orphaned/unused Material entries from material_index HashMap

Provided Methods§

source

fn yank_root(self) -> Result<Chained<LinkBuilder>, YankLinkError>

Cosumes the KinematicInterface implementor and creates a Chained<LinkBuilder> to rebuild it.

This has the same result as yanking the root_link, with the additional effect that the current tree is consumed.

Example

let builder = Link::builder("root-link");

assert_eq!(*builder.clone().build_tree().yank_root().unwrap(), builder);

/// It is equivalent to yanking the "root_link"
assert_eq!(builder.clone().build_tree().yank_root().unwrap(), builder.build_tree().yank_link("root-link").unwrap())
source

fn yank_joint(&self, name: &str) -> Option<Chained<JointBuilder>>

Object Safety§

This trait is not object safe.

Implementors§