43 #include <visp3/robot/vpRobotFranka.h> 45 #if defined(VISP_HAVE_FRANKA) 47 int main(
int argc,
char **argv)
49 std::string opt_robot_ip =
"192.168.1.1";
50 std::string opt_position_filename =
"position.pos";
52 for (
int i = 1; i < argc; i++) {
53 if (std::string(argv[i]) ==
"--ip" && i + 1 < argc) {
54 opt_robot_ip = std::string(argv[i + 1]);
56 else if (std::string(argv[i]) ==
"--save" && i + 1 < argc) {
57 opt_position_filename = std::string(argv[i + 1]);
59 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
60 std::cout <<
"Save Panda robot position in a file." << std::endl;
61 std::cout <<
"Usage:\n" << std::endl;
62 std::cout << argv[0] <<
" [--ip <default " << opt_robot_ip <<
">] [--save <position file name>] [--help] [-h]\n" << std::endl;
63 std::cout <<
"Example:\n" << argv[0] <<
" --ip 192.168.100.1 --save position.pos\n" << std::endl;
78 std::cout <<
"Robot position saved in \"" << opt_position_filename <<
"\""<< std::endl;
81 std::cout <<
"ViSP exception: " << e.
what() << std::endl;
82 std::cout <<
"Stop the robot " << std::endl;
86 catch(
const franka::NetworkException &e) {
87 std::cout <<
"Franka network exception: " << e.what() << std::endl;
88 std::cout <<
"Check if you are connected to the Franka robot" 89 <<
" or if you specified the right IP using --ip command line option set by default to 192.168.1.1. " << std::endl;
92 catch(
const std::exception &e) {
93 std::cout <<
"Franka exception: " << e.what() << std::endl;
102 #if !defined(VISP_HAVE_FRANKA) 103 std::cout <<
"Install libfranka." << std::endl;
vpRobot::vpRobotStateType setRobotState(vpRobot::vpRobotStateType newState)
bool savePosFile(const std::string &filename, const vpColVector &q)
error that can be emited by ViSP classes.
const char * what() const
Implementation of column vector and the associated operations.
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)
void connect(const std::string &franka_address, franka::RealtimeConfig realtime_config=franka::RealtimeConfig::kEnforce)