43 #include <visp3/robot/vpRobotFranka.h> 44 #include <visp3/core/vpIoTools.h> 46 #if defined(VISP_HAVE_FRANKA) 48 int main(
int argc,
char **argv)
50 std::string opt_robot_ip =
"192.168.1.1";
51 std::string opt_position_filename =
"";
53 for (
int i = 1; i < argc; i++) {
54 if (std::string(argv[i]) ==
"--ip" && i + 1 < argc) {
55 opt_robot_ip = std::string(argv[i + 1]);
57 else if (std::string(argv[i]) ==
"--read" && i + 1 < argc) {
58 opt_position_filename = std::string(argv[i + 1]);
60 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
61 std::cout <<
"Move Panda robot to a position specified from a file." << std::endl;
62 std::cout << argv[0] <<
" [--ip <default " << opt_robot_ip <<
">] [--read <position file name>] [--help] [-h]\n" << std::endl;
63 std::cout <<
"Example:\n" << argv[0] <<
" --ip 192.168.100.1 --read position.pos\n" << std::endl;
69 if (opt_position_filename.empty()) {
70 std::cout <<
"\nError: no position file given as input with --read option. " << std::endl;
71 std::cout <<
"Call \"" << argv[0] <<
" --help\" to get usage" << std::endl;
75 std::cout <<
"\nError: position filename \"" << opt_position_filename <<
"\" given as input doesn't exist. " << std::endl;
76 std::cout <<
"Call \"" << argv[0] <<
" --help\" to get usage" << std::endl;
85 robot.
move(opt_position_filename);
88 std::cout <<
"ViSP exception: " << e.
what() << std::endl;
89 std::cout <<
"Stop the robot " << std::endl;
93 catch(
const franka::NetworkException &e) {
94 std::cout <<
"Franka network exception: " << e.what() << std::endl;
95 std::cout <<
"Check if you are connected to the Franka robot" 96 <<
" or if you specified the right IP using --ip command line option set by default to 192.168.1.1. " << std::endl;
99 catch(
const std::exception &e) {
100 std::cout <<
"Franka exception: " << e.what() << std::endl;
109 #if !defined(VISP_HAVE_FRANKA) 110 std::cout <<
"Install libfranka." << std::endl;
vpRobot::vpRobotStateType setRobotState(vpRobot::vpRobotStateType newState)
error that can be emited by ViSP classes.
const char * what() const
void move(const std::string &filename, double velocity_percentage=10.)
void connect(const std::string &franka_address, franka::RealtimeConfig realtime_config=franka::RealtimeConfig::kEnforce)