46 #include <visp3/core/vpConfig.h>
49 #if defined(VISP_HAVE_MAVSDK) && ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))) \
50 && defined(VISP_HAVE_THREADS)
53 #include <visp3/robot/vpRobotMavsdk.h>
55 using std::chrono::seconds;
56 using std::this_thread::sleep_for;
58 void usage(
const std::string &bin_name)
60 std::cerr <<
"Usage : " << bin_name <<
" <connection information>\n"
61 <<
"Connection URL format should be :\n"
62 <<
" - For TCP : tcp://[server_host][:server_port]\n"
63 <<
" - For UDP : udp://[bind_host][:bind_port]\n"
64 <<
" - For Serial : serial:///path/to/serial/dev[:baudrate]\n"
65 <<
"For example, to connect to the simulator use URL: udp://:14540\n";
68 int main(
int argc,
char **argv)
70 #ifdef ENABLE_VISP_NAMESPACE
78 auto robot = vpRobotMavsdk(argv[1]);
80 if (!robot.setGPSGlobalOrigin(48.117266, -1.6777926, 40.0)) {
84 std::cout <<
"Vehicle has flying capability: " << (robot.hasFlyingCapability() ?
"yes" :
"no") << std::endl;
87 double delta_north = 1.;
88 double delta_east = 0.;
89 double delta_down = 0.;
90 double delta_yaw = 0.;
92 std::cout <<
"Move 1 meter north" << std::endl;;
93 robot.setPositionRelative(delta_north, delta_east, delta_down, delta_yaw);
99 std::cout <<
"Go at 0.3m/s backward during 3 sec.\n";
103 std::cout <<
"Go at 0.3m/s forward and rotate 10 deg/s along yaw during 2 sec.\n";
121 #ifndef VISP_HAVE_MAVSDK
122 std::cout <<
"\nThis example requires mavsdk library. You should install it, configure and rebuild ViSP.\n"
125 #if !((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
127 <<
"\nThis example requires at least cxx17. You should enable cxx17 during ViSP configuration with cmake and "
Implementation of column vector and the associated operations.
static double rad(double deg)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
VISP_EXPORT int wait(double t0, double t)
VISP_EXPORT void sleepMs(double t)
VISP_EXPORT double measureTimeMs()