Example to control Parrot Bebop2.
#include <iostream>
#include <visp3/core/vpTime.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/robot/vpRobotBebop2.h>
int main(int argc, char **argv)
{
#ifdef VISP_HAVE_ARSDK
try {
int stream_res = 0;
std::string ip_address = "192.168.42.1";
bool verbose = false;
for (int i = 1; i < argc; i++) {
if (std::string(argv[i]) == "--ip" && i + 1 < argc) {
ip_address = std::string(argv[i + 1]);
i++;
} else if (std::string(argv[i]) == "--hd_resolution") {
stream_res = 1;
} else if (std::string(argv[i]) == "--verbose" || std::string(argv[i]) == "-v") {
verbose = true;
} else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") {
std::cout << "\nUsage:\n"
<< " " << argv[0] << " [--ip <drone ip>] [--hd_resolution] [--verbose] [-v]"
<< " [--help] [-h]\n"
<< std::endl
<< "Description:\n"
<< " --ip <drone ip>\n"
<< " IP address of the drone to which you want to connect (default : 192.168.42.1).\n\n"
<< " --hd_resolution\n"
<< " Enables HD 720p video instead of default 480p.\n\n"
<< " --verbose, -v\n"
<< " Enables verbose (drone information messages are then displayed).\n\n"
<< "--help, -h\n"
<< " Print help message.\n\n"
<< std::endl;
return 0;
} else {
std::cout << "Error : unknown parameter " << argv[i] << std::endl
<< "See " << argv[0] << " --help" << std::endl;
return 0;
}
}
verbose, true, ip_address);
#ifdef VISP_HAVE_X11
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_OPENCV)
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
double delta_t = 0.040;
do {
} else {
std::cout << "Error : failed to setup drone control" << std::endl;
}
std::cout << "-- End of test --" << std::endl;
std::cout << "Caught an exception: " << e << std::endl;
}
#else
(void) argc;
(void) argv;
std::cout << "Install Parrot ARSDK, configure and build ViSP to use this example..." << std::endl;
#endif
}