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 strThe joint’s own identity, unique within its structure.
kind: JointKindWhich degree of freedom the joint has.
parent: &'a strThe link this joint hangs from, which must already exist.
child: &'a strThe 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: JointLimitHow 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.