Struct robot_description_builder::Link
source · 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+): TheVisual
elements associated with thisLink
.colliders
(0+): TheCollision
elements associated with thisLink
.joints
(0+): The childJoints
of thisLink
. AJoint
can be attached together with its child, using the methods mentioned in the Building section.inertial
(Optional): TheInertial
data 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 currentLink
with 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 !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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.