pub trait KinematicInterface: Sized {
Show 18 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_transmissions( &self ) -> Arc<RwLock<HashMap<String, Arc<RwLock<Transmission>>>>>; 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 get_transmission(&self, name: &str) -> Option<Arc<RwLock<Transmission>>>; fn try_add_transmission( &self, transmission: TransmissionBuilder<WithJoints, WithActuator> ) -> Result<(), AddTransmissionError>; fn purge_links( &self ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Weak<RwLock<Link>>>>>>; fn purge_joints( &self ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Weak<RwLock<Joint>>>>>>; fn purge_materials( &self ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Arc<RwLock<MaterialData>>>>>>; fn purge_transmissions( &self ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Arc<RwLock<Transmission>>>>>>; // Provided methods fn yank_link(&self, name: &str) -> Option<Chained<LinkBuilder>> { ... } fn yank_root(self) -> Chained<LinkBuilder> { ... } fn yank_joint(&self, name: &str) -> Option<Chained<JointBuilder>> { ... }
}

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(
    LinkBuilder::new("his one and only child"),
    JointBuilder::new("just a joint", JointType::Fixed)
).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(
    LinkBuilder::new("his one and only child"),
    JointBuilder::new("just a joint", JointType::Fixed)
).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(
    Link::builder("the latest child"),
    JointBuilder::new("second joint", JointType::Fixed)
).unwrap();

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

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

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

source

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

FIXME: This not Ok end-user should not interact wiht MaterialData

source

fn get_transmissions( &self ) -> Arc<RwLock<HashMap<String, Arc<RwLock<Transmission>>>>>

source

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

source

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

source

fn get_transmission(&self, name: &str) -> Option<Arc<RwLock<Transmission>>>

source

fn try_add_transmission( &self, transmission: TransmissionBuilder<WithJoints, WithActuator> ) -> Result<(), AddTransmissionError>

TODO: NOT FINAL TODO: Maybe remove rcrefcell from transmission parameter

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 ) -> Result<(), PoisonError<RwLockWriteGuard<'_, HashMap<String, Weak<RwLock<Joint>>>>>>

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

source

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

Cleans up orphaned/broken Transmission entries from the transmissions HashMap

Provided Methods§

TODO: DOCS

NOTE: after yanking the joints parent link is the newest_link

source

fn yank_root(self) -> Chained<LinkBuilder>

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(), builder);

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

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

Implementors§