pub struct Experiment<Sim: ?Sized + SimulationSetup, Real: ?Sized + RealSetup> {
    pub environment: FrankaEnvironment,
    pub sim_setup: Box<Sim>,
    pub real_setup: Box<Real>,
}
Expand description

Use it to create a new experiment which can either run on the real robot or in the simulation.

Use new to create an experiment and then use new_robot to create a new robot.

Fields

environment: FrankaEnvironmentsim_setup: Box<Sim>real_setup: Box<Real>

Implementations

Use it to create a new experiment which can either run on the real robot or in the simulation

Arguments
  • mode - specify whether to run the experiment in simulation or with a real robot
  • sim_setup - something that implements SimulationSetup.
  • real_setup - something that implements RealSetup.
Example
use franka_interface::experiment::{Experiment, Mode, RealSetup, SimulationSetup};
use franka_interface::types::Vector7;
use franka_interface::RobotArguments;
use std::f64::consts::PI;
use std::path::PathBuf;
struct MySimSetup {}
impl SimulationSetup for MySimSetup {
    fn set_franka_urdf_path(&self) -> PathBuf {
        "path/to/panda.urdf".into()
    }
}
struct MyRealSetup {}
impl RealSetup for MyRealSetup {}
let mut env = Experiment::new(Mode::Simulation, MySimSetup {}, MyRealSetup {});
let mut robot = env.new_robot(RobotArguments {
    hostname: "franka".to_string(),
    base_pose: None,
    initial_config: None,
});
robot.joint_motion(
    0.1,
    Vector7::from_column_slice(&[1., PI / 4., 0., -2. * PI / 4., 0., PI / 2., -PI / 4.]),
);
println!("{:?}", robot.get_state());

returns the current image from the robot. Make sure you implemented get_camera_image in your RealSetup and SimulationSetup.

spawns/connects to a new robot using the RobotArguments

Query whether the current experiment is run in simulation

allows accessing the PhysicsClient in Simulation by defining a closure that takes the PhysicsClient as input. Nothing will happen if the experiment is not run in the simulation

Return
  • In the simulation it will return Some(T) where T is the return type of the client_cb
  • Will return None when not executed with the simulation.

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.