[][src]Struct k::Joint

pub struct Joint<T: RealField> {
    pub name: String,
    pub joint_type: JointType<T>,
    pub limits: Option<Range<T>>,
    // some fields omitted
}

Joint with type

Fields

name: String

Name of this joint

joint_type: JointType<T>

Type of this joint

limits: Option<Range<T>>

Limits of this joint

Implementations

impl<T> Joint<T> where
    T: RealField + SubsetOf<f64>, 
[src]

pub fn new(name: &str, joint_type: JointType<T>) -> Joint<T>[src]

Create new Joint with name and type

Examples

extern crate nalgebra as na;
extern crate k;

// create fixed joint
let fixed = k::Joint::<f32>::new("f0", k::JointType::Fixed);
assert!(fixed.joint_position().is_none());

// create rotational joint with Y-axis
let rot = k::Joint::<f64>::new("r0", k::JointType::Rotational { axis: na::Vector3::y_axis() });
assert_eq!(rot.joint_position().unwrap(), 0.0);

pub fn set_joint_position(&mut self, position: T) -> Result<(), Error>[src]

Set the position of the joint

It returns Err if it is out of the limits, or this is fixed joint.

Examples

extern crate nalgebra as na;
extern crate k;

// Create fixed joint
let mut fixed = k::Joint::<f32>::new("f0", k::JointType::Fixed);
// Set position to fixed joint always fails
assert!(fixed.set_joint_position(1.0).is_err());

// Create rotational joint with Y-axis
let mut rot = k::Joint::<f64>::new("r0", k::JointType::Rotational { axis: na::Vector3::y_axis() });
// As default, it has not limit

// Initial position is 0.0
assert_eq!(rot.joint_position().unwrap(), 0.0);
// If it has no limits, set_joint_position always succeeds.
rot.set_joint_position(0.2).unwrap();
assert_eq!(rot.joint_position().unwrap(), 0.2);

pub fn set_joint_position_clamped(&mut self, position: T)[src]

Set the clamped position of the joint

It refers to the joint limit and clamps the argument. This function does nothing if this is fixed joint.

Examples

extern crate nalgebra as na;
extern crate k;

// Create rotational joint with Y-axis
let mut rot = k::Joint::<f64>::new("r0", k::JointType::Rotational { axis: na::Vector3::y_axis() });

let limits = k::joint::Range::new(-1.0, 1.0);
rot.limits = Some(limits);

// Initial position is 0.0
assert_eq!(rot.joint_position().unwrap(), 0.0);
rot.set_joint_position_clamped(2.0);
assert_eq!(rot.joint_position().unwrap(), 1.0);
rot.set_joint_position_clamped(-2.0);
assert_eq!(rot.joint_position().unwrap(), -1.0);

pub fn set_joint_position_unchecked(&mut self, position: T)[src]

pub fn joint_position(&self) -> Option<T>[src]

Returns the position (angle)

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

pub fn set_origin(&mut self, origin: Isometry3<T>)[src]

pub fn set_joint_velocity(&mut self, velocity: T) -> Result<(), Error>[src]

pub fn joint_velocity(&self) -> Option<T>[src]

Returns the velocity

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

Calculate and returns the transform of the end of this joint

Examples

extern crate nalgebra as na;
extern crate k;

// Create linear joint with X-axis
let mut lin = k::Joint::<f64>::new("l0", k::JointType::Linear { axis: na::Vector3::x_axis() });
assert_eq!(lin.local_transform().translation.vector.x, 0.0);
lin.set_joint_position(-1.0).unwrap();
assert_eq!(lin.local_transform().translation.vector.x, -1.0);

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

Get the result of forward kinematics

The value is updated by Chain::update_transforms

pub fn world_velocity(&self) -> Option<Velocity<T>>[src]

pub fn is_movable(&self) -> bool[src]

Trait Implementations

impl<T: Clone + RealField> Clone for Joint<T>[src]

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

impl<T: RealField> Display for Joint<T>[src]

impl<'a, T> From<&'a Joint> for Joint<T> where
    T: RealField + SubsetOf<f64>, 
[src]

impl<T> From<Joint<T>> for Node<T> where
    T: RealField + SubsetOf<f64>, 
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Joint<T>[src]

impl<T> Send for Joint<T> where
    T: Scalar
[src]

impl<T> !Sync for Joint<T>[src]

impl<T> Unpin for Joint<T> where
    T: Scalar + Unpin
[src]

impl<T> UnwindSafe for Joint<T> where
    T: Scalar + UnwindSafe
[src]

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>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,