Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpRobotMavsdk.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See https://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Interface to mavlink compatible controller using mavsdk 3rd party
33 *
34*****************************************************************************/
35
36#ifndef vpRobotMavsdk_h_
37#define vpRobotMavsdk_h_
38
39#include <visp3/core/vpConfig.h>
40
41#if defined(VISP_HAVE_MAVSDK) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_17)
42
43#include <future>
44#include <mutex>
45#include <signal.h>
46#include <string>
47#include <tuple>
48
49#include <visp3/core/vpHomogeneousMatrix.h>
50
89class VISP_EXPORT vpRobotMavsdk
90{
91public:
93 vpRobotMavsdk(const std::string &connection_info);
94 virtual ~vpRobotMavsdk();
95
97
98 void connect(const std::string &connection_info);
100
102
103 float getBatteryLevel() const;
104 void getPosition(float &ned_north, float &ned_east, float &ned_down, float &ned_yaw) const;
105 void getPosition(vpHomogeneousMatrix &ned_M_frd) const;
106 std::tuple<float, float> getHome() const;
107 std::string getAddress() const;
108 bool isRunning() const;
110
112
113 bool arm();
114 bool disarm();
115 void doFlatTrim();
116 bool hasFlyingCapability();
117 bool holdPosition();
118 bool kill();
119 bool land();
120 bool releaseControl();
121 bool sendMocapData(const vpHomogeneousMatrix &enu_M_flu, int display_fps = 1);
122 void setAutoLand(bool auto_land);
123 bool setForwardSpeed(double body_frd_vx);
124 bool setLateralSpeed(double body_frd_vy);
125 bool setGPSGlobalOrigin(double latitude, double longitude, double altitude);
126 void setPositioningIncertitude(float position_incertitude, float yaw_incertitude);
127 bool setPosition(float ned_north, float ned_east, float ned_down, float ned_yaw, bool blocking = true,
128 int timeout_sec = 10);
129 bool setPosition(const vpHomogeneousMatrix &ned_M_frd, bool blocking = true, int timeout_sec = 10);
130 bool setPositionRelative(float ned_delta_north, float ned_delta_east, float ned_delta_down, float ned_delta_yaw,
131 bool blocking = true, int timeout_sec = 10);
132 bool setPositionRelative(const vpHomogeneousMatrix &delta_frd_M_frd, bool blocking = true, int timeout_sec = 10);
133 bool setVelocity(const vpColVector &frd_vel_cmd);
134 bool setVerticalSpeed(double body_frd_vz);
135 bool setYawSpeed(double body_frd_wz);
136 void setTakeOffAlt(double altitude);
137 void setVerbose(bool verbose);
138 bool stopMoving();
139 bool takeControl();
140 bool takeOff(bool interactive = true, int timeout_sec = 10, bool use_gps = false);
141 bool takeOff(bool interactive, double takeoff_altitude, int timeout_sec = 10, bool use_gps = false);
143
144private:
145 //*** Setup functions ***//
146 void cleanUp();
147 void createDroneController();
148 void setupCallbacks();
149 void startController();
150
151 vpRobotMavsdk(const vpRobotMavsdk &); // noncopyable
152 vpRobotMavsdk &operator=(const vpRobotMavsdk &); //
153
154 class vpRobotMavsdkImpl;
155 vpRobotMavsdkImpl *m_impl;
156};
157
158#endif // #ifdef VISP_HAVE_MAVSDK
159#endif // #ifndef vpRobotMavsdk_h_
Implementation of column vector and the associated operations.
Implementation of an homogeneous matrix and operations on such kind of matrices.