use franka_interface::experiment::{Experiment, Mode, RealSetup, SimulationSetup};
use franka_interface::RobotArguments;
use std::f64::consts::PI;
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
#[structopt(name = "hello_world")]
enum CommandLineArguments {
Real {
#[structopt()]
ip: String,
},
Simulation {
#[structopt(parse(from_os_str))]
urdf_path: PathBuf,
},
}
struct MySimSetup {
pub path: PathBuf,
}
impl SimulationSetup for MySimSetup {
fn set_franka_urdf_path(&self) -> PathBuf {
self.path.clone()
}
}
struct MyRealSetup {}
impl RealSetup for MyRealSetup {}
fn main() {
let args: CommandLineArguments = CommandLineArguments::from_args();
let mode;
let mut hostname = String::new();
let mut path = PathBuf::new();
match args {
CommandLineArguments::Real { ip } => {
mode = Mode::Real;
hostname = ip
}
CommandLineArguments::Simulation { urdf_path } => {
mode = Mode::Simulation;
path = urdf_path
}
};
let mut experiment = Experiment::new(mode, MySimSetup { path }, MyRealSetup {});
let mut robot = experiment.new_robot(RobotArguments {
hostname,
base_pose: None,
initial_config: None,
});
robot.joint_motion(
0.1,
[1., PI / 4., 0., -2. * PI / 4., 0., PI / 2., -PI / 4.].into(),
);
}