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

Sim(FrankaSim)

Real(FrankaReal)

Implementations

sets the angular damping for a simulated robot

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

point to point motion in joint space.

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

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
    })

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
    });

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
    });

opens the gripper

Arguments
  • width - opening width in meter

closes the gripper

queries the robot state

queries the gripper state

queries the current space jacobian

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.