libkovan  1
The kovan standard library
ardrone.hpp
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright 2013 KISS Institute for Practical Robotics *
3  * *
4  * This file is part of libkovan. *
5  * *
6  * libkovan 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  * *
11  * libkovan is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with libkovan. Check the LICENSE file in the project root. *
18  * If not, see <http://www.gnu.org/licenses/>. *
19  **************************************************************************/
20 
21 #ifndef _WIN32
22 
23 #ifndef _ARDRONE_HPP_
24 #define _ARDRONE_HPP_
25 
26 #include <opencv2/core/core.hpp>
27 #include <map>
28 #include <string>
29 
30 #include "camera.hpp"
31 #include "types.hpp"
32 
33 class DroneController;
34 
35 namespace Private
36 {
37  class ARDroneEmergencyStop;
38 }
39 
41 {
42 public:
43  enum State
44  {
45  Disconnected = 0,
47  Flying
48  };
49 
50  enum Camera
51  {
52  Off = 0,
54  Bottom
55  };
56 
57  enum Version
58  {
59  Unknown = 0,
60  V1,
61  V2
62  };
63 
65  {
66  uint32_t battery;
67 
68  float pitch;
69  float roll;
70  float yaw;
71 
72  float altitude;
73 
76  };
77 
78  ~ARDrone();
79 
80 
81  bool connect(const char *const ip = "192.168.1.1", const double timeout = 3.0);
82 
86  void disconnect();
87 
91  Version version() const;
92 
93  NavigationData navigationData() const;
94 
95  void clearPosition();
96 
102  void setSsid(const char *const ssid);
103 
104  void setActiveCamera(const Camera activeCamera);
105  Camera activeCamera() const;
106 
107  void flatTrim();
108  void takeoff();
109  void land();
110 
111  void setEmergencyStopEnabled(const bool emergencyStopEnabled);
112  bool isEmergencyStopEnabled() const;
113 
114  void setOwnerAddress(const char *const address);
115  void pair();
116 
121  void hover();
122 
123  void move(const float x, const float y, const float z, const float yaw);
124 
125  std::map<std::string, std::string> configuration() const;
126 
127  void rawImage(cv::Mat &image) const;
128 
129  ARDrone::State state() const;
130 
131  static ARDrone *instance();
132 
133 private:
134  ARDrone();
135  ARDrone(const ARDrone &);
136 
137  ARDrone &operator =(const ARDrone &rhs);
138 
139  DroneController *m_controller;
140  Private::ARDroneEmergencyStop *m_emergencyStop;
141  Camera m_activeCamera;
142 };
143 
144 namespace Camera
145 {
147  {
148  public:
150  virtual bool open(const int number);
151  virtual bool isOpen() const;
152  virtual void setWidth(const unsigned width);
153  virtual void setHeight(const unsigned height);
154  virtual bool next(cv::Mat &image);
155  virtual bool close();
156 
157  private:
158  bool m_opened;
159  };
160 }
161 
162 #endif
163 
164 #endif
uint32_t battery
Definition: ardrone.hpp:66
float yaw
Definition: ardrone.hpp:70
Definition: ardrone.hpp:40
Classes for working with the system camera.
State
Definition: ardrone.hpp:43
Definition: ardrone.hpp:60
float roll
Definition: ardrone.hpp:69
Vec3f position
Definition: ardrone.hpp:75
Definition: ardrone.hpp:146
Definition: ardrone.hpp:144
Definition: ardrone.hpp:53
float altitude
Definition: ardrone.hpp:72
Definition: ardrone.hpp:35
Vec3f velocity
Definition: ardrone.hpp:74
Definition: camera.hpp:182
Definition: ardrone.hpp:64
#define EXPORT_SYM
Definition: export.h:7
float pitch
Definition: ardrone.hpp:68
Version
Definition: ardrone.hpp:57
Definition: ardrone.hpp:46