37#include <visp3/core/vpConfig.h>
39#include <visp3/core/vpTime.h>
40#include <visp3/gui/vpDisplayX.h>
41#include <visp3/io/vpKeyboard.h>
43#include <visp3/robot/vpRobotBebop2.h>
49#ifdef ENABLE_VISP_NAMESPACE
151int main(
int argc,
char **argv)
155 std::string ip_address =
"192.168.42.1";
159 bool verbose =
false;
161 for (
int i = 1;
i < argc;
i++) {
162 if (std::string(argv[i]) ==
"--ip" && i + 1 < argc) {
163 ip_address = std::string(argv[i + 1]);
166 else if (std::string(argv[i]) ==
"--hd_stream") {
169 else if (std::string(argv[i]) ==
"--verbose" || std::string(argv[i]) ==
"-v") {
172 else if (argc >= 2 && (std::string(argv[1]) ==
"--help" || std::string(argv[1]) ==
"-h")) {
173 std::cout <<
"\nUsage:\n"
174 <<
" " << argv[0] <<
"[--ip <drone ip>] [--hd_stream] [--verbose] [-v] [--help] [-h]\n"
177 <<
" --ip <drone ip>\n"
178 <<
" Ip address of the drone to which you want to connect (default : 192.168.42.1).\n\n"
180 <<
" Enables HD 720p streaming instead of default 480p.\n"
181 <<
" --verbose, -v\n"
182 <<
" Enables verbose (drone information messages and velocity commands\n"
183 <<
" are then displayed).\n\n"
185 <<
" Print help message.\n"
190 std::cout <<
"Error : unknown parameter " << argv[
i] << std::endl
191 <<
"See " << argv[0] <<
" --help" << std::endl;
196 std::cout <<
"\nWARNING: this program does no sensing or avoiding of obstacles, "
197 "the drone WILL collide with any objects in the way! Make sure the "
198 "drone has approximately 3 meters of free space on all sides.\n"
209 std::cout <<
"\nConfiguring drone settings ...\n" << std::endl;
215#ifdef VISP_HAVE_FFMPEG
218 std::cout <<
"\nWaiting for streaming to start ...\n" << std::endl;
224 vpDisplayX display(I, 100, 100,
"DRONE VIEW");
230 std::cout <<
"\n| Control the drone with the keyboard :\n"
231 "| 't' to takeoff / spacebar to land / 'e' for emergency stop\n"
232 "| ('r','f','d','g') and ('i','k','j','l') to move\n"
239 if (keyboard.
kbhit()) {
242 running = handleKeyboardInput(drone, k);
244#ifdef VISP_HAVE_FFMPEG
251 std::cout <<
"\nQuitting ...\n" << std::endl;
255 std::cout <<
"ERROR : failed to setup drone control." << std::endl;
260 std::cout <<
"\nCaught an exception: " <<
e << std::endl;
269 std::cout <<
"\nThis example requires Parrot ARSDK3 library. You should install it.\n" << std::endl;
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
error that can be emitted by ViSP classes.
Definition of the vpImage class member functions.
Keyboard management under unix (Linux or OSX). This class is not available under windows.
void setMaxTilt(double maxTilt)
void setVerticalSpeed(int value)
void setStreamingMode(int mode)
void getRGBaImage(vpImage< vpRGBa > &I)
void setYawSpeed(int value)
void takeOff(bool blocking=true)
void setVideoResolution(int mode)
VISP_EXPORT int wait(double t0, double t)