summaryrefslogtreecommitdiff
path: root/lib.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-04-16 18:25:34 +0200
committerFlorian Jung <flo@windfisch.org>2015-04-16 18:25:34 +0200
commitc065db1f08e41646fd37ea34823f7768e6904bd0 (patch)
treeb4542e62d2b475bc90a660d1ea9ce9e9ac8b94cd /lib.cpp
parentf303c0d49e3e3e5089052d797f3ab2e821c01636 (diff)
simple rotation commands
Diffstat (limited to 'lib.cpp')
-rw-r--r--lib.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib.cpp b/lib.cpp
index 2b4ddd4..baed909 100644
--- a/lib.cpp
+++ b/lib.cpp
@@ -96,3 +96,17 @@ void DroneConnection::get(Mat& frame, navdata_t* nav)
frame = Mat(720,1280,CV_8UC3, buffer);
}
+
+void DroneConnection::fly(float x, float y, float z, float rot)
+{
+ char buf[100];
+ int len = snprintf(buf, sizeof(buf), "fly %f %f %f %f\n", x,y,z,rot);
+ if (len >= sizeof(buf)-1)
+ {
+ printf("ERROR: buffer too small in DroneConnection::fly()!\n");
+ return;
+ }
+ printf("%s\n",buf);
+
+ write(sockfd, buf, len);
+}