Function k::center_of_mass

source ยท
pub fn center_of_mass<T>(chain: &Chain<T>) -> Vector3<T>
where T: RealField + SubsetOf<f64>,
Expand description

Calculate the center of mass of the chain

use k::*;
use k::link::*;

let j0 = NodeBuilder::new()
    .translation(Translation3::new(0.0, 1.0, 0.0))
    .into_node();
let j1 = NodeBuilder::new()
    .translation(Translation3::new(0.0, 0.0, 1.0))
    .into_node();
j0.set_link(Some(LinkBuilder::new().inertial(Inertial::from_mass(1.0)).finalize()));
j1.set_link(Some(LinkBuilder::new().inertial(Inertial::from_mass(4.0)).finalize()));
j1.set_parent(&j0);
let tree = Chain::from_root(j0);
let com1 = center_of_mass(&tree);