pub struct Link { /* private fields */ }Expand description
A Link in a Kinematic Structure.
A Link is an element of a KinematicInterface Implementor (for now KinematicTree and Robot).
A Link can be created from a LinkBuilder, which can be created by the builder method.
This will configure most of the link data:
name: The string identifier (or name) of thisLink. For practical purposes, it is recommended to use unique identifiers/names.visuals(0+): TheVisualelements associated with thisLink.colliders(0+): TheCollisionelements associated with thisLink.joints(0+): The childJointsof thisLink. AJointcan be attached together with its child, using the methods mentioned in the Building section.inertial(Optional): TheInertialdata for thisLink.
§Building
A Joint and its child Link can only be attached to a Link/KinematicTree in one go, to prevent (invalid) leaf Joints and disconnected Links.
The following methods can be used to attach a branch:
attach_joint_chain: Attach aChained<JointBuilder>to the currentLink.attach_joint_chain_at: Attach aChained<JointBuilder>to the currentLinkwith the specifiedTransform.try_attach_child: Attach aLink(chain) via a specifiedJoint.
Implementations§
Source§impl Link
impl Link
Sourcepub fn builder(name: impl Into<String>) -> LinkBuilder
pub fn builder(name: impl Into<String>) -> LinkBuilder
Create a new LinkBuilder with the specified name.
Sourcepub fn get_self(&self) -> Arc<RwLock<Link>>
pub fn get_self(&self) -> Arc<RwLock<Link>>
Gets a (strong) refence to the current Link. (An Arc<RwLock<Link>>)
Sourcepub fn get_weak_self(&self) -> Weak<RwLock<Link>>
pub fn get_weak_self(&self) -> Weak<RwLock<Link>>
Gets a weak refence to the current Link. (An Weak<RwLock<Link>>)
Sourcepub fn parent(&self) -> &LinkParent
pub fn parent(&self) -> &LinkParent
Gets the reference to the LinkParent of the current Link
Sourcepub fn name(&self) -> &String
pub fn name(&self) -> &String
Gets the reference to the name of the Link
§Example
let tree = LinkBuilder::new("my-link").build_tree();
assert_eq!(tree.get_root_link().try_read().unwrap().name(), "my-link")pub fn try_attach_child<LinkChain>( &mut self, joint_builder: impl BuildJoint, link_chain: LinkChain, ) -> Result<(), AttachChainError>
pub fn attach_joint_chain_at( &mut self, joint_chain: Chained<JointBuilder>, transform: Transform, ) -> Result<(), AttachChainError>
pub fn attach_joint_chain( &mut self, joint_chain: Chained<JointBuilder>, ) -> Result<(), AttachChainError>
pub fn inertial(&self) -> Option<&Inertial>
pub fn visuals(&self) -> &Vec<Visual>
pub fn colliders(&self) -> &Vec<Collision>
Sourcepub fn rebuild(&self) -> LinkBuilder
pub fn rebuild(&self) -> LinkBuilder
Make a LinkBuilder to build a ‘Clone’ of the Link.
This method does not clone the child joints of the Link, only the Link is self.
If the whole branch needs to be copied use rebuild_branch.
pub fn rebuild_branch(&self) -> Result<Chained<LinkBuilder>, RebuildBranchError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Link
impl !RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl !UnwindSafe for Link
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.