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 this Link. For practical purposes, it is recommended to use unique identifiers/names.
  • visuals (0+): The Visual elements associated with this Link.
  • colliders (0+): The Collision elements associated with this Link.
  • joints (0+): The child Joints of this Link. A Joint can be attached together with its child, using the methods mentioned in the Building section.
  • inertial (Optional): The Inertial data for this Link.

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:

Implementations§

source

pub fn builder(name: impl Into<String>) -> LinkBuilder

Create a new LinkBuilder with the specified name.

source

pub fn get_self(&self) -> Arc<RwLock<Link>>

Gets a (strong) refence to the current Link. (An Arc<RwLock<Link>>)

source

pub fn get_weak_self(&self) -> Weak<RwLock<Link>>

Gets a weak refence to the current Link. (An Weak<RwLock<Link>>)

source

pub fn parent(&self) -> &LinkParent

Gets the reference to the LinkParent of the current Link

source

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")
source

pub fn joints(&self) -> &Vec<Arc<RwLock<Joint>>>

Returns a reference to the joints of this Link.

The vector contains all Joints connected to this Link, wrapped in a Arc<RwLock<T>>.

source

pub fn try_attach_child<LinkChain>( &mut self, joint_builder: impl BuildJoint, link_chain: LinkChain ) -> Result<(), AttachChainError>
where LinkChain: Into<Chained<LinkBuilder>>,

source

pub fn attach_joint_chain_at( &mut self, joint_chain: Chained<JointBuilder>, transform: Transform ) -> Result<(), AttachChainError>

source

pub fn attach_joint_chain( &mut self, joint_chain: Chained<JointBuilder> ) -> Result<(), AttachChainError>

source

pub fn inertial(&self) -> Option<&Inertial>

source

pub fn visuals(&self) -> &Vec<Visual>

source

pub fn colliders(&self) -> &Vec<Collision>

source

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.

source

pub fn rebuild_branch(&self) -> Result<Chained<LinkBuilder>, RebuildBranchError>

Trait Implementations§

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

fn to_urdf( &self, writer: &mut Writer<Cursor<Vec<u8>>>, urdf_config: &URDFConfig ) -> Result<(), Error>

Represents the element as in URDF format.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.