[][src]Struct k::SerialChain

pub struct SerialChain<T: RealField> { /* fields omitted */ }

Kinematic chain without any branch.

All joints are connected sequentially.

Methods

impl<T> SerialChain<T> where
    T: RealField
[src]

pub fn new_unchecked(inner: Chain<T>) -> Self[src]

Convert Chain into SerialChain without any check

If the input Chain has any branches it causes serious bugs.

pub fn try_new(inner: Chain<T>) -> Option<Self>[src]

Convert Chain into SerialChain

If the input Chain has any branches it fails.

Examples

let node = k::JointBuilder::<f32>::new().into_node();
let chain = k::Chain::from_root(node);
assert!(k::SerialChain::try_new(chain).is_some());
let node0 = k::JointBuilder::<f32>::new().into_node();
let node1 = k::JointBuilder::new().into_node();
let node2 = k::JointBuilder::new().into_node();
node1.set_parent(&node0);
node2.set_parent(&node0);
let chain = k::Chain::from_root(node0);
assert!(k::SerialChain::try_new(chain).is_none());

pub fn from_end(end_joint: &Node<T>) -> SerialChain<T>[src]

Create SerialChain from the end Node

Examples

let node = k::JointBuilder::<f32>::new().into_node();
let s_chain = k::SerialChain::from_end(&node);

pub fn unwrap(self) -> Chain<T>[src]

Safely unwrap and returns inner Chain instance

pub fn end_transform(&self) -> Isometry3<T>[src]

Calculate transform of the end joint

Methods from Deref<Target = Chain<T>>

pub fn iter(&self) -> impl Iterator<Item = &Node<T>>[src]

Iterate for all joint nodes

The order is from parent to children. You can assume that parent is already iterated.

Examples

use k::*;

let l0 = Node::new(Joint::new("fixed0", JointType::Fixed));
let l1 = Node::new(Joint::new("fixed1", JointType::Fixed));
l1.set_parent(&l0);
let tree = Chain::<f64>::from_root(l0);
let names = tree.iter().map(|node| node.joint().name.to_owned()).collect::<Vec<_>>();
assert_eq!(names.len(), 2);
assert_eq!(names[0], "fixed0");
assert_eq!(names[1], "fixed1");

pub fn iter_joints(&self) -> impl Iterator<Item = JointRefGuard<T>>[src]

Iterate for movable joints

Fixed joints are ignored. If you want to manipulate on Fixed, use iter() instead of iter_joints()

Iterate for links

pub fn dof(&self) -> usize[src]

Calculate the degree of freedom

Examples

use k::*;
let l0 = JointBuilder::new()
    .joint_type(JointType::Fixed)
    .finalize()
    .into();
let l1 : Node<f64> = JointBuilder::new()
    .joint_type(JointType::Rotational{axis: Vector3::y_axis()})
    .finalize()
    .into();
l1.set_parent(&l0);
let tree = Chain::from_root(l0);
assert_eq!(tree.dof(), 1);

pub fn find(&self, joint_name: &str) -> Option<&Node<T>>[src]

Find the joint by name

Examples

use k::*;

let l0 = Node::new(JointBuilder::new()
    .name("fixed")
    .finalize());
let l1 = Node::new(JointBuilder::new()
    .name("pitch1")
    .translation(Translation3::new(0.0, 0.1, 0.0))
    .joint_type(JointType::Rotational{axis: Vector3::y_axis()})
    .finalize());
l1.set_parent(&l0);
let tree = Chain::from_root(l0);
let j = tree.find("pitch1").unwrap();
j.set_joint_position(0.5).unwrap();
assert_eq!(j.joint_position().unwrap(), 0.5);

pub fn joint_positions(&self) -> Vec<T>[src]

Get the positions of the joints

FixedJoint is ignored. the length is the same with dof()

pub fn set_joint_positions(&self, positions_vec: &[T]) -> Result<(), JointError>[src]

Set the positions of the joints

FixedJoints are ignored. the input number must be equal with dof()

pub fn set_joint_positions_unchecked(&self, positions_vec: &[T])[src]

Fast, but without check, dangerous set_joint_positions

pub fn update_transforms(&self) -> Vec<Isometry3<T>>[src]

Update world_transform() of the joints

pub fn update_velocities(&self) -> Vec<Velocity<T>>[src]

Update world_velocity() of the joints

Update transforms of the links

Trait Implementations

impl<T: Debug + RealField> Debug for SerialChain<T>[src]

impl<T> Deref for SerialChain<T> where
    T: RealField
[src]

type Target = Chain<T>

The resulting type after dereferencing.

impl<T> Display for SerialChain<T> where
    T: RealField
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for SerialChain<T>

impl<T> !Send for SerialChain<T>

impl<T> !Sync for SerialChain<T>

impl<T> Unpin for SerialChain<T>

impl<T> !UnwindSafe for SerialChain<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.