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