40 #include <visp3/core/vpConfig.h> 42 #include <visp3/core/vpTime.h> 43 #include <visp3/gui/vpDisplayX.h> 44 #include <visp3/io/vpKeyboard.h> 46 #include <visp3/robot/vpRobotBebop2.h> 50 #ifdef VISP_HAVE_ARSDK 149 int main(
int argc,
char **argv)
153 std::string ip_address =
"192.168.42.1";
157 bool verbose =
false;
159 for (
int i = 1; i < argc; i++) {
160 if (std::string(argv[i]) ==
"--ip" && i + 1 < argc) {
161 ip_address = std::string(argv[i + 1]);
163 }
else if (std::string(argv[i]) ==
"--hd_stream") {
165 }
else if (std::string(argv[i]) ==
"--verbose" || std::string(argv[i]) ==
"-v") {
167 }
else if (argc >= 2 && (std::string(argv[1]) ==
"--help" || std::string(argv[1]) ==
"-h")) {
168 std::cout <<
"\nUsage:\n" 169 <<
" " << argv[0] <<
"[--ip <drone ip>] [--hd_stream] [--verbose] [-v] [--help] [-h]\n" 172 <<
" --ip <drone ip>\n" 173 <<
" Ip address of the drone to which you want to connect (default : 192.168.42.1).\n\n" 175 <<
" Enables HD 720p streaming instead of default 480p.\n" 176 <<
" --verbose, -v\n" 177 <<
" Enables verbose (drone information messages and velocity commands\n" 178 <<
" are then displayed).\n\n" 180 <<
" Print help message.\n" 184 std::cout <<
"Error : unknown parameter " << argv[i] << std::endl
185 <<
"See " << argv[0] <<
" --help" << std::endl;
190 std::cout <<
"\nWARNING: this program does no sensing or avoiding of obstacles, " 191 "the drone WILL collide with any objects in the way! Make sure the " 192 "drone has approximately 3 meters of free space on all sides.\n" 203 std::cout <<
"\nConfiguring drone settings ...\n" << std::endl;
209 #ifdef VISP_HAVE_FFMPEG 212 std::cout <<
"\nWaiting for streaming to start ...\n" << std::endl;
218 vpDisplayX display(I, 100, 100,
"DRONE VIEW");
224 std::cout <<
"\n| Control the drone with the keyboard :\n" 225 "| 't' to takeoff / spacebar to land / 'e' for emergency stop\n" 226 "| ('r','f','d','g') and ('i','k','j','l') to move\n" 233 if (keyboard.
kbhit()) {
236 running = handleKeyboardInput(drone, k);
238 #ifdef VISP_HAVE_FFMPEG 245 std::cout <<
"\nQuitting ...\n" << std::endl;
248 std::cout <<
"ERROR : failed to setup drone control." << std::endl;
252 std::cout <<
"\nCaught an exception: " << e << std::endl;
261 std::cout <<
"\nThis example requires Parrot ARSDK3 library. You should install it.\n" << std::endl;
265 #endif // #if defined(VISP_HAVE_ARSDK) VISP_EXPORT int wait(double t0, double t)
Keybord management under unix (Linux or OSX). This class is not available under windows.
void getRGBaImage(vpImage< vpRGBa > &I)
void setYawSpeed(int value)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
error that can be emited by ViSP classes.
static void flush(const vpImage< unsigned char > &I)
static void display(const vpImage< unsigned char > &I)
void setVerticalSpeed(int value)
void setVideoResolution(int mode)
void setMaxTilt(double maxTilt)
void setStreamingMode(int mode)
void takeOff(bool blocking=true)