Struct rubullet::LinkState[][src]

pub struct LinkState {
    pub world_pose: Isometry3<f64>,
    pub local_inertial_pose: Isometry3<f64>,
    pub world_link_frame_pose: Isometry3<f64>,
    pub world_velocity: Option<Velocity>,
}
Expand description

Describes the State of a Link

Kind of Frames

  • world_frame - center of mass
  • local_intertial_frame - offset to the CoM expressed in the URDF link frame
  • world_link_frame - URDF link frame

Relationships between Frames

urdfLinkFrame = comLinkFrame * localInertialFrame.inverse()

use rubullet::{PhysicsClient, UrdfOptions};
use nalgebra::Isometry3;
use rubullet::Mode::Direct;
use anyhow::Result;
fn main() -> Result<()> {
    let mut client = PhysicsClient::connect(Direct)?;
    client.set_additional_search_path(
        "../rubullet-sys/bullet3/libbullet3/examples/pybullet/gym/pybullet_data",
        )?;
    let panda_id = client.load_urdf("franka_panda/panda.urdf", UrdfOptions::default())?;
    let link_state = client.get_link_state(panda_id, 11, true, true)?;
    // urdfLinkFrame = comLinkFrame * localInertialFrame.inverse()
    let urdf_frame = link_state.world_pose * link_state.local_inertial_pose.inverse();
    // print both frames to see that they are about the same
    println!("{}", link_state.world_link_frame_pose);
    println!("{}", urdf_frame);
    // as they are both almost the same calculating the difference:
    // urdfLinkFrame.inverse() * world_link_frame_pose
    // should return something very close the identity matrix I.
    let identity = urdf_frame.inverse() * link_state.world_link_frame_pose;
    assert!(identity.translation.vector.norm() < 1e-7);
    assert!(identity.rotation.angle() < 1e-7);
    Ok(())
}

See also

Fields

world_pose: Isometry3<f64>

Cartesian pose of the center of mass

local_inertial_pose: Isometry3<f64>

local offset of the inertial frame (center of mass) express in the URDF link frame

world_link_frame_pose: Isometry3<f64>

world pose of the URDF link frame

world_velocity: Option<Velocity>

Cartesian world linear velocity.

Implementations

conveniently returns the linear world velocity or an error if the velocity was not calculated for the LinkState. Be sure to set compute_link_velocity to true in get_link_state()

conveniently returns the angular world velocity or an error if the velocity was not calculated for the LinkState. Be sure to set compute_link_velocity to true in get_link_state()

conveniently returns the world velocity or an error if the velocity was not calculated for the LinkState. Be sure to set compute_link_velocity to true in get_link_state()

conveniently returns the world velocity vector (x,y,z,wx,w,wz) or an error if the velocity was not calculated for the LinkState. Be sure to set compute_link_velocity to true in get_link_state()

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.