39 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpTime.h>
42 #include <visp3/gui/vpDisplayX.h>
43 #include <visp3/io/vpKeyboard.h>
45 #include <visp3/robot/vpRobotBebop2.h>
49 #ifdef VISP_HAVE_ARSDK
51 #ifdef ENABLE_VISP_NAMESPACE
153 int main(
int argc,
char **argv)
157 std::string ip_address =
"192.168.42.1";
161 bool verbose =
false;
163 for (
int i = 1; i < argc; i++) {
164 if (std::string(argv[i]) ==
"--ip" && i + 1 < argc) {
165 ip_address = std::string(argv[i + 1]);
168 else if (std::string(argv[i]) ==
"--hd_stream") {
171 else if (std::string(argv[i]) ==
"--verbose" || std::string(argv[i]) ==
"-v") {
174 else if (argc >= 2 && (std::string(argv[1]) ==
"--help" || std::string(argv[1]) ==
"-h")) {
175 std::cout <<
"\nUsage:\n"
176 <<
" " << argv[0] <<
"[--ip <drone ip>] [--hd_stream] [--verbose] [-v] [--help] [-h]\n"
179 <<
" --ip <drone ip>\n"
180 <<
" Ip address of the drone to which you want to connect (default : 192.168.42.1).\n\n"
182 <<
" Enables HD 720p streaming instead of default 480p.\n"
183 <<
" --verbose, -v\n"
184 <<
" Enables verbose (drone information messages and velocity commands\n"
185 <<
" are then displayed).\n\n"
187 <<
" Print help message.\n"
192 std::cout <<
"Error : unknown parameter " << argv[i] << std::endl
193 <<
"See " << argv[0] <<
" --help" << std::endl;
198 std::cout <<
"\nWARNING: this program does no sensing or avoiding of obstacles, "
199 "the drone WILL collide with any objects in the way! Make sure the "
200 "drone has approximately 3 meters of free space on all sides.\n"
211 std::cout <<
"\nConfiguring drone settings ...\n" << std::endl;
217 #ifdef VISP_HAVE_FFMPEG
220 std::cout <<
"\nWaiting for streaming to start ...\n" << std::endl;
226 vpDisplayX display(I, 100, 100,
"DRONE VIEW");
232 std::cout <<
"\n| Control the drone with the keyboard :\n"
233 "| 't' to takeoff / spacebar to land / 'e' for emergency stop\n"
234 "| ('r','f','d','g') and ('i','k','j','l') to move\n"
241 if (keyboard.
kbhit()) {
244 running = handleKeyboardInput(drone, k);
246 #ifdef VISP_HAVE_FFMPEG
253 std::cout <<
"\nQuitting ...\n" << std::endl;
257 std::cout <<
"ERROR : failed to setup drone control." << std::endl;
262 std::cout <<
"\nCaught an exception: " << e << std::endl;
271 std::cout <<
"\nThis example requires Parrot ARSDK3 library. You should install it.\n" << std::endl;
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.
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)