Skip to main content

Joint

Struct Joint 

Source
pub struct Joint<'a> {
    pub name: &'a str,
    pub kind: JointKind,
    pub parent: &'a str,
    pub child: &'a str,
    pub xyz: [f64; 3],
    pub rpy: [f64; 3],
    pub axis: [f64; 3],
    pub limit: JointLimit,
    pub calibration: Option<Calibration>,
    pub dynamics: Option<Dynamics>,
    pub mimic: Option<Mimic<'a>>,
    pub safety: Option<Safety>,
}
Expand description

One joint of a built structure, and the link it moves.

The child link is created if no other joint already provides it, so stating a joint is also how a structure grows a link.

Every field but the three names has a default: the joint sits at its parent’s origin, turns about Z, is JointKind::Fixed, carries the all-zero limits a URDF joint without a <limit> compiles to, and states no calibration, dynamics, mimic or safety.

use phoxal_model::builder::{Joint, JointLimit, RobotBuilder};
use phoxal_model::structure::JointKind;

let robot = RobotBuilder::new("rover")
    .joint(Joint {
        name: "mast_joint",
        kind: JointKind::Revolute,
        parent: "base_link",
        child: "mast",
        xyz: [0.0, 0.0, 0.4],
        limit: JointLimit {
            lower: -1.5,
            upper: 1.5,
            effort: 8.0,
            velocity: 2.0,
        },
        ..Joint::default()
    })
    .build()?;

let mast = robot.structure().joint("mast_joint").expect("the stated joint");
assert_eq!(mast.limit().upper(), 1.5);
assert!(robot.structure().link("mast").is_some());

Fields§

§name: &'a str

The joint’s own identity, unique within its structure.

§kind: JointKind

Which degree of freedom the joint has.

§parent: &'a str

The link this joint hangs from, which must already exist.

§child: &'a str

The link this joint moves, created here if nothing else provides it.

§xyz: [f64; 3]

The child’s offset from the parent, in metres.

§rpy: [f64; 3]

The child’s roll, pitch and yaw relative to the parent, in radians.

§axis: [f64; 3]

The axis a movable joint turns or slides along, in the parent’s frame.

§limit: JointLimit

How far, how hard and how fast the joint may be driven.

§calibration: Option<Calibration>

Where the joint’s reference switch trips, when it has one.

§dynamics: Option<Dynamics>

The joint’s passive damping and friction, when they are modelled.

§mimic: Option<Mimic<'a>>

The joint this one follows instead of being driven independently.

§safety: Option<Safety>

The soft envelope a safety controller holds the joint inside.

Trait Implementations§

Source§

impl<'a> Clone for Joint<'a>

Source§

fn clone(&self) -> Joint<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Joint<'a>

Source§

impl<'a> Debug for Joint<'a>

Source§

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

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

impl Default for Joint<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Joint<'a>

§

impl<'a> RefUnwindSafe for Joint<'a>

§

impl<'a> Send for Joint<'a>

§

impl<'a> Sync for Joint<'a>

§

impl<'a> Unpin for Joint<'a>

§

impl<'a> UnsafeUnpin for Joint<'a>

§

impl<'a> UnwindSafe for Joint<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.