Permalink
Browse files

Video is working with the AR.Drone!

  • Loading branch information...
bmcdorman committed Mar 19, 2013
1 parent ecc75e2 commit 2b82abe8b72f34713e6a2bad6e321745450433f9
Showing with 1,353 additions and 184 deletions.
  1. +5 −3 include/kovan/ardrone.hpp
  2. +58 −0 include/kovan/socket.hpp
  3. +286 −145 src/ardrone.cpp
  4. +49 −36 src/ardrone_constants_p.hpp
  5. +46 −0 src/bits_p.cpp
  6. +14 −0 src/bits_p.hpp
  7. +165 −0 src/socket.cpp
  8. +702 −0 src/uvlc_video_decoder_p.cpp
  9. +28 −0 src/uvlc_video_decoder_p.hpp
@@ -21,6 +21,8 @@
#ifndef _ARDRONE_HPP_
#define _ARDRONE_HPP_
+#include <opencv2/core/core.hpp>
+
class DroneController;
class ARDrone
@@ -35,7 +37,7 @@ class ARDrone
~ARDrone();
- bool connect(const char *ip = "192.168.1.1");
+ bool connect(const char *const ip = "192.168.1.1");
void disconnect();
void flatTrim();
@@ -45,6 +47,8 @@ class ARDrone
void hover();
void move(const float x, const float y, const float z, const float yaw);
+ cv::Mat video() const;
+
ARDrone::State state() const;
static ARDrone *instance();
@@ -53,8 +57,6 @@ class ARDrone
ARDrone();
DroneController *m_controller;
-
- int m_fd;
};
View
@@ -0,0 +1,58 @@
+#ifndef _SOCKET_HPP_
+#define _SOCKET_HPP_
+
+#include <netinet/in.h>
+
+typedef int socket_fd_t;
+
+struct sockaddr;
+
+class Address
+{
+public:
+ Address(const char *const host, const unsigned short port);
+ Address(const sockaddr_in &addr);
+ Address();
+
+ bool isValid() const;
+
+ bool setHost(const char *const host);
+ void setPort(const unsigned short port);
+
+ unsigned short port() const;
+
+ const sockaddr *addr() const;
+ socklen_t addrLength() const;
+
+private:
+ bool m_valid;
+ sockaddr_in m_addr;
+};
+
+class Socket
+{
+public:
+ Socket();
+
+ bool open(int domain, int type, int protocol);
+ bool isOpen() const;
+ bool setBlocking(const bool blocking);
+ bool setReusable(const bool reusable);
+ bool bind(const unsigned short port);
+ bool close();
+
+ ssize_t recv(void *buffer, const size_t length, int flags = 0);
+ ssize_t recvfrom(void *buffer, const size_t length, Address &address, int flags = 0);
+
+ ssize_t send(const void *const buffer, const size_t length, int flags = 0);
+ ssize_t sendto(const void *const buffer, const size_t length, const Address &dest, int flags = 0);
+
+ socket_fd_t fd() const;
+
+ static Socket udp();
+
+private:
+ socket_fd_t m_fd;
+};
+
+#endif
Oops, something went wrong.

0 comments on commit 2b82abe

Please sign in to comment.