Enum Robot

Source
pub enum Robot {
    Sim(FrankaSim),
    Real(FrankaReal),
}
Expand description

An abstraction over a robot. Can either be a real robot or a robot in the simulation.

Variants§

Implementations§

Source§

impl Robot

Source

pub fn set_angular_damping(&mut self, damping: f64)

sets the angular damping for a simulated robot

Source

pub fn set_joint_friction_force(&mut self, force: f64)

sets the static friction (“stiction”) for a simulated robot for torque control.

Source

pub fn joint_motion(&mut self, speed_factor: f64, q_goal: Vector7)

point to point motion in joint space.

§Arguments
  • speed_factor - General speed factor in range [0, 1].
  • q_goal - Target joint positions.
Source

pub fn control_joint_positions<F: FnMut(&RobotState, &Duration) -> JointPositions>( &mut self, control_callback: F, )

Starts a control loop for a joint position motion generator

§Example
    let mut initial_joint_positions = Vector7::zeros();
    let mut time = 0.;
    robot.control_joint_positions(|state, time_step| {
        time += time_step.as_secs_f64();
        if time == 0. {
            initial_joint_positions = state.joint_positions;
        }
        let mut out = JointPositions::from(initial_joint_positions);
        let delta_angle = PI / 8. * (1. - f64::cos(PI / 2.5 * time));
        out.joint_positions[3] += delta_angle;
        out.joint_positions[4] += delta_angle;
        out.joint_positions[6] += delta_angle;
        if time >= 5.0 {
            println!("Finished motion, shutting down example");
            out.is_finished = true;
        }
        out
    })
Source

pub fn control_torques<F: FnMut(&RobotState, &Duration) -> Torques>( &mut self, control_callback: F, )

Starts a control loop for sending joint-level torque commands

§Example
    let mut time = 0.;
    let mut rotation_force: f64 = 0.01;
    robot.control_torques(|state, time_step| {
        time += time_step.as_secs_f64();
        if state.joint_positions[6] > PI / 4. + 0.1 && rotation_force.is_sign_positive() {
            rotation_force *= -1.;
        }
        if state.joint_positions[6] < PI / 4. - 0.1 && rotation_force.is_sign_negative() {
            rotation_force *= -1.;
        }
        let mut torques = Torques::from(Vector7::from_column_slice(&[
            0.,
            0.,
            0.,
            0.,
            0.,
            0.,
            rotation_force,
        ]));
        if time > 10. {
            torques.is_finished = true;
        }
        torques
    });
Source

pub fn control_cartesian_pose<F: FnMut(&RobotState, &Duration) -> CartesianPose>( &mut self, control_callback: F, )

Starts a control loop for a Cartesian pose motion generator

§Example
    let mut time = 0.;
    let mut initial_pose = CartesianPose::from(Isometry3::identity());
    robot.control_cartesian_pose(|state, time_step| {
        time += time_step.as_secs_f64();
        if time == 0. {
            initial_pose.pose = state.end_effector_pose;
        }
        let radius = 0.3;
        let angle = PI / 4. * (1. - f64::cos(PI / 5. * time));
        let delta_x = radius * f64::sin(angle);
        let delta_z = radius * (f64::cos(angle) - 1.);

        let mut out = CartesianPose::from(initial_pose.pose);
        out.pose.translation.x += delta_x;
        out.pose.translation.z += delta_z;
        if time > 10. {
            out.is_finished = true;
        }
        out
    });
Source

pub fn open_gripper(&mut self, width: f64)

opens the gripper

§Arguments
  • width - opening width in meter
Source

pub fn close_gripper(&mut self)

closes the gripper

Source

pub fn get_state(&mut self) -> RobotState

queries the robot state

Source

pub fn get_gripper_state(&mut self) -> GripperState

queries the gripper state

Source

pub fn get_jacobian(&mut self) -> Matrix6x7

queries the current space jacobian

Auto Trait Implementations§

§

impl !Freeze for Robot

§

impl !RefUnwindSafe for Robot

§

impl !Send for Robot

§

impl !Sync for Robot

§

impl Unpin for Robot

§

impl !UnwindSafe for Robot

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

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

Source§

fn vzip(self) -> V