From: Kate Alhola Date: Fri, 17 Feb 2012 10:00:39 +0000 (+0200) Subject: Sync refactoring for multiple platforms X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;ds=sidebyside;h=f19da612ad0dd01a6f6339386625ce2bdc259220;p=mardrone Sync refactoring for multiple platforms --- diff --git a/mardrone/CalibrateDialog.qml b/mardrone/CalibrateDialog.qml index c824c34..96903b1 100644 --- a/mardrone/CalibrateDialog.qml +++ b/mardrone/CalibrateDialog.qml @@ -1,5 +1,4 @@ import QtQuick 1.0 - import com.nokia.meego 1.0 Page { property color textColor:"black" diff --git a/mardrone/ConfigDialogDesktop.qml b/mardrone/ConfigDialogDesktop.qml index 0dd03a5..3c84204 100644 --- a/mardrone/ConfigDialogDesktop.qml +++ b/mardrone/ConfigDialogDesktop.qml @@ -2,16 +2,20 @@ import QtQuick 1.0 import QtDesktop 0.1 Rectangle { - property int textSize:12 + property int textSize:20 + property color textColor:"black" id:dialog + CalibrateDialogDesktop { + id:joyStickCalibrator + } anchors.fill: parent - Flickable { - id: dialogscrolarea + TabFrame { + Tab { + title: "Display" + id: displayTab anchors.fill: parent // anchors.leftMargin:50;anchors.rightMargin:50 - contentHeight: dialogcontent.height - contentWidth: parent.width Grid { columns:2 @@ -19,12 +23,12 @@ Rectangle { anchors.leftMargin:50;anchors.rightMargin:50 spacing: 20 - Text { +/* Text { font.pixelSize :textSize text:"UI Style" } - ComboBox { + ComboBox { id: activeUICombo; model: ListModel { id: choices @@ -32,14 +36,14 @@ Rectangle { ListElement { text: "Desktop";file:"ardrone_desktop.qml" } } onSelectedIndexChanged: { - console.debug(selectedText + ", " + choices.get(selectedIndex).file); + console.debug("onSelectedIndexChanged " + selectedText + ", " + choices.get(selectedIndex).file); drone.confActiveUI=choices.get(selectedIndex).file } - + selectedText:drone.confActiveUI KeyNavigation.tab: t1 KeyNavigation.backtab: button2 } - +*/ Text { width:200 text: "Drone IP" @@ -70,30 +74,7 @@ Rectangle { onCheckedChanged:{drone.confFullScreen=checked;} } Text { - text: "Acceleration Sensor for controll" - color:textColor - font.pixelSize :textSize - } - CheckBox { - id: useAccelSw - checked:drone.confUseAccel - anchors.right:parent.right - onCheckedChanged:{drone.confUseAccel=checked;} - } - Text { - text: "Joystick for controll" - color:textColor - font.pixelSize :textSize - } - CheckBox { - id: useJoySw - checked:drone.confUseJoyStick - anchors.right:parent.right - enabled:drone.confHaveJoyStick - onCheckedChanged:{drone.confUseJoyStick=checked;} - } - Text { - color:textColor + color:textColor text: "Show debug" font.pixelSize :textSize } @@ -106,7 +87,7 @@ Rectangle { Text { text: "Show engine gauges" - color:textColor + color:textColor font.pixelSize :textSize } @@ -119,7 +100,7 @@ Rectangle { Text { text: "Show horizon" - color:textColor + color:textColor font.pixelSize :textSize } @@ -129,6 +110,68 @@ Rectangle { anchors.right:parent.right onCheckedChanged:{drone.confShowHorizon=checked;} } + } // Grid + } // tab + Tab { + title: "Control" + Grid { + columns:2 + anchors.leftMargin:50;anchors.rightMargin:50 + spacing: 20 + Text { + text: "Acceleration Sensor for controll" + color:textColor + font.pixelSize :textSize + } + CheckBox { + id: useAccelSw + checked:drone.confUseAccel + anchors.right:parent.right + onCheckedChanged:{drone.confUseAccel=checked;} + } + + Text { + text: "Joystick" + color:textColor + font.pixelSize :textSize + } + CheckBox { + id: useJoySw + checked:drone.confUseJoyStick + anchors.right:parent.right + enabled:js.haveJoyStick + onCheckedChanged:{drone.confUseJoyStick=checked;} + } + + Text { + visible:drone.confUseJoyStick + font.pixelSize :textSize + text:"\"" + js.joyStickName + "\"" + + } + Button { + visible:drone.confUseJoyStick + text:"Calibrate" + anchors.right:parent.right + onClicked:{ joyStickCalibrator.visible = true; + js.calibrate=true + } + } + Text { + visible:drone.confUseJoyStick + font.pixelSize :textSize + text:"Show JoyStick Indicators" + + } + CheckBox { + visible:drone.confUseJoyStick + checked:drone.confShowJSIndicators + anchors.right:parent.right + enabled:js.haveJoyStick + onCheckedChanged:{drone.confShowJSIndicators=checked;} + + } + Text { text: "Forward/backward gain" @@ -173,4 +216,5 @@ Rectangle { } } } + } } diff --git a/mardrone/JoyStickCalibrator.qml b/mardrone/JoyStickCalibrator.qml index 5afcd6b..ecae2e7 100644 --- a/mardrone/JoyStickCalibrator.qml +++ b/mardrone/JoyStickCalibrator.qml @@ -7,6 +7,7 @@ Item { height: 800 property int textSize:22 property int ctrlSize:40 + // JoyStick:js Menu { id:js1map visualParent:pageStack diff --git a/mardrone/JoyStickTouch.qml b/mardrone/JoyStickTouch.qml index 7599c98..6b07587 100644 --- a/mardrone/JoyStickTouch.qml +++ b/mardrone/JoyStickTouch.qml @@ -12,18 +12,12 @@ Item { width: 200 height: 200 - Rectangle { - id:knob - x:parent.width/2-width/2 - y:parent.width/2-height/2 - width:20; - height:20; Image { - anchors.centerIn:parent - id: knobimage + id:knob + x:parent.width/2-width/2 + y:parent.width/2-height/2 source: "joyknob.png" } - } TouchArea { id: joyarea @@ -43,9 +37,9 @@ Item { onTouchMove: { // console.log("TouchArea:ontouchMove " + joyarea.changedTouches.length); var touch = joyarea.changedTouches[0]; - // console.log("touchMove",touch.id," at ",touch.y,touch.x); - knob.x=touch.x; - knob.y=touch.y; + // console.log("touchMove",touch.id," at ",touch.y,touch.x); + if((touch.x0)) knob.x=touch.x; + if((touch.y0))knob.y=touch.y; } onTouchEnd: { diff --git a/mardrone/Makefile b/mardrone/Makefile index 620a705..18c176f 100644 --- a/mardrone/Makefile +++ b/mardrone/Makefile @@ -1,25 +1,25 @@ ############################################################################# # Makefile for building: mardrone -# Generated by qmake (2.01a) (Qt 4.7.0) on: Wed Jan 5 16:02:29 2011 +# Generated by qmake (2.01a) (Qt 4.7.4) on: Wed Jan 25 14:08:11 2012 # Project: mardrone.pro # Template: app -# Command: /usr/bin/qmake -o Makefile mardrone.pro +# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -o Makefile mardrone.pro ############################################################################# ####### Compiler, tools and options CC = gcc CXX = g++ -DEFINES = -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -CFLAGS = -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT $(DEFINES) -CXXFLAGS = -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT $(DEFINES) -INCPATH = -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtNetwork -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include/QtDeclarative -I/targets/FREMANTLE_ARMEL/usr/include -I/targets/FREMANTLE_ARMEL/usr/include/QtSensors -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib/Soft/Common -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib/VP_SDK -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib/VP_SDK/VP_Os/linux -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib/VP_SDK/VP_Os -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib/Soft/Lib -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib/VLIB -I../../../../ARDrone_SDK_1_5_Version_20101004/ARDroneLib -I/targets/FREMANTLE_ARMEL/usr/include -I. +DEFINES = -DQT_WEBKIT -DHAVE_SDL -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtDeclarative -I/usr/include/qt4 -Idronelib -Igauges -IARDrone_SDK_Version_1_8_20110726/ARDroneLib/Soft/Common -IARDrone_SDK_Version_1_8_20110726/ARDroneLib/VP_SDK -IARDrone_SDK_Version_1_8_20110726/ARDroneLib/VP_SDK/VP_Os/linux -IARDrone_SDK_Version_1_8_20110726/ARDroneLib/VP_SDK/VP_Os -IARDrone_SDK_Version_1_8_20110726/ARDroneLib/Soft/Lib -IARDrone_SDK_Version_1_8_20110726/ARDroneLib/VLIB -IARDrone_SDK_Version_1_8_20110726/ARDroneLib -I. LINK = g++ -LFLAGS = -Wl,-rpath-link,/usr/lib -Wl,-O1 -Wl,--hash-style=gnu -Wl,-rpath,/usr/lib -LIBS = $(SUBLIBS) -L/usr/lib -lQtComponents -L/home/kathy/ARDrone_SDK_1_5_Version_20101004/lib -lvlib -lsdk -L/usr/lib -lQtSensors -lQtDeclarative -L/usr/X11R6/lib -lQtScript -lQtSvg -lQtSql -lQtXmlPatterns -lQtOpenGL -lQtGui -lQtNetwork -lQtDBus -lQtXml -lQtCore -lpthread +LFLAGS = -Wl,-O1 +LIBS = $(SUBLIBS) -L/usr/lib/i386-linux-gnu -lSDL -lQtDeclarative -lQtGui -lQtNetwork -lQtCore -lpthread AR = ar cqs RANLIB = -QMAKE = /usr/bin/qmake +QMAKE = /usr/bin/qmake-qt4 TAR = tar -cf COMPRESS = gzip -9f COPY = cp -f @@ -44,17 +44,23 @@ OBJECTS_DIR = ./ ####### Files SOURCES = main.cpp \ - dronecontrol.cpp \ - navdata.cpp \ - video.cpp \ - gauge.cpp \ - gaugelabel.cpp \ - gaugehorizon.cpp moc_dronecontrol.cpp \ + dronelib/dronecontrol.cpp \ + dronelib/navdata.cpp \ + dronelib/video.cpp \ + gauges/gauge.cpp \ + gauges/gaugelabel.cpp \ + gauges/gaugetape.cpp \ + gauges/gaugehorizon.cpp \ + dronelib/joystick.cpp \ + qdeclarativetoucharea.cpp moc_dronecontrol.cpp \ moc_navdata.cpp \ moc_video.cpp \ moc_gauge.cpp \ moc_gaugelabel.cpp \ + moc_gaugetape.cpp \ moc_gaugehorizon.cpp \ + moc_joystick.cpp \ + moc_qdeclarativetoucharea.cpp \ qrc_ardrone.cpp OBJECTS = main.o \ dronecontrol.o \ @@ -62,34 +68,41 @@ OBJECTS = main.o \ video.o \ gauge.o \ gaugelabel.o \ + gaugetape.o \ gaugehorizon.o \ + joystick.o \ + qdeclarativetoucharea.o \ moc_dronecontrol.o \ moc_navdata.o \ moc_video.o \ moc_gauge.o \ moc_gaugelabel.o \ + moc_gaugetape.o \ moc_gaugehorizon.o \ + moc_joystick.o \ + moc_qdeclarativetoucharea.o \ qrc_ardrone.o -DIST = /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/unix.conf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/linux.conf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/qconfig.pri \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_functions.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_config.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/exclusive_builds.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_pre.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/release.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_post.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/mobility.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/warn_on.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/unix/thread.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/moc.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/resources.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/uic.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/yacc.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/lex.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/include_source_dir.prf \ +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/link_pkgconfig.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ mardrone.pro QMAKE_TARGET = mardrone DESTDIR = @@ -122,75 +135,63 @@ all: Makefile $(TARGET) $(TARGET): $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) -Makefile: mardrone.pro /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5/qmake.conf /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/unix.conf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/linux.conf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/qconfig.pri \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_functions.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_config.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/exclusive_builds.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_pre.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/release.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_post.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/mobility.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/warn_on.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/unix/thread.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/moc.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/resources.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/uic.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/yacc.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/lex.prf \ - /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/include_source_dir.prf \ - /usr/lib/libQtDeclarative.prl \ - /usr/lib/libQtScript.prl \ - /usr/lib/libQtCore.prl \ - /usr/lib/libQtSvg.prl \ - /usr/lib/libQtGui.prl \ - /usr/lib/libQtDBus.prl \ - /usr/lib/libQtXml.prl \ - /usr/lib/libQtSql.prl \ - /usr/lib/libQtXmlPatterns.prl \ - /usr/lib/libQtNetwork.prl \ - /usr/lib/libQtOpenGL.prl - $(QMAKE) -o Makefile mardrone.pro -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/unix.conf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/linux.conf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/qconfig.pri: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_functions.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_config.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/exclusive_builds.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_pre.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/release.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_post.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/mobility.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/warn_on.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/unix/thread.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/moc.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/resources.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/uic.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/yacc.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/lex.prf: -/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/include_source_dir.prf: -/usr/lib/libQtDeclarative.prl: -/usr/lib/libQtScript.prl: -/usr/lib/libQtCore.prl: -/usr/lib/libQtSvg.prl: -/usr/lib/libQtGui.prl: -/usr/lib/libQtDBus.prl: -/usr/lib/libQtXml.prl: -/usr/lib/libQtSql.prl: -/usr/lib/libQtXmlPatterns.prl: -/usr/lib/libQtNetwork.prl: -/usr/lib/libQtOpenGL.prl: +Makefile: mardrone.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/link_pkgconfig.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/i386-linux-gnu/libQtDeclarative.prl \ + /usr/lib/i386-linux-gnu/libQtGui.prl \ + /usr/lib/i386-linux-gnu/libQtNetwork.prl \ + /usr/lib/i386-linux-gnu/libQtCore.prl + $(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -o Makefile mardrone.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/release.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/link_pkgconfig.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/i386-linux-gnu/libQtDeclarative.prl: +/usr/lib/i386-linux-gnu/libQtGui.prl: +/usr/lib/i386-linux-gnu/libQtNetwork.prl: +/usr/lib/i386-linux-gnu/libQtCore.prl: qmake: FORCE - @$(QMAKE) -o Makefile mardrone.pro + @$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -o Makefile mardrone.pro dist: @$(CHK_DIR_EXISTS) .tmp/mardrone1.0.0 || $(MKDIR) .tmp/mardrone1.0.0 - $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/mardrone1.0.0/ && $(COPY_FILE) --parents dronecontrol.h navdata.h video.h gauge.h gaugelabel.h gaugehorizon.h .tmp/mardrone1.0.0/ && $(COPY_FILE) --parents ardrone.qrc .tmp/mardrone1.0.0/ && $(COPY_FILE) --parents main.cpp dronecontrol.cpp navdata.cpp video.cpp gauge.cpp gaugelabel.cpp gaugehorizon.cpp .tmp/mardrone1.0.0/ && (cd `dirname .tmp/mardrone1.0.0` && $(TAR) mardrone1.0.0.tar mardrone1.0.0 && $(COMPRESS) mardrone1.0.0.tar) && $(MOVE) `dirname .tmp/mardrone1.0.0`/mardrone1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/mardrone1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/mardrone1.0.0/ && $(COPY_FILE) --parents dronelib/dronecontrol.h dronelib/navdata.h dronelib/video.h gauges/gauge.h gauges/gaugelabel.h gauges/gaugetape.h gauges/gaugehorizon.h dronelib/joystick.h qdeclarativetoucharea.h .tmp/mardrone1.0.0/ && $(COPY_FILE) --parents ardrone.qrc .tmp/mardrone1.0.0/ && $(COPY_FILE) --parents main.cpp dronelib/dronecontrol.cpp dronelib/navdata.cpp dronelib/video.cpp gauges/gauge.cpp gauges/gaugelabel.cpp gauges/gaugetape.cpp gauges/gaugehorizon.cpp dronelib/joystick.cpp qdeclarativetoucharea.cpp .tmp/mardrone1.0.0/ && (cd `dirname .tmp/mardrone1.0.0` && $(TAR) mardrone1.0.0.tar mardrone1.0.0 && $(COMPRESS) mardrone1.0.0.tar) && $(MOVE) `dirname .tmp/mardrone1.0.0`/mardrone1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/mardrone1.0.0 clean:compiler_clean @@ -211,42 +212,80 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all -compiler_moc_header_make_all: moc_dronecontrol.cpp moc_navdata.cpp moc_video.cpp moc_gauge.cpp moc_gaugelabel.cpp moc_gaugehorizon.cpp +compiler_moc_header_make_all: moc_dronecontrol.cpp moc_navdata.cpp moc_video.cpp moc_gauge.cpp moc_gaugelabel.cpp moc_gaugetape.cpp moc_gaugehorizon.cpp moc_joystick.cpp moc_qdeclarativetoucharea.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc_dronecontrol.cpp moc_navdata.cpp moc_video.cpp moc_gauge.cpp moc_gaugelabel.cpp moc_gaugehorizon.cpp -moc_dronecontrol.cpp: navdata.h \ - dronecontrol.h - /usr/bin/moc $(DEFINES) $(INCPATH) dronecontrol.h -o moc_dronecontrol.cpp + -$(DEL_FILE) moc_dronecontrol.cpp moc_navdata.cpp moc_video.cpp moc_gauge.cpp moc_gaugelabel.cpp moc_gaugetape.cpp moc_gaugehorizon.cpp moc_joystick.cpp moc_qdeclarativetoucharea.cpp +moc_dronecontrol.cpp: dronelib/dronecontrol.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) dronelib/dronecontrol.h -o moc_dronecontrol.cpp -moc_navdata.cpp: navdata.h - /usr/bin/moc $(DEFINES) $(INCPATH) navdata.h -o moc_navdata.cpp +moc_navdata.cpp: dronelib/navdata.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) dronelib/navdata.h -o moc_navdata.cpp -moc_video.cpp: dronecontrol.h \ - navdata.h \ - video.h - /usr/bin/moc $(DEFINES) $(INCPATH) video.h -o moc_video.cpp +moc_video.cpp: dronelib/dronecontrol.h \ + dronelib/video.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) dronelib/video.h -o moc_video.cpp -moc_gauge.cpp: gauge.h - /usr/bin/moc $(DEFINES) $(INCPATH) gauge.h -o moc_gauge.cpp +moc_gauge.cpp: gauges/gauge.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) gauges/gauge.h -o moc_gauge.cpp -moc_gaugelabel.cpp: gauge.h \ - gaugelabel.h - /usr/bin/moc $(DEFINES) $(INCPATH) gaugelabel.h -o moc_gaugelabel.cpp +moc_gaugelabel.cpp: gauges/gauge.h \ + gauges/gaugelabel.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) gauges/gaugelabel.h -o moc_gaugelabel.cpp -moc_gaugehorizon.cpp: gauge.h \ - gaugehorizon.h - /usr/bin/moc $(DEFINES) $(INCPATH) gaugehorizon.h -o moc_gaugehorizon.cpp +moc_gaugetape.cpp: gauges/gauge.h \ + gauges/gaugetape.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) gauges/gaugetape.h -o moc_gaugetape.cpp + +moc_gaugehorizon.cpp: gauges/gauge.h \ + gauges/gaugehorizon.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) gauges/gaugehorizon.h -o moc_gaugehorizon.cpp + +moc_joystick.cpp: dronelib/joystick.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) dronelib/joystick.h -o moc_joystick.cpp + +moc_qdeclarativetoucharea.cpp: qdeclarativetoucharea.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) qdeclarativetoucharea.h -o moc_qdeclarativetoucharea.cpp compiler_rcc_make_all: qrc_ardrone.cpp compiler_rcc_clean: -$(DEL_FILE) qrc_ardrone.cpp qrc_ardrone.cpp: ardrone.qrc \ + gauges/ati1.png \ + gauges/HeadingGauge.qml \ + ConfigDialogDesktop.qml \ + ardrone_harmattan.qml \ + gauges/AltGauge.qml \ + gear32x32.png \ + gauges/EfisPFD.qml \ + gauges/hdg2.png \ + gauges/glareshield1.png \ joyknob.png \ - joybox.png \ + CalibrateDialog.qml \ BarGauge.qml \ + gauges/ati6.png \ + gauges/ati2.png \ + gauges/needle2.png \ + ardrone_symbian.qml \ + JoyStickTouch.qml \ + ConfigDialogSymbian.qml \ + JoyStickCalibrator.qml \ + CalibrateDialogDesktop.qml \ + gauges/ati3.png \ + gauges/needle1.png \ + gauges/AttitudeGauge.qml \ + JoyStickIndicator.qml \ + joybox.png \ + ardrone_desktop.qml \ + gauges/ati4.png \ + gauges/bezel.png \ + gauges/alt2.png \ ConfigDialog.qml \ - ardrone.qml \ - JoyStick.qml + gauges/hdg1.png \ + gauges/ati5.png \ + JoyStickCalibratorDesktop.qml \ + gauges/EfisPFD.qml \ + gauges/AltGauge.qml \ + gauges/qmldir /usr/bin/rcc -name ardrone ardrone.qrc -o qrc_ardrone.cpp compiler_image_collection_make_all: qmake_image_collection.cpp @@ -266,35 +305,40 @@ compiler_clean: compiler_moc_header_clean compiler_rcc_clean ####### Compile -main.o: main.cpp dronecontrol.h \ - navdata.h \ - video.h \ - gaugehorizon.h \ - gauge.h +main.o: main.cpp qdeclarativetoucharea.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp -dronecontrol.o: dronecontrol.cpp dronecontrol.h \ - navdata.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o dronecontrol.o dronecontrol.cpp +dronecontrol.o: dronelib/dronecontrol.cpp dronelib/dronecontrol.h \ + dronelib/navdata.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o dronecontrol.o dronelib/dronecontrol.cpp + +navdata.o: dronelib/navdata.cpp dronelib/navdata.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o navdata.o dronelib/navdata.cpp + +video.o: dronelib/video.cpp dronelib/video.h \ + dronelib/dronecontrol.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o video.o dronelib/video.cpp + +gauge.o: gauges/gauge.cpp gauges/gauge.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gauge.o gauges/gauge.cpp -navdata.o: navdata.cpp navdata.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o navdata.o navdata.cpp +gaugelabel.o: gauges/gaugelabel.cpp gauges/gaugelabel.h \ + gauges/gauge.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gaugelabel.o gauges/gaugelabel.cpp -video.o: video.cpp video.h \ - dronecontrol.h \ - navdata.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o video.o video.cpp +gaugetape.o: gauges/gaugetape.cpp gauges/gaugetape.h \ + gauges/gauge.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gaugetape.o gauges/gaugetape.cpp -gauge.o: gauge.cpp gauge.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gauge.o gauge.cpp +gaugehorizon.o: gauges/gaugehorizon.cpp gauges/gaugehorizon.h \ + gauges/gauge.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gaugehorizon.o gauges/gaugehorizon.cpp -gaugelabel.o: gaugelabel.cpp gaugelabel.h \ - gauge.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gaugelabel.o gaugelabel.cpp +joystick.o: dronelib/joystick.cpp dronelib/joystick.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o joystick.o dronelib/joystick.cpp -gaugehorizon.o: gaugehorizon.cpp gaugehorizon.h \ - gauge.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gaugehorizon.o gaugehorizon.cpp +qdeclarativetoucharea.o: qdeclarativetoucharea.cpp qdeclarativetoucharea.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qdeclarativetoucharea.o qdeclarativetoucharea.cpp moc_dronecontrol.o: moc_dronecontrol.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_dronecontrol.o moc_dronecontrol.cpp @@ -311,47 +355,46 @@ moc_gauge.o: moc_gauge.cpp moc_gaugelabel.o: moc_gaugelabel.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_gaugelabel.o moc_gaugelabel.cpp +moc_gaugetape.o: moc_gaugetape.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_gaugetape.o moc_gaugetape.cpp + moc_gaugehorizon.o: moc_gaugehorizon.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_gaugehorizon.o moc_gaugehorizon.cpp +moc_joystick.o: moc_joystick.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_joystick.o moc_joystick.cpp + +moc_qdeclarativetoucharea.o: moc_qdeclarativetoucharea.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_qdeclarativetoucharea.o moc_qdeclarativetoucharea.cpp + qrc_ardrone.o: qrc_ardrone.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_ardrone.o qrc_ardrone.cpp ####### Install install_target: first FORCE - @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/opt/usr/bin/ || $(MKDIR) $(INSTALL_ROOT)/opt/usr/bin/ - -$(INSTALL_PROGRAM) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/opt/usr/bin/$(QMAKE_TARGET)" - -$(STRIP) "$(INSTALL_ROOT)/opt/usr/bin/$(QMAKE_TARGET)" + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/bin/ + -$(INSTALL_PROGRAM) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)" + -$(STRIP) "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)" uninstall_target: FORCE - -$(DEL_FILE) "$(INSTALL_ROOT)/opt/usr/bin/$(QMAKE_TARGET)" - -$(DEL_DIR) $(INSTALL_ROOT)/opt/usr/bin/ - - -install_icon64: first FORCE - @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ - -$(INSTALL_FILE) /home/kathy/sb/harmattan/mardrone/mardrone/mardrone.png $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ - - -uninstall_icon64: FORCE - -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/mardrone.png - -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ + -$(DEL_FILE) "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/bin/ install_desktopfile: first FORCE - @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/applications/hildon/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/applications/hildon/ - -$(INSTALL_FILE) /home/kathy/sb/harmattan/mardrone/mardrone/mardrone.desktop $(INSTALL_ROOT)/usr/share/applications/hildon/ + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/applications/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/applications/ + -$(INSTALL_FILE) /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone/mardrone.desktop $(INSTALL_ROOT)/usr/share/applications/ uninstall_desktopfile: FORCE - -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/applications/hildon/mardrone.desktop - -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/applications/hildon/ + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/applications/mardrone.desktop + -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/applications/ -install: install_target install_icon64 install_desktopfile FORCE +install: install_target install_desktopfile FORCE -uninstall: uninstall_target uninstall_icon64 uninstall_desktopfile FORCE +uninstall: uninstall_target uninstall_desktopfile FORCE FORCE: diff --git a/mardrone/ardrone.qrc b/mardrone/ardrone.qrc index 1025c12..0bd88c8 100644 --- a/mardrone/ardrone.qrc +++ b/mardrone/ardrone.qrc @@ -1,10 +1,42 @@ - - ardrone.qml + BarGauge.qml ConfigDialog.qml - JoyStick.qml joybox.png joyknob.png + gear32x32.png + ardrone_harmattan.qml + ardrone_desktop.qml + ConfigDialogDesktop.qml + gauges/AltGauge.qml + gauges/alt2.png + gauges/needle1.png + gauges/needle2.png + gauges/EfisPFD.qml + CalibrateDialog.qml + JoyStickCalibrator.qml + JoyStickIndicator.qml + JoyStickTouch.qml + gauges/ati1.png + gauges/ati2.png + gauges/ati3.png + gauges/ati4.png + gauges/ati5.png + gauges/ati6.png + gauges/AttitudeGauge.qml + CalibrateDialogDesktop.qml + JoyStickCalibratorDesktop.qml + ardrone_symbian.qml + ConfigDialogSymbian.qml + gauges/bezel.png + gauges/HeadingGauge.qml + gauges/hdg1.png + gauges/hdg2.png + gauges/glareshield1.png + + + gauges/EfisPFD.qml + gauges/qmldir + gauges/AltGauge.qml diff --git a/mardrone/ardrone_desktop.qml b/mardrone/ardrone_desktop.qml index bcfcfa4..ce4f799 100644 --- a/mardrone/ardrone_desktop.qml +++ b/mardrone/ardrone_desktop.qml @@ -2,20 +2,21 @@ import Drone 1.0 import QtQuick 1.0 import QtDesktop 0.1 -import gauges 1.0 +//import gauges 1.0 import JoyStick 1.0 Window { title: "MArdrone" - + id:mainWindow width: 1024 - height: 480 + height: 800 maximumHeight: mainWindow.height - minimumHeight: 480 + minimumHeight: 800 maximumWidth: 1280 minimumWidth: 800 visible: true + MenuBar { Menu { text: "File" @@ -54,9 +55,12 @@ Window { } + Column { + width:parent.width + spacing:5 Rectangle { - id:mainWindow - width:640 + id:mainWiew + width:parent.width height:480 //onEntered:(mainWindow.fullscreen=true) @@ -64,20 +68,20 @@ Window { DroneVideo { id:droneVideo y:0 - x:0 + anchors.horizontalCenter: parent // anchors.horizontalCenter:parent.horizontalCenter - width:drone.confFullScreen? parent.width:640 ;height:480*width/640; + width:drone.confFullScreen? parent.width:640 ;height:width<=640 ?480*width/640:480; } EfisPFD { id:hudPDF y:0 - x:0 + anchors.horizontalCenter: parent visible:drone.confShowHorizon roll:drone.droneRoll pitch:drone.dronePitch ias:drone.droneSpeed - alt:drone.droneAltitude + alt:drone.droneAltitude/10 indicatorColor:"green" skyColor:"#00000000" groundColor:"#00000000" @@ -87,6 +91,7 @@ Window { Text { y:100 + // visible:drone.confUseAccel color: "#00FF00" id: droneCtrlValues @@ -111,17 +116,20 @@ Window { font.pixelSize:20 text: drone.decodedStatus } - Button { + /* Button { y:150;x:0 height: 50 width: 50 iconSource: "gear32x32.png" onClicked:{ configDialog.visible = true } } - +*/ JoyStickIndicator { - x:200;y:350 - visible:drone.showJSIndivators + + anchors.left:parent.left + anchors.bottom:parent.bottom + anchors.margins:10 + visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick border.width:1 color:"transparent" width:100;height:100 @@ -142,8 +150,11 @@ Window { JoyStickIndicator { - x:500;y:350 - visible:drone.showJSIndivators + + anchors.right:parent.right + anchors.bottom:parent.bottom + anchors.margins:10 + visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick border.width:1 color:"transparent" width:100;height:100 @@ -186,23 +197,49 @@ Window { onXvChanged:{drone.yaw=xv/200.0;} onPressedChanged: { drone.ctrlActive=pressed;} } - Column { - anchors.left: droneVideo.right + } + Row { + spacing:5 + EfisPFD { id:pDF width:320 height:240 - // visible:drone.confShowHorizon roll:drone.droneRoll pitch:drone.dronePitch ias:drone.droneSpeed - alt:drone.droneAltitude + alt:drone.droneAltitude/10 + // bezel:"glareshield1.png" } + Grid { + columns: 4 + + + AltGauge { + width:150 + height:150 + id:altGauge + value:drone.droneAltitude/10 + bezel:"bezel.png" + } + AttitudeGauge { + width:150 + height:150 + id:attGauge + roll:drone.droneRoll + pitch:drone.dronePitch + bezel:"bezel.png" + } + HeadingGauge { + width:150 + height:150 + id:hdgGauge + value:drone.droneYaw + bezel:"bezel.png" + } Row { spacing: 5 - anchors.right:parent.right anchors.rightMargin: 10 - y:100 height:100 BarGauge { val:drone.pwm_motor1; @@ -230,26 +267,16 @@ Window { height:100 } } - AltGauge { - width:150 - height:150 - id:altGauge - // value:drone.altitude - value:testAlt.value - } - Slider { - id: testAlt - maximumValue:1000 - } + } // Grid if instruments + } // Column ( Main window content ) - } Dialog { id:configDialog width:800 height:600 data:ConfigDialogDesktop {} } - - } // Main page } + } // Main page + diff --git a/mardrone/ardrone_harmattan.qml b/mardrone/ardrone_harmattan.qml index a00245a..84490ce 100644 --- a/mardrone/ardrone_harmattan.qml +++ b/mardrone/ardrone_harmattan.qml @@ -1,7 +1,7 @@ import QtQuick 1.0 import com.nokia.meego 1.0 import Drone 1.0 -import gauges 1.0 +//import gauges 1.0 import JoyStick 1.0 PageStackWindow { @@ -24,12 +24,11 @@ PageStackWindow { DroneControl { id:drone - } JoyStick { id:js onElevatorChanged:{if(drone.confUseJoyStick) drone.pitch=elevator;} - onAileronChanged: {if(drone.confUseJoyStick) drone.roll=aileron;} + onAileronChanged: {if(drone.confUseJoyStick) drone.roll=-1.0*aileron;} onThrotleChanged: {if(drone.confUseJoyStick) drone.vVelocity=throtle;} onRudderChanged: {if(drone.confUseJoyStick) drone.yaw=rudder;} @@ -37,8 +36,10 @@ PageStackWindow { Component { id: mainpageComponent + Page { id:mainPage + property bool connectingBoxVisible:true //onEntered:(mainWindow.fullscreen=true) state:"Landscape" @@ -48,6 +49,7 @@ PageStackWindow { // anchors.horizontalCenter:parent.horizontalCenter width:drone.confFullScreen? parent.width:640 ;height:480*width/640; } + EfisPFD { id:hudPDF y:0 @@ -67,25 +69,25 @@ PageStackWindow { Text { - y:100 + y:50 // visible:drone.confUseAccel color: "#00FF00" id: droneCtrlValues - font.pixelSize:20 + font.pixelSize:25 text: "cmd:pitch=" + drone.pitch.toFixed(2) + " roll= " + drone.roll.toFixed(2) + " yaw=" + drone.yaw.toFixed(2) + " vv= " + drone.vVelocity.toFixed(2) } Text { - y:115 + y:70 visible:drone.confShowDebug color: "#00FF00" id: droneNavData - font.pixelSize:20 - text: "pitch=" + Math.round(drone.dronePitch) + " roll= " + Math.round(drone.droneRoll) + "yaw=" + Math.round(drone.droneYaw) + " alt= " + Math.round(drone.droneAltitude) + font.pixelSize:25 + text: "pitch=" + drone.dronePitch.toFixed(2) + " roll= " + drone.droneRoll.toFixed(2) + "yaw=" + drone.droneYaw.toFixed(2) + " alt= " + drone.droneAltitude.toFixed(2) } Text { - y:130 + y:100 visible:drone.confShowDebug color: "#00FF00" id: droneStatus @@ -96,6 +98,7 @@ PageStackWindow { y:150;x:0 height: 50 width: 50 + z:2 // This is visible even connecting to drone iconSource: "gear32x32.png" onClicked:{ //mainWindow.fullscreen = false ; pageStack.push(dialogComponent); @@ -147,27 +150,29 @@ PageStackWindow { JoyStickTouch { id:lj - width:280;height:280; - y:200 + width:200;height:200; + visible: !drone.confUseAccel & !drone.confUseJoyStick anchors.left:parent.left - anchors.margins:50 - onYvChanged:{drone.pitch=yv/200.0;} - onXvChanged:{drone.roll=xv/200.0;} - - + anchors.bottom:parent.bottom + anchors.margins:10 + // joyBackground: "" + onYvChanged:{drone.vVelocity=-1*yv/200.0;} + onXvChanged:{drone.yaw=xv/200.0;} + onPressedChanged: { drone.ctrlActive=pressed;} } JoyStickTouch { visible: !drone.confUseJoyStick id:rj - y:200 + + // joyBackground: "" anchors.right:parent.right - width:280;height:280; + anchors.bottom:parent.bottom + width:200;height:200; anchors.margins:10 - onYvChanged:{drone.vVelocity=-1*yv/200.0;} - onXvChanged:{drone.yaw=xv/200.0;} - onPressedChanged: { drone.ctrlActive=pressed;} + onYvChanged:{drone.pitch=yv/200.0;} + onXvChanged:{drone.roll=xv/200.0;} } Row { @@ -220,12 +225,28 @@ PageStackWindow { width:120 id:emergencyButton anchors.top:parent.top + anchors.margins:15 text:"Energency"; checkable:true onClicked:{drone.emergency=checked;} } + + Connections { + target:drone + onConnectedChanged:{ + console.log("Connected to drone"); + connectingDialog.accept();} + } + QueryDialog { + id:connectingDialog + message:"Connecting to Drone "+ drone.confDroneIp + acceptButtonText:"OK" + Component.onCompleted: { + console.log("ConectionDialog Opened"); + if(!drone.connected) open(); } + } } // Main page } @@ -237,9 +258,4 @@ PageStackWindow { dialogComponent = Qt.createComponent("ConfigDialog.qml"); } -// Component.onCompleted: { -// mainWindow.fullscreen = true ; -// dialogComponent = Qt.createComponent("ConfigDialog.qml"); -// mainWindow.nextPage(mainpageComponent) -// } } diff --git a/mardrone/debian/changelog b/mardrone/debian/changelog index edb5de3..34c5351 100644 --- a/mardrone/debian/changelog +++ b/mardrone/debian/changelog @@ -1,3 +1,15 @@ +mardrone (0.2.0) unstable; urgency=low + + * Updated support added for desktop Qt components and Joystick + + -- Kate Alhola Tue, 17 Nov 2011 17:16:48 +0200 + +mardrone (0.1.0) unstable; urgency=low + + * Updated to release version of MeeGo Qt Quick components and ArDronelib included to build. + + -- Kate Alhola Tue, 30 Aug 2011 15:06:48 +0200 + mardrone (0.0.1) unstable; urgency=low * Initial Release. diff --git a/mardrone/debian/files b/mardrone/debian/files index e4b77f3..09e3e52 100644 --- a/mardrone/debian/files +++ b/mardrone/debian/files @@ -1 +1 @@ -mardrone_0.0.1_armel.deb user/hidden optional +mardrone_0.2.0_i386.deb user/hidden optional diff --git a/mardrone/debian/rules b/mardrone/debian/rules index 87fe5b0..d7fd631 100755 --- a/mardrone/debian/rules +++ b/mardrone/debian/rules @@ -27,6 +27,7 @@ build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. + qmake $(MAKE) #docbook-to-man debian/mardrone.sgml > mardrone.1 @@ -82,7 +83,7 @@ binary-arch: build install # dh_perl # dh_makeshlibs dh_installdeb - # dh_shlibdeps + dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb diff --git a/mardrone/dronecontrol.cpp b/mardrone/dronecontrol.cpp deleted file mode 100644 index 03862f9..0000000 --- a/mardrone/dronecontrol.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/*================================================================== - ! - ! mardrone application AR-Drone for MeeGo - - ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - ! All rights reserved. - ! - ! Author:Kate Alhola kate.alhola@nokia.com - ! - ! GNU Lesser General Public License Usage - ! This file may be used under the terms of the GNU Lesser - ! General Public License version 2.1 as published by the Free Software - ! Foundation and appearing in the file LICENSE.LGPL included in the - ! packaging of this file. Please review the following information to - ! ensure the GNU Lesser General Public License version 2.1 requirements - ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - ! - ! - ! - *===================================================================*/ -#include "dronecontrol.h" -#include - -DroneControl::DroneControl():QObject() -{ - qDebug() << "DroneControl::DroneControl"; - -// ctlSock=new QTcpSocket(); -// ctlSock->bind(QHostAddress::Any,5559); -// navSock=new QUdpSocket(); -// navSock->bind(QHostAddress::Any,5554) - //connect(navSocket,SIGNAL(readyRead()),SLOT(navDataReady())); - droneHost.setAddress("192.168.1.1"); - droneThread=new DroneThread(this,droneHost); - connect(droneThread->navData(),SIGNAL(navDataUpdated()),this,SLOT(navDataUpdated())); - connect(droneThread->navData(),SIGNAL(stateUpdated()),this,SLOT(statusUpdated())); - droneSettings=new QSettings("katix.org","ardrone"); - m_ctrlActive=false; - m_pitch=0; - m_roll=0; - m_yaw=0; - m_vv=0; - m_useAccel=droneSettings->value("useAccel",false).toBool(); - m_ctrlTrsh=droneSettings->value("ctrlTreshold",10.0).toFloat(); - rSensor=new QRotationSensor(); - rSensor->start(); - connect(rSensor,SIGNAL(readingChanged()),this,SLOT(rotationReadingsChanged())); - droneThread->setDroneGain(confForwardGain(),confBackwardGain(),confLeftGain(),confRightGain()); - -} - -void DroneControl::rotationReadingsChanged() -{ - if(m_useAccel && m_ctrlActive) { - m_pitch=rSensor->reading()->x()-m_rotRefX; - m_roll =rSensor->reading()->y()-m_rotRefY; - m_pitch=(fabs(m_pitch)0 ? m_pitch-m_ctrlTrsh:m_pitch+m_ctrlTrsh); - m_roll =(fabs(m_roll )0 ? m_roll- m_ctrlTrsh:m_roll+ m_ctrlTrsh); - droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); - emit pitchRollChanged(); - //m_rotRefZ=rSensor->reading()->z(); - //qDebug("setCtrlActive ref(%3.1f,%3.1f,%3.1f)",m_rotRefX,m_rotRefY,m_rotRefZ); - } -} - -void DroneControl::navDataUpdated() -{ - emit navDataChanged(); - -} -void DroneControl::statusUpdated() -{ - emit statusChanged(); - -} - -void DroneControl::setPitch(float val_) -{ - m_pitch=val_; -// qDebug() << "setPitch=" << val_; - droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); -}; -float DroneControl::pitch() {return m_pitch;}; - -void DroneControl::setRoll(float val_) -{ - m_roll=val_; -// qDebug() << "setRoll=" << val_; - droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); -}; -float DroneControl::roll() {return m_roll;}; -void DroneControl::setYaw(float val) { - m_yaw=val; - // qDebug() << "setYaw=" << val; - if(m_useAccel && m_ctrlActive) m_yaw=(fabs(m_yaw)<(m_ctrlTrsh*2) ) ? 0:(m_yaw>0 ? m_yaw-(m_ctrlTrsh*2):m_yaw+(m_ctrlTrsh*2)); - droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); -}; -float DroneControl::yaw() {return m_yaw;}; -void DroneControl::setVVelocity(float val) { - m_vv=val; - if(m_useAccel && m_ctrlActive) m_vv=(fabs(m_vv)<(m_ctrlTrsh*2) ) ? 0:(m_vv>0? m_vv-(m_ctrlTrsh*2):m_vv+(m_ctrlTrsh*2)); -// qDebug() << "setVv=" << val_; - droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); -}; -float DroneControl::vVelocity() {return m_vv;}; -void DroneControl::setAltitude(float val_) { - m_altitude=val_; -}; -float DroneControl::altitude() {return m_altitude;}; -void DroneControl::setEnabled(int val_) { m_enabled=val_;}; -int DroneControl::enabled() {return m_enabled;}; - -bool DroneControl::ctrlActive() -{ - return m_ctrlActive; -}; -void DroneControl::setCtrlActive(bool val_) -{ - if(val_ && !m_ctrlActive) { // Ctrl switched to active - m_rotRefX=rSensor->reading()->x(); - m_rotRefY=rSensor->reading()->y(); - m_rotRefZ=rSensor->reading()->z(); - qDebug("setCtrlActive ref(%3.1f,%3.1f,%3.1f)",m_rotRefX,m_rotRefY,m_rotRefZ); - } - m_ctrlActive=val_; - if(!m_ctrlActive) { m_pitch=0;m_roll=0; }; - droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); - emit pitchRollChanged(); - -}; - - -void DroneControl::setFly(bool val_) -{ - m_fly=val_; - qDebug() << "setFly=" << val_; - droneThread->setFly(m_fly); -}; -bool DroneControl::fly() {return m_fly;}; -void DroneControl::setEmergency(bool val_) -{ - m_emergency=val_; - qDebug() << "setEmergency=" << val_; - droneThread->setEmergency(m_emergency); -}; -bool DroneControl::emergency() {return m_emergency;}; - - -// Getters to drone actual valyes sent by drone -float DroneControl::droneAltitude() -{ - return droneThread->navData()->altitude; -}; -float DroneControl::dronePitch() -{ - return droneThread->navData()->pitch; -}; -float DroneControl::droneRoll() -{ - return droneThread->navData()->roll; -}; -float DroneControl::droneYaw() -{ - return droneThread->navData()->yaw; -}; -float DroneControl::droneVBat() -{ - return droneThread->navData()->vbat; -}; -QString DroneControl::decodedStatus() -{ - return droneThread->navData()->decodedState; -}; -int DroneControl::pwm_motor1() -{ - return droneThread->navData()->pwm_motor1; -}; -int DroneControl::pwm_motor2() -{ - return droneThread->navData()->pwm_motor2; -}; -int DroneControl::pwm_motor3() -{ - return droneThread->navData()->pwm_motor3; -}; -int DroneControl::pwm_motor4() -{ - return droneThread->navData()->pwm_motor4; -}; - - - - - -QString DroneControl::confDroneIp() -{ - qDebug() << "confDroneIp:" << droneSettings->value("droneIp","192.168.1.1").toString(); - return droneSettings->value("droneIp","192.168.1.1").toString(); -}; -void DroneControl::setConfDroneIp(QString ip) -{ - qDebug() << "setConfDroneIp:" << ip; - droneSettings->setValue("droneIp",ip); - emit configChanged(); -}; -bool DroneControl::confShowDebug() -{ -return droneSettings->value("showDebug",true).toBool(); -}; -void DroneControl::setConfShowDebug(bool val) -{ - droneSettings->setValue("showDebug",val); - emit configChanged(); -}; -bool DroneControl::confShowHorizon() -{ - return droneSettings->value("showHorizon",true).toBool(); -}; -void DroneControl::setConfShowHorizon(bool val) -{ - droneSettings->setValue("showHorizon",val); - emit configChanged(); -}; -bool DroneControl::confShowGauges() -{ - return droneSettings->value("showGuges",true).toBool(); -}; -void DroneControl::setConfShowGauges(bool val) -{ - droneSettings->setValue("showGauges",val); - emit configChanged(); -}; -bool DroneControl::confUseAccel() -{ - //return droneSettings->value("useAccel",false).toBool(); - return m_useAccel; // return cached value -}; -void DroneControl::setConfUseAccel(bool val) -{ - droneSettings->setValue("useAccel",val); - m_useAccel=val; - emit configChanged(); -}; -bool DroneControl::confUseJoyStick() -{ - return droneSettings->value("useJouStick",false).toBool(); -}; -void DroneControl::setConfUseJoyStick(bool val) -{ - droneSettings->setValue("useJoyStick",val); - emit configChanged(); -}; - -bool DroneControl::confFullScreen() -{ - return droneSettings->value("fullScreen",true).toBool(); -}; -void DroneControl::setConfFullScreen(bool val) -{ - droneSettings->setValue("fullScreen",val); - emit configChanged(); -}; - -float DroneControl::confForwardGain() -{ - return droneSettings->value("forwardGain",1.0).toFloat(); -}; -void DroneControl::setConfForwardGain(float val) -{ - droneSettings->setValue("forwardGain",val); - droneThread->setDroneGain(confForwardGain(),confBackwardGain(),confLeftGain(),confRightGain()); - emit configChanged(); -}; -float DroneControl::confCtrlTrsh() -{ - return m_ctrlTrsh; -}; -void DroneControl::setConfCtrlTrsh(float val) -{ - droneSettings->setValue("ctrlTreshold",val); - m_ctrlTrsh=val; - emit configChanged(); -}; - -float DroneControl::confBackwardGain() -{ - return droneSettings->value("backwardGain",1.0).toFloat(); -}; -void DroneControl::setConfBackwardGain(float val) -{ - droneSettings->setValue("backwardGain",val); - droneThread->setDroneGain(confForwardGain(),confBackwardGain(),confLeftGain(),confRightGain()); - emit configChanged(); -}; - -float DroneControl::confLeftGain() -{ - return droneSettings->value("leftGain",1.0).toFloat(); -}; -void DroneControl::setConfLeftGain(float val) -{ - droneSettings->setValue("leftGain",val); - droneThread->setDroneGain(confForwardGain(),confBackwardGain(),confLeftGain(),confRightGain()); - emit configChanged(); -}; -float DroneControl::confRightGain() -{ - return droneSettings->value("rightGain",1.0).toFloat(); -}; -void DroneControl::setConfRightGain(float val) -{ - droneSettings->setValue("rightGain",val); - droneThread->setDroneGain(confForwardGain(),confBackwardGain(),confLeftGain(),confRightGain()); - emit configChanged(); -}; - -/*================================================= - - DroneThread class starts here - -==================================================*/ - - -void DroneThread::setFly(bool fly) -{ - if(state==ready) { - m_fly=fly; - state=flying; - stateTimer->setInterval(50); // More frequent updates - sendCmd(QString("AT*FTRIM=%1\r").arg(seq++)); - - } - if(state==flying) { - if(!fly) { - stateTimer->setInterval(200); // Less frequent updates - state=ready; - } - m_fly=fly; - } - sendCmd(QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28) +(state==flying ? 1<<9:0))); -}; - -void DroneThread::setEmergency(bool emg) -{ - m_emergency=emg; - sendCmd(QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28) + (m_emergency ? 1<<8:0))); - // if(m_emergency==1) - state=ready; -} ; -void DroneThread::setDroneControl(float pitch,float roll,float yaw,float vv) -{ - m_pitch=pitch/200.0*m_fgain; - m_roll=roll/200.0*m_rgain; - m_yaw=yaw/200.0; - m_vv=vv/200.0; - qDebug() << QString("pitch=%1 roll=%2 yaw=%3 vv=%4\r").arg(m_pitch,3,'F',2).arg(m_roll,3,'F',2).arg(m_yaw,3,'F',2).arg(m_vv,3,'F',2); -}; - -void DroneThread::setDroneGain(float fgain,float bgain,float lgain,float rgain) -{ - m_fgain=fgain; - m_bgain=bgain; - m_rgain=rgain; - m_lgain=lgain; -}; - -void DroneThread::sendCmd(QString cmd) -{ - QByteArray dgram; - QString seqCmd=cmd; - if(cmd.contains("%")) seqCmd=cmd.arg(seq++); - dgram=seqCmd.toLatin1(); - cmdSock->writeDatagram(dgram.data(),dgram.size(),droneHost,5556); - seqCmd.chop(1); // Remove training cr - qDebug() << "DroneThread::sendCmd= " << seqCmd << "to " << droneHost ; -} - -void DroneThread::navDataReady() -{ - qint64 l; - char buf[2048]; - QHostAddress host; - quint16 port; - while(navSock->hasPendingDatagrams()) l=navSock->readDatagram(buf,sizeof(buf),&host,&port); -// qDebug() << "DroneThread::navDataReady state=" << state <<" l=" << l << "read=" << buf << "from" << host ; - nd.parseRawNavData((char *)&buf,l); - if(nd.state& (ARDRONE_COM_WATCHDOG_MASK )) - sendCmd(QString("AT*COMWDG=%1\r").arg(seq++)); - switch(state) { - case notInitialized: - sendCmd("AT*CONFIG=%1,\"general:navdata_demo\",\"FALSE\"\r"); - state=initialized; - break; - case initialized: - sendCmd("AT*CTRL=0\r"); - sendCmd("AT*CONFIG=%1,\"detect:detect_type\",\"2\"\r"); - state=ready; - break; - case ready: - break; - } -} - -void DroneThread::sendNav(QString cmd) -{ - QByteArray dgram; - dgram=cmd.toLatin1(); - qDebug() << "DroneThread::sendNav= " << cmd+"\n" << "to " << droneHost ; - navSock->writeDatagram(dgram.data(),dgram.size(),droneHost,5554); -} - - -DroneThread::DroneThread(DroneControl *parentp,QHostAddress host) -{ - qDebug() << "DroneThread::DroneThread"; - stopped=false; - state=notInitialized; - parent=parentp; - navSock=new QUdpSocket(); - navSock->bind(QHostAddress::Any,5554); - cmdSock=new QUdpSocket(); - cmdSock->bind(QHostAddress::Any,5556); - droneHost=host; - seq=1; - m_pitch=0; - m_roll=0; - m_yaw=0; - m_vv=0; - m_fgain=1.0; - m_bgain=1.0; - m_rgain=1.0; - m_lgain=1.0; - start(); - - -}; - -void DroneThread::run() -{ - qDebug() << "DroneThread::DroneThread"; - stateTimer=new QTimer(this); - connect(stateTimer,SIGNAL(timeout()),this,SLOT(timer())); - connect(navSock,SIGNAL(readyRead()),this,SLOT(navDataReady())); - stateTimer->start(1000); - while(!stopped) { - exec(); - } - -} - -void DroneThread::timer() -{ - // qDebug() << "thread Timer"; - switch(state) { - case notInitialized: - sendNav("AT"); - break; - case initialized: - break; - case ready: - sendCmd(QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28))); - break; - case flying: { - float_or_int_t _pitch,_roll,_yaw,_vv; - int r=(m_pitch!=0.0 || m_roll!=0.0)?1:0; - - - _pitch.f=m_pitch; - _roll.f=m_roll; - _yaw.f=m_yaw; - _vv.f=m_vv; -// qDebug() << QString("AT*PCMD=%1,0,%2,%3,%4,%5\r").arg(seq).arg(_roll.f,3,'F',2).arg(_pitch.f,3,'F',2).arg(_vv.f,3,'F',2).arg(_yaw.f,3,'F',2); -// qDebug() << QString("AT*PCMD=%1,0,%2,%3,%4,%5\r").arg(seq).arg(_roll.i,8,16).arg(_pitch.i,8,16).arg(_vv.i,8,16).arg(_yaw.i,8,16); - sendCmd(QString("AT*COMWDG=%1\r").arg(seq++)); - sendCmd(QString("AT*PCMD=%1,%2,%3,%4,%5,%6\r").arg(seq++).arg(r).arg(_roll.i).arg(_pitch.i).arg(_vv.i).arg(_yaw.i)); - - - break; - } -} -} - - - diff --git a/mardrone/dronecontrol.h b/mardrone/dronecontrol.h deleted file mode 100644 index 057833f..0000000 --- a/mardrone/dronecontrol.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef DRONECONTROL_H -#define DRONECONTROL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#undef _GNU_SOURCE // just get rid of error message double definition -#include - -class DroneThread; - -QTM_USE_NAMESPACE - -class DroneControl : public QObject -{ - Q_OBJECT - Q_PROPERTY(float pitch READ pitch WRITE setPitch NOTIFY pitchRollChanged) - Q_PROPERTY(float roll READ roll WRITE setRoll NOTIFY pitchRollChanged) - Q_PROPERTY(float yaw READ yaw WRITE setYaw NOTIFY pitchRollChanged) - Q_PROPERTY(float altitude READ altitude WRITE setAltitude) - Q_PROPERTY(float vVelocity READ vVelocity WRITE setVVelocity NOTIFY pitchRollChanged) - Q_PROPERTY(int enabled READ enabled WRITE setEnabled) - Q_PROPERTY(bool fly READ fly WRITE setFly) - Q_PROPERTY(bool ctrlActive READ ctrlActive WRITE setCtrlActive) - Q_PROPERTY(float dronePitch READ dronePitch NOTIFY navDataChanged) - Q_PROPERTY(float droneRoll READ droneRoll NOTIFY navDataChanged) - Q_PROPERTY(float droneYaw READ droneYaw NOTIFY navDataChanged) - Q_PROPERTY(float droneVBat READ droneVBat NOTIFY navDataChanged) - Q_PROPERTY(float droneAltitude READ droneAltitude NOTIFY navDataChanged) - Q_PROPERTY(bool emergency READ emergency WRITE setEmergency) - Q_PROPERTY(QString decodedStatus READ decodedStatus NOTIFY statusChanged) - Q_PROPERTY(int pwm_motor1 READ pwm_motor1 NOTIFY navDataChanged) - Q_PROPERTY(int pwm_motor2 READ pwm_motor1 NOTIFY navDataChanged) - Q_PROPERTY(int pwm_motor3 READ pwm_motor1 NOTIFY navDataChanged) - Q_PROPERTY(int pwm_motor4 READ pwm_motor1 NOTIFY navDataChanged) - - - // Config variables from QSettings - Q_PROPERTY(QString confDroneIp READ confDroneIp WRITE setConfDroneIp NOTIFY configChanged) - Q_PROPERTY(bool confShowDebug READ confShowDebug WRITE setConfShowDebug NOTIFY configChanged) - Q_PROPERTY(bool confShowHorizon READ confShowHorizon WRITE setConfShowHorizon NOTIFY configChanged) - Q_PROPERTY(bool confShowGauges READ confShowGauges WRITE setConfShowGauges NOTIFY configChanged) - Q_PROPERTY(bool confUseAccel READ confUseAccel WRITE setConfUseAccel NOTIFY configChanged) - Q_PROPERTY(bool confUseJoyStick READ confUseJoyStick WRITE setConfUseJoyStick NOTIFY configChanged) - Q_PROPERTY(bool confFullScreen READ confFullScreen WRITE setConfFullScreen NOTIFY configChanged) - Q_PROPERTY(float confForwardGain READ confForwardGain WRITE setConfForwardGain NOTIFY configChanged) - Q_PROPERTY(float confBackwardGain READ confBackwardGain WRITE setConfBackwardGain NOTIFY configChanged) - Q_PROPERTY(float confLeftGain READ confLeftGain WRITE setConfLeftGain NOTIFY configChanged) - Q_PROPERTY(float confRightGain READ confRightGain WRITE setConfRightGain NOTIFY configChanged) - Q_PROPERTY(float confCtrlTrsh READ confCtrlTrsh WRITE setConfCtrlTrsh NOTIFY configChanged) - -public: - explicit DroneControl(); - - - float pitch(); void setPitch(float val_); - float roll() ; void setRoll(float val_); - float yaw() ; void setYaw(float val_); - float altitude(); void setAltitude(float val_) ; - float vVelocity();void setVVelocity(float val_) ; - int enabled() ; void setEnabled(int val_) ; - bool emergency();void setEmergency(bool val_) ; - bool fly() ; void setFly(bool val_) ; - bool ctrlActive();void setCtrlActive(bool val_) ; - -// Read only telemetry and drone status - QString decodedStatus(); - int pwm_motor1(); - int pwm_motor2(); - int pwm_motor3(); - int pwm_motor4(); - float droneAltitude(); - float dronePitch(); - float droneRoll(); - float droneYaw(); - float droneVBat(); - -//Config variables - QString confDroneIp(); void setConfDroneIp(QString ip); - bool confShowDebug(); void setConfShowDebug(bool val); - bool confShowHorizon(); void setConfShowHorizon(bool val); - bool confShowGauges(); void setConfShowGauges(bool val); - bool confUseAccel(); void setConfUseAccel(bool val); - bool confFullScreen(); void setConfFullScreen(bool val); - bool confUseJoyStick(); void setConfUseJoyStick(bool val); - float confForwardGain(); void setConfForwardGain(float val); - float confBackwardGain(); void setConfBackwardGain(float val); - float confLeftGain(); void setConfLeftGain(float val); - float confRightGain(); void setConfRightGain(float val); - float confCtrlTrsh(); void setConfCtrlTrsh(float val); -signals: - void navDataChanged(); - void statusChanged(); - void configChanged(); - void pitchRollChanged(); -public slots: - void navDataUpdated(); - void statusUpdated(); - void rotationReadingsChanged(); -private: - - float m_pitch; // pitch in horizon - float m_roll; // Roll in horizon - float m_yaw; // low value to display - float m_vv; // Verticl velocity - float m_altitude; // altitude - float m_rotRefX; // Rotation zero reference - float m_rotRefY; - float m_rotRefZ; - int m_enabled; // Enable flag - bool m_emergency; // Emergency flag - QString _emgReason; // Reason of emergency - bool m_fly; // Fly flag - bool m_ctrlActive; - bool m_useAccel; - float m_ctrlTrsh; // accel controll treshold - - QTcpSocket *ctlSock; // TCP port for control/config data - QUdpSocket *navSock; // Navigation data receive socket port 5554 - QHostAddress droneHost; // Ip address of the drone - - DroneThread *droneThread; - QSettings *droneSettings; - QRotationSensor *rSensor; // used for controllind drone with device rotation -}; - - - -class DroneThread:public QThread { - Q_OBJECT -public: - DroneThread(DroneControl *parentp,QHostAddress host); - - // ~DroneThread (); - void run(); - void sendNav(QString cmd); - void sendCmd(QString cmd); - NavData *navData() { return &nd; }; - - enum droneState { - notInitialized, - initialized, - ready, - flying - - }; -public slots: - void navDataReady(); - void timer(); - void setFly(bool fly); - void setEmergency(bool emg); - void setDroneControl(float pitch,float roll,float yaw,float vv); - void setDroneGain(float fgain,float bgain,float lgain,float rgain); - -private: - - QHostAddress droneHost; // Ip address of the drone - QTimer *stateTimer; - volatile bool stopped; - DroneControl *parent; - QUdpSocket *navSock; // Navigation data receive socket port 5554 - QUdpSocket *cmdSock; // Ay command socket port 5556 - int state; - int seq; // Drone command seq number - bool m_fly; - bool m_emergency; - float m_pitch; - float m_roll; - float m_yaw; - float m_vv; - float m_fgain; - float m_bgain; - float m_rgain; - float m_lgain; - NavData nd; -}; - -#endif // DRONECONTROL_H diff --git a/mardrone/dronelib/dronecontrol.cpp b/mardrone/dronelib/dronecontrol.cpp index 735456c..ca6aab4 100644 --- a/mardrone/dronelib/dronecontrol.cpp +++ b/mardrone/dronelib/dronecontrol.cpp @@ -28,29 +28,29 @@ #include #include #include +#include "navdata.h" +#include "ardrone_api.h" DroneControl::DroneControl():QObject() { qDebug() << "DroneControl::DroneControl"; -// ctlSock=new QTcpSocket(); -// ctlSock->bind(QHostAddress::Any,5559); -// navSock=new QUdpSocket(); -// navSock->bind(QHostAddress::Any,5554) - //connect(navSocket,SIGNAL(readyRead()),SLOT(navDataReady())); - droneHost.setAddress("192.168.1.1"); - droneThread=new DroneThread(this,droneHost); - connect(droneThread->navData(),SIGNAL(navDataUpdated()),this,SLOT(navDataUpdated())); - connect(droneThread->navData(),SIGNAL(stateUpdated()),this,SLOT(statusUpdated())); + + droneSettings=new QSettings("katix.org","mardrone"); m_ctrlActive=false; m_pitch=0; m_roll=0; m_yaw=0; m_vv=0; + m_connected=FALSE; m_useAccel=droneSettings->value("useAccel",false).toBool(); m_useJoyStick=droneSettings->value("useJoyStick",false).toBool(); m_ctrlTrsh=droneSettings->value("ctrlTreshold",10.0).toFloat(); + droneHost.setAddress(confDroneIp()); + droneThread=new DroneThread(this,droneHost); + connect(droneThread->navData(),SIGNAL(navDataUpdated()),this,SLOT(navDataUpdated())); + connect(droneThread->navData(),SIGNAL(stateUpdated()),this,SLOT(statusUpdated())); #ifdef QT_SENSORS rSensor=new QRotationSensor(); rSensor->start(); @@ -84,6 +84,11 @@ void DroneControl::rotationReadingsChanged() #endif } +void DroneControl::setConnected(bool val_) +{ + m_connected=val_; + emit connectedChanged(); +} void DroneControl::navDataUpdated() { emit navDataChanged(); @@ -100,6 +105,7 @@ void DroneControl::setPitch(float val_) m_pitch=val_; // qDebug() << "setPitch=" << val_; droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); + emit pitchRollChanged(); }; float DroneControl::pitch() {return m_pitch;}; @@ -108,6 +114,7 @@ void DroneControl::setRoll(float val_) m_roll=val_; // qDebug() << "setRoll=" << val_; droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); + emit pitchRollChanged(); }; float DroneControl::roll() {return m_roll;}; void DroneControl::setYaw(float val) { @@ -115,6 +122,7 @@ void DroneControl::setYaw(float val) { // qDebug() << "setYaw=" << val; if(m_useAccel && m_ctrlActive) m_yaw=(fabs(m_yaw)<(m_ctrlTrsh*2) ) ? 0:(m_yaw>0 ? m_yaw-(m_ctrlTrsh*2):m_yaw+(m_ctrlTrsh*2)); droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); + emit pitchRollChanged(); }; float DroneControl::yaw() {return m_yaw;}; void DroneControl::setVVelocity(float val) { @@ -122,6 +130,7 @@ void DroneControl::setVVelocity(float val) { if(m_useAccel && m_ctrlActive) m_vv=(fabs(m_vv)<(m_ctrlTrsh*2) ) ? 0:(m_vv>0? m_vv-(m_ctrlTrsh*2):m_vv+(m_ctrlTrsh*2)); // qDebug() << "setVv=" << val_; droneThread->setDroneControl(m_pitch,m_roll,m_yaw,m_vv); + emit pitchRollChanged(); }; float DroneControl::vVelocity() {return m_vv;}; void DroneControl::setAltitude(float val_) {m_altitude=val_;}; @@ -376,11 +385,12 @@ void DroneThread::sendCmd(QString cmd) { QByteArray dgram; QString seqCmd=cmd; + noreply++; if(cmd.contains("%")) seqCmd=cmd.arg(seq++); dgram=seqCmd.toLatin1(); cmdSock->writeDatagram(dgram.data(),dgram.size(),droneHost,5556); seqCmd.chop(1); // Remove training cr -// qDebug() << "DroneThread::sendCmd= " << seqCmd << "to " << droneHost ; + // qDebug() << "DroneThread::sendCmd= " << seqCmd << "to " << droneHost ; } void DroneThread::navDataReady() @@ -389,24 +399,44 @@ void DroneThread::navDataReady() char buf[2048]; QHostAddress host; quint16 port; + QString cmd; + bool ack; + noreply=0; // We got a reply + cmd="";ack=false; while(navSock->hasPendingDatagrams()) l=navSock->readDatagram(buf,sizeof(buf),&host,&port); // qDebug() << "DroneThread::navDataReady state=" << state <<" l=" << l << "read=" << buf << "from" << host ; nd.parseRawNavData((char *)&buf,l); + if(nd.state& (ARDRONE_NAVDATA_BOOTSTRAP)) state=notInitialized; if(nd.state& (ARDRONE_COM_WATCHDOG_MASK )) - sendCmd(QString("AT*COMWDG=%1\r").arg(seq++)); + cmd+=QString("AT*COMWDG=%1\r").arg(seq++); + if((nd.state& (ARDRONE_COMMAND_MASK ))) { + cmd+=QString("AT*CTRL=%1,%2,0\r").arg(seq++).arg(ACK_CONTROL_MODE); + ack=true; + }; switch(state) { case notInitialized: - sendCmd("AT*CONFIG=%1,\"general:navdata_demo\",\"FALSE\"\r"); - state=initialized; + cmd+=QString("AT*CONFIG=%1,\"general:navdata_demo\",\"TRUE\"\r").arg(seq++); + // cmd+=QString("AT*CONFIG=%1,\"general:navdata_options\",\"%3\"\r").arg(seq++).arg(NAVDATA_OPTION_FULL_MASK); + // cmd+=QString("AT*CONFIG=%1,\"video:codec\",\"%2\"\r").arg(seq++).arg(0x20); + state=bootstrap; + retry=10; + qDebug() << "Connected to drone" << seq << navData()->decodedState; + parent->setConnected(TRUE); // We are connected to drone + break; + case bootstrap: + if(ack) state=initialized; + else + if(--retry<=0) state=notInitialized; break; case initialized: - sendCmd("AT*CTRL=0\r"); - sendCmd("AT*CONFIG=%1,\"detect:detect_type\",\"2\"\r"); + cmd+=QString("AT*CTRL=%1,0\r").arg(seq++); + cmd+=QString("AT*CONFIG=%1,\"detect:detect_type\",\"2\"\r").arg(seq++); state=ready; break; case ready: break; } + if(!cmd.isEmpty())sendCmd(cmd); // don't send null cmd } void DroneThread::sendNav(QString cmd) @@ -422,25 +452,32 @@ DroneThread::DroneThread(DroneControl *parentp,QHostAddress host) { struct ip_mreq imreq; + QString my_ip; qDebug() << "DroneThread::DroneThread"; + my_ip="192.168.1.2"; stopped=false; state=notInitialized; parent=parentp; navSock=new QUdpSocket(); QList netconfs=QNetworkConfigurationManager().allConfigurations(); foreach (QNetworkConfiguration np,netconfs) { - qDebug() << "network COnfifuration name " << np.name() << np.bearerName() << np.bearerTypeName(); + qDebug() << "network Confifuration name " << np.name() << np.bearerName() << np.bearerTypeName(); QNetworkSession ns(np); if(ns.interface().addressEntries().empty()) qDebug() << "network session " << ns.interface().humanReadableName() << "**NotConfig**"; - else - qDebug() << "network session " << ns.interface().humanReadableName() << ns.interface().addressEntries().first().ip(); + else { + qDebug() << "network session " << ns.interface().humanReadableName() << ns.interface().addressEntries().first().ip(); + // Ubuntu may give wlan0 as "Ethernet" + if((np.bearerName()==QString("WLAN")) || (ns.interface().humanReadableName()==QString("wlan0")) ) { + my_ip=ns.interface().addressEntries().first().ip().toString(); + qDebug() << "My IP is " << my_ip; + } + } } - if(!navSock->bind(QHostAddress::Any,5554)) qDebug() << "Cant open any: 5554" << navSock->errorString() ; imreq.imr_multiaddr.s_addr=inet_addr("224.1.1.1"); - imreq.imr_interface.s_addr=inet_addr("192.168.1.2"); + imreq.imr_interface.s_addr=inet_addr(my_ip.toAscii()); setsockopt(navSock->socketDescriptor(),IPPROTO_IP,IP_ADD_MEMBERSHIP,&imreq,sizeof(imreq)); cmdSock=new QUdpSocket(); cmdSock->bind(QHostAddress::Any,5556); @@ -454,6 +491,7 @@ DroneThread::DroneThread(DroneControl *parentp,QHostAddress host) m_bgain=1.0; m_rgain=1.0; m_lgain=1.0; + noreply=0; start(); @@ -465,7 +503,7 @@ void DroneThread::run() stateTimer=new QTimer(this); connect(stateTimer,SIGNAL(timeout()),this,SLOT(timer())); connect(navSock,SIGNAL(readyRead()),this,SLOT(navDataReady())); - stateTimer->start(1000); + stateTimer->start(100); while(!stopped) { exec(); } @@ -474,15 +512,26 @@ void DroneThread::run() void DroneThread::timer() { + QString cmd; // qDebug() << "thread Timer"; + noreply++; + if(noreply>50 ) { + cmd+=QString("AT*COMWDG=%1\r").arg(seq++); + navData()->setState("**TimeOut**"); + qDebug("Timeout"); + noreply=0; + }; switch(state) { case notInitialized: - sendNav("AT"); - break; - case initialized: + sendNav("AT\r"); + // cmd+=QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28)); break; + case bootstrap: + case initialized: + cmd+=QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28)); + break; case ready: - sendCmd(QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28))); + cmd+=QString("AT*REF=%1,%2\r").arg(seq++).arg((1<<18) + (1<<20) + (1<<22) + (1<<24) +(1<<28)); break; case flying: { float_or_int_t _pitch,_roll,_yaw,_vv; @@ -495,13 +544,14 @@ void DroneThread::timer() _vv.f=m_vv; // qDebug() << QString("AT*PCMD=%1,0,%2,%3,%4,%5\r").arg(seq).arg(_roll.f,3,'F',2).arg(_pitch.f,3,'F',2).arg(_vv.f,3,'F',2).arg(_yaw.f,3,'F',2); // qDebug() << QString("AT*PCMD=%1,0,%2,%3,%4,%5\r").arg(seq).arg(_roll.i,8,16).arg(_pitch.i,8,16).arg(_vv.i,8,16).arg(_yaw.i,8,16); - sendCmd(QString("AT*COMWDG=%1\r").arg(seq++)); - sendCmd(QString("AT*PCMD=%1,%2,%3,%4,%5,%6\r").arg(seq++).arg(r).arg(_roll.i).arg(_pitch.i).arg(_vv.i).arg(_yaw.i)); + cmd+=QString("AT*COMWDG=%1\r").arg(seq++); + cmd+=QString("AT*PCMD=%1,%2,%3,%4,%5,%6\r").arg(seq++).arg(r).arg(_roll.i).arg(_pitch.i).arg(_vv.i).arg(_yaw.i); break; } } + if(!cmd.isEmpty())sendCmd(cmd); } diff --git a/mardrone/dronelib/dronecontrol.h b/mardrone/dronelib/dronecontrol.h index 1efc695..f5c77f7 100644 --- a/mardrone/dronelib/dronecontrol.h +++ b/mardrone/dronelib/dronecontrol.h @@ -42,6 +42,7 @@ class DroneControl : public QObject Q_PROPERTY(float droneSpeed READ droneSpeed NOTIFY navDataChanged) Q_PROPERTY(float droneAltitude READ droneAltitude NOTIFY navDataChanged) Q_PROPERTY(bool emergency READ emergency WRITE setEmergency) + Q_PROPERTY(bool connected READ connected WRITE setConnected NOTIFY connectedChanged) Q_PROPERTY(QString decodedStatus READ decodedStatus NOTIFY statusChanged) Q_PROPERTY(int pwm_motor1 READ pwm_motor1 NOTIFY navDataChanged) @@ -49,35 +50,7 @@ class DroneControl : public QObject Q_PROPERTY(int pwm_motor3 READ pwm_motor1 NOTIFY navDataChanged) Q_PROPERTY(int pwm_motor4 READ pwm_motor1 NOTIFY navDataChanged) -#if 0 - Q_PROPERTY(bool confHaveJoyStick READ confHaveJoyStick NOTIFY configChanged) - Q_PROPERTY(QString joyStickName READ joyStickName NOTIFY statusChanged) - Q_PROPERTY(int joyStickRawAxis1 READ joyStickRawAxis1 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickRawAxis2 READ joyStickRawAxis2 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickRawAxis3 READ joyStickRawAxis3 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickRawAxis4 READ joyStickRawAxis4 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickRawAxis5 READ joyStickRawAxis5 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickRawAxis6 READ joyStickRawAxis6 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMaxAxis1 READ joyStickMaxAxis1 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMaxAxis2 READ joyStickMaxAxis2 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMaxAxis3 READ joyStickMaxAxis3 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMaxAxis4 READ joyStickMaxAxis4 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMaxAxis5 READ joyStickMaxAxis5 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMaxAxis6 READ joyStickMaxAxis6 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMinAxis1 READ joyStickMinAxis1 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMinAxis2 READ joyStickMinAxis2 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMinAxis3 READ joyStickMinAxis3 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMinAxis4 READ joyStickMinAxis4 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMinAxis5 READ joyStickMinAxis5 NOTIFY joyStickChanged) - Q_PROPERTY(int joyStickMinAxis6 READ joyStickMinAxis6 NOTIFY joyStickChanged) - Q_PROPERTY(float joyStickAxis1 READ joyStickAxis1 NOTIFY joyStickChanged) - Q_PROPERTY(float joyStickAxis2 READ joyStickAxis2 NOTIFY joyStickChanged) - Q_PROPERTY(float joyStickAxis3 READ joyStickAxis3 NOTIFY joyStickChanged) - Q_PROPERTY(float joyStickAxis4 READ joyStickAxis4 NOTIFY joyStickChanged) - Q_PROPERTY(float joyStickAxis5 READ joyStickAxis5 NOTIFY joyStickChanged) - Q_PROPERTY(float joyStickAxis6 READ joyStickAxis6 NOTIFY joyStickChanged) - Q_PROPERTY(bool joyStickCalibrate READ joyStickCalibrate WRITE setJoyStickCalibrate) -#endif + // Config variables from QSettings Q_PROPERTY(QString confDroneIp READ confDroneIp WRITE setConfDroneIp NOTIFY configChanged) Q_PROPERTY(QString confActiveUI READ confActiveUI WRITE setConfActiveUI NOTIFY configChanged) @@ -110,36 +83,9 @@ public: // Read only telemetry and drone status QString decodedStatus(); -#ifdef JOYSTICK -// JoyStick configuration - QString joyStickName() { return m_joyStickName; }; - int joyStickRawAxis1() { return m_joyStickRawAxis1; }; - int joyStickRawAxis2() { return m_joyStickRawAxis2; }; - int joyStickRawAxis3() { return m_joyStickRawAxis3; }; - int joyStickRawAxis4() { return m_joyStickRawAxis4; }; - int joyStickRawAxis5() { return m_joyStickRawAxis5; }; - int joyStickRawAxis6() { return m_joyStickRawAxis6; }; - int joyStickMaxAxis1() { return m_joyStickMaxAxis1; }; - int joyStickMaxAxis2() { return m_joyStickMaxAxis2; }; - int joyStickMaxAxis3() { return m_joyStickMaxAxis3; }; - int joyStickMaxAxis4() { return m_joyStickMaxAxis4; }; - int joyStickMaxAxis5() { return m_joyStickMaxAxis5; }; - int joyStickMaxAxis6() { return m_joyStickMaxAxis6; }; - int joyStickMinAxis1() { return m_joyStickMinAxis1; }; - int joyStickMinAxis2() { return m_joyStickMinAxis2; }; - int joyStickMinAxis3() { return m_joyStickMinAxis3; }; - int joyStickMinAxis4() { return m_joyStickMinAxis4; }; - int joyStickMinAxis5() { return m_joyStickMinAxis5; }; - int joyStickMinAxis6() { return m_joyStickMinAxis6; }; - float joyStickAxis1() { return m_joyStickAxis1; }; - float joyStickAxis2() { return m_joyStickAxis2; }; - float joyStickAxis3() { return m_joyStickAxis3; }; - float joyStickAxis4() { return m_joyStickAxis4; }; - float joyStickAxis5() { return m_joyStickAxis5; }; - float joyStickAxis6() { return m_joyStickAxis6; }; - bool joyStickCalibrate() { return m_joyCal; }; - void setJoyStickCalibrate(bool val) { m_joyCal=val;}; -#endif + + bool connected() { return m_connected; }; + void setConnected(bool val_); int pwm_motor1(); int pwm_motor2(); @@ -173,6 +119,7 @@ signals: void configChanged(); void pitchRollChanged(); void joyStickChanged(); + void connectedChanged(); public slots: void navDataUpdated(); void statusUpdated(); @@ -198,38 +145,8 @@ private: bool m_ctrlActive; bool m_useAccel; bool m_useJoyStick; + bool m_connected; -#ifdef JOYSTICK -// Joystick - bool m_haveJoyStick; - QString m_joyStickName; - bool m_joyCal; - int m_joyStickRawAxis1; - int m_joyStickRawAxis2; - int m_joyStickRawAxis3; - int m_joyStickRawAxis4; - int m_joyStickRawAxis5; - int m_joyStickRawAxis6; - float m_joyStickAxis1; - float m_joyStickAxis2; - float m_joyStickAxis3; - float m_joyStickAxis4; - float m_joyStickAxis5; - float m_joyStickAxis6; - int m_joyStickMinAxis1; - int m_joyStickMinAxis2; - int m_joyStickMinAxis3; - int m_joyStickMinAxis4; - int m_joyStickMinAxis5; - int m_joyStickMinAxis6; - int m_joyStickMaxAxis1; - int m_joyStickMaxAxis2; - int m_joyStickMaxAxis3; - int m_joyStickMaxAxis4; - int m_joyStickMaxAxis5; - int m_joyStickMaxAxis6; - int m_joyStickMapAxis[6]; -#endif @@ -241,10 +158,7 @@ private: DroneThread *droneThread; QSettings *droneSettings; -#ifdef HAVE_SDL - QTimer joyStickTimer; - SDL_Joystick *joyStick; -#endif + #ifdef QT_SENSORS QRotationSensor *rSensor; // used for controllind drone with device rotation #endif @@ -266,6 +180,7 @@ public: enum droneState { notInitialized, initialized, + bootstrap, ready, flying @@ -287,6 +202,8 @@ private: QUdpSocket *navSock; // Navigation data receive socket port 5554 QUdpSocket *cmdSock; // Ay command socket port 5556 int state; + int retry; // retry counter + int noreply; // No reply counter incremented every sedcmd, cleared when got reply int seq; // Drone command seq number bool m_fly; bool m_emergency; diff --git a/mardrone/dronelib/dronecontrol.o b/mardrone/dronelib/dronecontrol.o deleted file mode 100644 index 6c05051..0000000 Binary files a/mardrone/dronelib/dronecontrol.o and /dev/null differ diff --git a/mardrone/dronelib/navdata.cpp b/mardrone/dronelib/navdata.cpp index 7b61e43..f3b7261 100644 --- a/mardrone/dronelib/navdata.cpp +++ b/mardrone/dronelib/navdata.cpp @@ -26,8 +26,14 @@ NavData::NavData(QObject *parent) : QObject(parent) { vx=0;vy=0;vz=0;pwm_motor1=0;pwm_motor2=0;pwm_motor3=0;pwm_motor4=0; - vbat=0.0;pitch=0.0;roll=0.0;yaw=0.0;altitude=0.0; + vbat=0.0;pitch=0.0;roll=0.0;yaw=0.0;altitude=0.0;navSeq=0; } +void NavData::setState(QString _state) +{ + decodedState=_state; + oldState=0; + emit stateUpdated(); +}; void NavData::parseRawNavData(char *buf,unsigned int len) { @@ -44,18 +50,18 @@ void NavData::parseRawNavData(char *buf,unsigned int len) qDebug("parseRawNavData hdr=%8x state=%08x seq=%06d opt[0].tag=%d size=%d", nd->header,nd->ardrone_state,nd->sequence,nd->options[0].tag,nd->options[0].size); #endif - qDebug() << decodedState; +// qDebug() << len << decodedState; op=&(nd->options[0]); - while((((unsigned int)op-(unsigned int)buf)size>0)) + while((((unsigned long)op-(unsigned long)buf)size>0)) { parseOption(op); - op=(navdata_option_t *)((unsigned int)op+op->size); + op=(navdata_option_t *)((unsigned long)op+op->size); } }; void NavData::parseOption(navdata_option_t *op) { - // qDebug("parseOption tag=%d size=%d",op->tag,op->size); +// qDebug("parseOption tag=%d size=%d",op->tag,op->size); switch(op->tag) { case NAVDATA_DEMO_TAG: { @@ -69,7 +75,7 @@ void NavData::parseOption(navdata_option_t *op) vy=ndemo->vy; vz=ndemo->vz; emit navDataUpdated(); -// qDebug("pitch=%2.1f roll=%2.1f yaw=%2.1f alt=%2.1f v(%2.1f,%2.1f,%2.1f bat=%2.1f",pitch,roll,yaw,altitude,vx,vy,vz,vbat); + // qDebug("NAVDATA_DEMO:pitch=%2.1f roll=%2.1f yaw=%2.1f alt=%2.1f v(%2.1f,%2.1f,%2.1f bat=%2.1f",pitch,roll,yaw,altitude,vx,vy,vz,vbat); } break; case NAVDATA_TIME_TAG: @@ -112,8 +118,8 @@ void NavData::parseOption(navdata_option_t *op) current_motor4=npwm->current_motor4; pwm_motor4=npwm->motor4; emit navDataUpdated(); - // qDebug("pwm1=%3d I1=%4f pwm2=%3d I2=%4f pwm3=%3d I3=%4f pwm4=%3d I4=%4f", - // pwm_motor1,current_motor1,pwm_motor2,current_motor2,pwm_motor3,current_motor3,pwm_motor4,current_motor4); + // qDebug("pwm1=%3d I1=%4f pwm2=%3d I2=%4f pwm3=%3d I3=%4f pwm4=%3d I4=%4f", + // pwm_motor1,current_motor1,pwm_motor2,current_motor2,pwm_motor3,current_motor3,pwm_motor4,current_motor4); } break; case NAVDATA_ALTITUDE_TAG: //10 @@ -154,8 +160,8 @@ void NavData::parseOption(navdata_option_t *op) QString NavData::decodeState(unsigned int state,int level) { - QString s="%1 "; - s=s.arg(state,8,16); + QString s; + s=QString("%1 %2 ").arg(navSeq++).arg(state,8,16); s+=(state & ARDRONE_FLY_MASK)==0 ? "landed ":"flying "; if(level>1) s+=(state & ARDRONE_VIDEO_MASK)==0 ?"video disable ":"video ena "; if(level>1)s+=(state & ARDRONE_VISION_MASK)==0 ? "vision disable ":"vision ena "; @@ -167,7 +173,7 @@ QString NavData::decodeState(unsigned int state,int level) // s+=(state & ARDRONE_FW_VER_MASK )==0 ? /* Firmware update is newer; // ARDRONE_FW_UPD_MASK = 1 << 9, /* Firmware update is ongoing (1; s+=(state & ARDRONE_NAVDATA_DEMO_MASK )==0 ? "All navdata ":"navdata demo "; - s+=(state & ARDRONE_NAVDATA_BOOTSTRAP)==0 ? "":"Navdata bootstrap "; + s+=(state & ARDRONE_NAVDATA_BOOTSTRAP)==0 ? "":"Navdata bootstrap "; // s+=(state & ARDRONE_MOTORS_MASK)==0 ? /*!< Motors status : (0) Ok, (1) Motors problem */ s+=(state & ARDRONE_COM_LOST_MASK)? "Com Lost ":"Com ok "; if(level>1)s+=(state & ARDRONE_VBAT_LOW) ? "VBat low ":"Vbat Ok "; diff --git a/mardrone/dronelib/navdata.h b/mardrone/dronelib/navdata.h index f46ed61..f68b21f 100644 --- a/mardrone/dronelib/navdata.h +++ b/mardrone/dronelib/navdata.h @@ -22,6 +22,7 @@ public: explicit NavData(QObject *parent = 0); void parseRawNavData(char *buf,unsigned int len); void parseOption(navdata_option_t *op); + void setState(QString state); QString decodeState(unsigned int state,int level); unsigned int state,oldState; @@ -44,6 +45,7 @@ public: int pwm_motor3; int pwm_motor4; tag_t tags[4]; + int navSeq; signals: void navDataUpdated(); void stateUpdated(); diff --git a/mardrone/dronelib/navdata.o b/mardrone/dronelib/navdata.o deleted file mode 100644 index 4388177..0000000 Binary files a/mardrone/dronelib/navdata.o and /dev/null differ diff --git a/mardrone/dronelib/video.cpp b/mardrone/dronelib/video.cpp index 0aa269b..5bf3328 100644 --- a/mardrone/dronelib/video.cpp +++ b/mardrone/dronelib/video.cpp @@ -102,7 +102,7 @@ void VideoThread::run() picture.cr_line_size = pictureWidth / 2; picture.y_pad = 0; picture.c_pad = 0; - video_codec_open(&controller, (codec_type_t)UVLC_CODEC); + qDebug() << "video_codec_open=" << video_codec_open(&controller, (codec_type_t)codec_type); //stateTimer->start(1000); qDebug() << "videoThread::run() initialized"; sendVideoPort("AT"); @@ -149,8 +149,9 @@ void VideoThread::decodeTransform(QByteArray &videoData) controller.in_stream.code = 0; bool_t got_image = FALSE; - //qDebug() <<"VideoThread::decodeTransform"; - video_decode_blockline( &controller, &picture, &got_image ); + //qDebug() <<"VideoThread::decodeTransform" << controller.video_codec; + if(controller.video_codec!=NULL) video_decode_blockline( &controller, &picture, &got_image ); + //else qDebug() << "No video controller"; //qDebug() <<"VideoThread::decodeTransform 2"; //video_decode_picture( &controller, &picture, &stream, &got_image ); if( got_image ) diff --git a/mardrone/dronelib/video.o b/mardrone/dronelib/video.o deleted file mode 100644 index 282cc27..0000000 Binary files a/mardrone/dronelib/video.o and /dev/null differ diff --git a/mardrone/gauge.cpp b/mardrone/gauge.cpp deleted file mode 100644 index f057263..0000000 --- a/mardrone/gauge.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*================================================================== - ! - ! mardrone application AR-Drone for MeeGo - - ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - ! All rights reserved. - ! - ! Author:Kate Alhola kate.alhola@nokia.com - ! - ! GNU Lesser General Public License Usage - ! This file may be used under the terms of the GNU Lesser - ! General Public License version 2.1 as published by the Free Software - ! Foundation and appearing in the file LICENSE.LGPL included in the - ! packaging of this file. Please review the following information to - ! ensure the GNU Lesser General Public License version 2.1 requirements - ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - ! - ! - ! - *===================================================================*/ - -#include "gauge.h" -#include "qgraphicswidget.h" -#include "QGraphicsItem" -#include -#include - -Gauge::Gauge(QGraphicsItem *parent) : - QGraphicsWidget(parent) -{ - qDebug() << "Gauge::Gauge()"; -} -#if 1 -void Gauge::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - - } -#endif -void Gauge::setValue(float val_) -{ - m_value=val_; - update(boundingRect()); // Value updated, schedule redtaw -}; -float Gauge::value() -{ - return m_value; -}; - -QRectF Gauge::boundingRect() const - { - return QRectF(0.0,0.0,size().width(),size().height()); - } diff --git a/mardrone/gauge.h b/mardrone/gauge.h deleted file mode 100644 index c6d6f17..0000000 --- a/mardrone/gauge.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef GAUGEBAND_H -#define GAUGEBAND_H - -#include -#include -#include - -#define UP 1 -#define RIGHT 2 -#define DOWN 3 -#define LEFT 4 - -#define SCROLL 0x10 -#define SCROLL_UP 0x11 -#define SCROLL_RIGHT 0x12 -#define SCROLL_DOWN 0x13 -#define SCROLL_LEFT 0x14 - -class Gauge : public QGraphicsWidget -{ - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QString format READ format WRITE setFormat) - Q_PROPERTY(int gaugeStyle READ gaugeStyle WRITE setGaugeStyle) - Q_PROPERTY(float value2 READ value2 WRITE setValue2) - Q_PROPERTY(float value READ value WRITE setValue) - Q_PROPERTY(float low READ low WRITE setLow) - Q_PROPERTY(float high READ high WRITE setHigh) - Q_PROPERTY(float lowRed READ lowRed WRITE setLowRed) - Q_PROPERTY(float highRed READ highRed WRITE setHighRed) - Q_PROPERTY(float tickIncrement READ tickIncrement WRITE setTickIncrement) - -public: - explicit Gauge(QGraphicsItem *parent = 0); - - - virtual void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget); - - QRectF boundingRect() const; - - QString name() const { return m_name;}; - void setName(const QString &name_) {m_name=name_;} - QString format() const { return m_format;}; - void setFormat(const QString &name_) {m_format=name_;} - void setGaugeStyle(int val_) { m_style=val_;}; - int gaugeStyle() {return m_style;}; - void setValue(float val_); - float value(); - void setValue2(float val_) { m_value2=val_;}; - float value2() {return m_value2;}; - void setLow(float val_) { m_low=val_;}; - float low() {return m_low;}; - void setHigh(float val_) { m_high=val_;}; - float high() {return m_high;}; - void setLowRed(float val_) { m_lowred=val_;}; - float lowRed() {return m_lowred;}; - void setHighRed(float val_) { m_highred=val_;}; - float highRed() {return m_highred;}; - void setTickIncrement(float val_) { m_tickIncrement=val_;}; - float tickIncrement() {return m_tickIncrement;}; - -signals: - -public slots: -public: - QString m_name; - QString m_format; - int m_tickIncrement; // Tick increment - int m_tspc; // Tick spacing - int m_style; - float m_value; // primary value,pitch in horizon - float m_value2; // Roll in horizon - float m_low; // low value to display - float m_high; // High value to display - float m_lowred; // low red limit - float m_lowyellow; // low yellow limit - float m_highyellow; // higest yellow limit - float m_highred; -}; - -#endif // GAUGE_H diff --git a/mardrone/gaugehorizon.cpp b/mardrone/gaugehorizon.cpp deleted file mode 100644 index 966b1c5..0000000 --- a/mardrone/gaugehorizon.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/*================================================================== - ! - ! mardrone application AR-Drone for MeeGo - - ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - ! All rights reserved. - ! - ! Author:Kate Alhola kate.alhola@nokia.com - ! - ! GNU Lesser General Public License Usage - ! This file may be used under the terms of the GNU Lesser - ! General Public License version 2.1 as published by the Free Software - ! Foundation and appearing in the file LICENSE.LGPL included in the - ! packaging of this file. Please review the following information to - ! ensure the GNU Lesser General Public License version 2.1 requirements - ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - ! - ! - ! - *===================================================================*/ - -#include "gaugehorizon.h" -#include -#include - -GaugeHorizon::GaugeHorizon(QGraphicsItem *parent) : - Gauge(parent) -{ -} - - - -void GaugeHorizon::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - drawHorizon(painter,-1.0*m_value,5*m_value2); -}; -////////////////////////////////////////////////////////////////////////// -void GaugeHorizon::drawHorizon(QPainter *painter, float roll, float pitch) - { - QRect update_rect; - QPoint points[10]; - //QPoint plane[10]; - QVector plane; - QVector fixo; - int tx, ctx, xd, i, j ; - int xo, yo, x1, x2, y1, y2; - - xo=size().width()/2; - yo=size().height()/2; - - plane+=QLine(xo-50,yo,xo-20,yo); - plane+=QLine(xo-20,yo,xo-10,yo+10); - plane+=QLine(xo-10,yo+10,xo,yo); - plane+=QLine(xo,yo,xo+10,yo+10); - plane+=QLine(xo+20,yo,xo+10,yo+10); - plane+=QLine(xo+50,yo,xo+20,yo); - - - static float sintable[]={sin(15*3.141592653/180.0), - sin(30*3.141592653/180.0), - sin(45*3.141592653/180.0), - sin(60*3.141592653/180.0)}; - - static float costable[]={cos(15*3.141592653/180.0), - cos(30*3.141592653/180.0), - cos(45*3.141592653/180.0), - cos(60*3.141592653/180.0)}; - - i = 0; - int arc0=130; - int arc1=150; - fixo+=QLine(xo,yo-arc0,xo,yo-arc1); - for (i = 0; i < 4; i++) { - fixo+=QLine(xo+arc0*costable[i],yo-arc0*sintable[i],xo+arc1*costable[i],yo-arc1*sintable[i]); - fixo+=QLine(xo-arc0*costable[i],yo-arc0*sintable[i],xo-arc1*costable[i],yo-arc1*sintable[i]); - }; - - - tx = (int)(xo * tan(roll * 3.141592653/180.0)); - xd = yo + pitch * 4; - - QTransform savematrix= painter->transform (); - // painter->setClipRect(QRect(0,0, size().width(),size().height()/2)); - - painter->setTransform(QTransform().translate(xo+scenePos().x(), yo+scenePos().y()+pitch).rotate(roll)); - - QBrush whitebrush(Qt::green); - painter->setBrush(whitebrush); - QPen whitepen(Qt::green); - whitepen.setWidth(2); - painter->setPen(whitepen); - xo=0;yo=0; - - painter->drawLine(50+xo, 0+yo,-50+xo, 0+yo); - painter->drawLine(40+xo, 50+yo,-40+xo, 50+yo); - painter->drawLine(40+xo, 100+yo,-40+xo, 100+yo); - painter->drawLine(40+xo, -50+yo,-40+xo, -50+yo); - painter->drawLine(40+xo, -100+yo,-40+xo,-100+yo); - - painter->drawText( 43+xo,-40+yo,"10"); - painter->drawText(-63+xo,-40+yo,"10"); - painter->drawText( 43+xo,-90+yo,"20"); - painter->drawText(-63+xo,-90+yo,"20"); - painter->drawText( 43+xo, 40+yo,"10"); - painter->drawText(-63+xo, 40+yo,"10"); - painter->drawText( 43+xo, 90+yo,"20"); - painter->drawText(-63+xo, 90+yo,"20"); - - - // painter->rotate(0); - painter->setTransform(savematrix); - QPen bluepen(Qt::blue); - bluepen.setWidth(2); - painter->setPen(bluepen); - painter->drawLines(fixo); - painter->drawLines(plane); - - - -} - diff --git a/mardrone/gaugehorizon.h b/mardrone/gaugehorizon.h deleted file mode 100644 index bf46920..0000000 --- a/mardrone/gaugehorizon.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef GAUGELABEL_H -#define GAUGELABEL_H -#include "gauge.h" - -class GaugeHorizon : public Gauge -{ - Q_OBJECT -public: - explicit GaugeHorizon(QGraphicsItem *parent = 0); - void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget); - void drawHorizon(QPainter *painter,float pitch,float roll); -signals: -}; - -#endif // GAUGELABEL_H diff --git a/mardrone/gaugelabel.cpp b/mardrone/gaugelabel.cpp deleted file mode 100644 index 46391b9..0000000 --- a/mardrone/gaugelabel.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/*================================================================== - ! - ! mardrone application AR-Drone for MeeGo - - ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - ! All rights reserved. - ! - ! Author:Kate Alhola kate.alhola@nokia.com - ! - ! GNU Lesser General Public License Usage - ! This file may be used under the terms of the GNU Lesser - ! General Public License version 2.1 as published by the Free Software - ! Foundation and appearing in the file LICENSE.LGPL included in the - ! packaging of this file. Please review the following information to - ! ensure the GNU Lesser General Public License version 2.1 requirements - ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - ! - ! - ! - *===================================================================*/ - -#include "gaugelabel.h" -#include - - -GaugeLabel::GaugeLabel(QGraphicsItem *parent) : - Gauge(parent) -{ -} - -void GaugeLabel::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - drawNumLabel(painter); -}; -////////////////////////////////////////////////////////////////////////// -void GaugeLabel::drawNumLabel(QPainter *painter) -{ - int ld,ldo,ud,lo; - int split,uw,base; - char text[20] = {0}; - int h=size().height(); - int w=size().width(); - int val=m_value; - painter->save(); - qDebug() <<"drawnumlabel=" << m_name << " h=" << h << "w=" << w; - if(m_style&SCROLL) { - QFont sansFont("Helvetica [Cronyx]", 12); - QFontMetrics fm(sansFont); - painter->setFont(sansFont); - - ld=abs(val%100); - ud=val/100; - ldo=ld%10; - printf("ld=%d ldo=%d lo=%d h=%d\n",ld,ldo,lo,h); - lo=(ldo*h)/-20; - drawLabel(painter, text, m_style); - sprintf(text, "%3d", ud); - split=w/2; - base=(h+fm.ascent())/2; - uw=fm.width(text); - - painter->drawText(split-uw+6, base, text); - sprintf(text, "%02d", abs((ld-ldo-20)%100)); - painter->drawText(split+ 7, base -h +lo, text); - sprintf(text, "%02d", abs((ld-ldo-10)%100)); - painter->drawText(split+ 7, base -h/2 +lo, text); - sprintf(text, "%02d", abs((ld-ldo)%100)); - painter->drawText(split +7, base +lo, text); - sprintf(text, "%02d", abs((ld-ldo+10)%100)); - painter->drawText(split + 7,base + h/2 +lo , text); - sprintf(text, "%02d", abs((ld-ldo+20)%100)); - painter->drawText(split + 7,base + h +lo , text); - - - } else { - sprintf(text, "%3d", val); - drawLabel(painter, text,m_style); - } - painter->restore(); // Restore and remove clicping rectabgle -} - -/////////////////////////////////////////////////////////////////////////// -void GaugeLabel::drawLabel(QPainter *painter,char *text,int style) -{ - int textlen = 0, i = 0; - int xplace=0; - int yplace=0; - int height=size().height(); - int width=size().width(); - int scrbox=(height*10)/30; - - - QVector nboxv; - - QPen pen(Qt::white); - painter->setPen(pen); - - - if (style&7 == LEFT) xplace+=5; - - nboxv.push_back(QPoint(xplace,yplace)); - - - - if (style&7 == UP) { - nboxv.push_back(QPoint(xplace+(width/2)-5,yplace )); - nboxv.push_back(QPoint(xplace+(width/2) ,yplace-5)); - nboxv.push_back(QPoint(xplace+(width/2)+5,yplace )); - } - - if (style&SCROLL) { - nboxv.push_back(QPoint(xplace+width/2,yplace)); - nboxv.push_back(QPoint(xplace+width/2,yplace-scrbox)); - nboxv.push_back(QPoint(xplace+width,yplace-scrbox )); - } else - nboxv.push_back(QPoint(xplace+width,yplace )); - - - if (style&7== RIGHT) { - - nboxv.push_back(QPoint(xplace+width ,yplace+(height/2)-5)); - nboxv.push_back(QPoint(xplace+width+5,yplace+(height/2) )); - nboxv.push_back(QPoint(xplace+width ,yplace+(height/2)+5)); - } - - if (style&SCROLL) { - nboxv.push_back(QPoint(xplace+width,yplace+height+scrbox)); - nboxv.push_back(QPoint(xplace+width/2,yplace+height+scrbox)); - nboxv.push_back(QPoint(xplace+width/2,yplace+height)); - } else - nboxv.push_back(QPoint(xplace+width,yplace+height)); - - if (style&7== DOWN) { - nboxv.push_back(QPoint(xplace+(width/2)-5,yplace+height)); - nboxv.push_back(QPoint(xplace+(width/2) ,yplace+height+5)); - nboxv.push_back(QPoint(xplace+(width/2)+5,yplace+height)); - } - - nboxv.push_back(QPoint(xplace,yplace+height)); - - if (style&7 == LEFT) { - nboxv.push_back(QPoint(xplace ,yplace+(height/2)+5)); - nboxv.push_back(QPoint(xplace-5,yplace+(height/2) )); - nboxv.push_back(QPoint(xplace ,yplace+(height/2)-5)); - } - - nboxv.push_back(QPoint(xplace,yplace)); - - textlen = strlen(text) + 2; - - // pdrawable->draw_rectangle(pwidget->get_style()->get_black_gc(), - // true, xplace, yplace, width, height); - - if (style&SCROLL) - painter->setClipRect(QRect(xplace-5,yplace-scrbox, width+10, height+2*scrbox+1)); - - QBrush brush(QColor(0,0,0,255)); - // QFont tapeFont("Helvetica [Cronyx]", 18); - // painter->setFont(tapeFont); - // painter->setPen(pen); - painter->setBrush(brush); - - painter->drawPolygon(nboxv); - - painter->drawLines(nboxv); - - // painter->setBrush(brush); - QFont sansFont("Helvetica [Cronyx]", 12); - QFontMetrics fm(sansFont); - painter->setFont(sansFont); - - painter->drawText(xplace + 3, yplace + (height+fm.ascent())/2, text); -} - diff --git a/mardrone/gaugelabel.h b/mardrone/gaugelabel.h deleted file mode 100644 index bd8348c..0000000 --- a/mardrone/gaugelabel.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GAUGELABEL_H -#define GAUGELABEL_H -#include "gauge.h" - -class GaugeLabel : public Gauge -{ - Q_OBJECT -public: - explicit GaugeLabel(QGraphicsItem *parent = 0); - void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget); - void drawNumLabel(QPainter *painter); - void drawLabel(QPainter *painter,char *text,int style); -signals: -}; - -#endif // GAUGELABEL_H diff --git a/mardrone/gauges/AltGauge.qml b/mardrone/gauges/AltGauge.qml index 1fb08f6..3a713a3 100644 --- a/mardrone/gauges/AltGauge.qml +++ b/mardrone/gauges/AltGauge.qml @@ -4,6 +4,7 @@ import QtQuick 1.0 Item { id: root property real value : 0 + property url bezel:"" // width: 200; height: 200 @@ -24,11 +25,6 @@ Item { source: "needle1.png" } - Rectangle { - color: "blue" - x:0;y:0; width:10;height:10 - } - Image { id: needle1 x: (root.width/2)-(width/2); y:(root.width/2) @@ -40,5 +36,9 @@ Item { source: "needle2.png" } - // Image { x: 21; y: 18; source: "overlay.png" } + Image { + id:bezelImg + anchors.fill:parent + source: bezel + } } diff --git a/mardrone/gauges/AttitudeGauge.qml b/mardrone/gauges/AttitudeGauge.qml index a7a73b3..15e0bca 100644 --- a/mardrone/gauges/AttitudeGauge.qml +++ b/mardrone/gauges/AttitudeGauge.qml @@ -5,6 +5,7 @@ Item { id: root property real roll : 0 property real pitch : 0 + property url bezel:"" // width: 200; height: 200 @@ -13,7 +14,7 @@ Item { rotation: root.roll; anchors.centerIn: frame transformOrigin: Item.Center - scale: frame.scale*0.4 + scale: frame.scale*0.3 source: "ati2.png" Image { anchors.centerIn: rollItem @@ -29,25 +30,23 @@ Item { // transformOrigin: Item.Center // rotation: root.roll; transform: - Translate { y: root.pitch } - - + Translate { y: root.pitch*2 } source: "ati4.png" } Image { - anchors.centerIn: frame - // scale: frame.scale*0.4 - // transformOrigin: rollItem.Center - // rotation: root.roll; + anchors.centerIn: rollItem + transformOrigin: rollItem.Center + //rotation: root.roll; source: "ati2.png" } } Image { - anchors.bottom:parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - scale: frame.scale*0.22 + // Static center plane + anchors.horizontalCenter: frame.horizontalCenter + y:15 + scale: frame.scale*0.3 source: "ati5.png" } @@ -56,4 +55,9 @@ Item { anchors.fill:parent source: "ati1.png" } + Image { + id:bezelImg + anchors.fill:parent + source: bezel + } } diff --git a/mardrone/gauges/EfisPFD.qml b/mardrone/gauges/EfisPFD.qml index bbf6818..b45e916 100644 --- a/mardrone/gauges/EfisPFD.qml +++ b/mardrone/gauges/EfisPFD.qml @@ -12,6 +12,7 @@ Item { property color indicatorColor:"white" property alias groundColor:horizon.horizonGroundColor property alias skyColor:horizon.horizonSkyColor + property url bezel:"" GaugeHorizon { id:horizon displayScale:pfd.displayScale @@ -81,5 +82,11 @@ Item { backColor:"#c0000000" name: "alt" } - + BorderImage { + id:bezelImg + anchors.fill:parent + source: bezel + border.bottom:10;border.top:10 + border.left: 10;border.right: 10 + } } diff --git a/mardrone/gauges/gauge.o b/mardrone/gauges/gauge.o deleted file mode 100644 index d8ee3f0..0000000 Binary files a/mardrone/gauges/gauge.o and /dev/null differ diff --git a/mardrone/gauges/gaugehorizon.o b/mardrone/gauges/gaugehorizon.o deleted file mode 100644 index 098b67b..0000000 Binary files a/mardrone/gauges/gaugehorizon.o and /dev/null differ diff --git a/mardrone/gauges/gaugelabel.o b/mardrone/gauges/gaugelabel.o deleted file mode 100644 index ce4004b..0000000 Binary files a/mardrone/gauges/gaugelabel.o and /dev/null differ diff --git a/mardrone/gauges/gaugetape.o b/mardrone/gauges/gaugetape.o deleted file mode 100644 index 839c6de..0000000 Binary files a/mardrone/gauges/gaugetape.o and /dev/null differ diff --git a/mardrone/joyknob.png b/mardrone/joyknob.png index 8d45b97..3077d86 100644 Binary files a/mardrone/joyknob.png and b/mardrone/joyknob.png differ diff --git a/mardrone/main.cpp b/mardrone/main.cpp index 6dffcbd..ee594e6 100644 --- a/mardrone/main.cpp +++ b/mardrone/main.cpp @@ -22,33 +22,74 @@ #include "dronecontrol.h" #include "video.h" #include "gaugehorizon.h" +#include "gaugetape.h" +#include "gaugelabel.h" #include #include #include #include -#include +#include +#include "joystick.h" +#include "qdeclarativetoucharea.h" + +QString selectQmlMain(QStringList inportPaths,QString cmdParam,QString activeUI); + +// MacOSX sdl hack so that SDL won't hijack main +#undef main int main(int argc, char *argv[]) { qmlRegisterType("Drone", 1, 0, "DroneControl"); qmlRegisterType("Drone", 1, 0, "DroneVideo"); - qmlRegisterType("Drone", 1, 0, "GaugeHorizon"); + qmlRegisterType("Gauges", 1, 0, "GaugeTape"); + qmlRegisterType("Gauges", 1, 0, "GaugeLabel"); + qmlRegisterType("Gauges", 1, 0, "GaugeHorizon"); + qmlRegisterType("JoyStick", 1, 0, "JoyStick"); + qmlRegisterType("TouchArea", 1, 0, "TouchArea"); + QApplication app(argc, argv); QUrl *url; - qDebug() << "./ardrone.qml exists " << QFile("ardrone.qml").exists(); - qDebug() << ":/ardrone.qml exists " << QFile(":/ardrone.qml").exists(); - if(QFile("ardrone.qml").exists()) { - QDir::setCurrent(app.applicationDirPath()); - url=new QUrl(QUrl::fromLocalFile("ardrone.qml")); - } - else { - QDir::setCurrent(":/"); - url=new QUrl("qrc:/ardrone.qml"); - } - QDeclarativeWindow window(*url); - window.window()->show(); + QSettings *mardroneSettings=new QSettings("katix.org","mardrone"); + QString activeUi=mardroneSettings->value("activeUI","ardrone_desktop.qml").toString(); + qDebug() << "activeUI=" << activeUi; + QString qmlmainfile=app.arguments().size()>=2 ? app.arguments()[1]:""; + QDeclarativeView window; + window.rootContext()->setContextProperty("MArdrone",window.window()); + QObject::connect((QObject*)window.engine(), SIGNAL(quit()), &app, SLOT(quit())); + // Check available UI's + window.engine()->addImportPath("qrc:/gauges/"); + window.engine()->addImportPath("qrc:"); + window.engine()->addImportPath("gauges"); + window.engine()->addImportPath("."); + qDebug() << "ImportPathList" << window.engine()->importPathList() << window.engine()->importPathList();; + QStringList importPath=window.engine()->importPathList(); + QString qmlFile=QString("qrc:/")+selectQmlMain(importPath,qmlmainfile,activeUi); + qDebug() << "using:" << qmlFile; + + if(qmlFile.contains("desktop")) { // We have desktop UI + QDeclarativeComponent component(window.engine(),QUrl(qmlFile)); + if(component.isError()) qDebug() << component.errors(); else + QObject *myObject = component.create(); + } else { // We have Mobile UI + window.setSource(QUrl(qmlFile)); + QRect screenGeometry=QApplication::desktop()->screenGeometry(); + window.setAttribute(Qt::WA_LockLandscapeOrientation, true); + if((screenGeometry.height()<=800) && (screenGeometry.width()<=1024)) window.window()->showFullScreen(); + else window.window()->show(); + } return app.exec(); } + +QString selectQmlMain(QStringList importPaths,QString cmdParam,QString activeUI) +{ + QString importPath=importPaths.last(); + if(cmdParam.contains(".qml")) return cmdParam; + if(cmdParam.isEmpty() && !activeUI.isEmpty()) return activeUI; + if(cmdParam=="harmattan" || (cmdParam=="" && QFile(importPath+"/com/nokia/meego").exists())) return QString("ardrone_harmattan.qml"); + if(cmdParam=="symbian" || (cmdParam=="" && QFile(importPath+"/MeeGo/Components").exists())) return QString("ardrone_symbian.qml"); + if(cmdParam=="desktop" || (cmdParam=="" && QFile(importPath+"/QtDesktop").exists())) return QString("ardrone_desktop.qml"); + return(activeUI); +} diff --git a/mardrone/mardrone b/mardrone/mardrone deleted file mode 100755 index 4d08ee7..0000000 Binary files a/mardrone/mardrone and /dev/null differ diff --git a/mardrone/mardrone.pro b/mardrone/mardrone.pro index 84c7ae2..0ec04e0 100644 --- a/mardrone/mardrone.pro +++ b/mardrone/mardrone.pro @@ -6,24 +6,48 @@ QT += core gui declarative network - -CONFIG += mobility +CONFIG += mobility link_pkgconfig MOBILITY += sensors TARGET = mardrone TEMPLATE = app -AR_DRONE_SDK= $$(HOME)/ARDrone_SDK_1_5_Version_20101004 -LIBS +=-lQtComponents -L$${AR_DRONE_SDK}/lib -lvlib -lsdk +AR_DRONE_SDK = ARDrone_SDK_Version_1_8_20110726 +#LIBS += -Lardrone-lib-x86 -lvlib -lsdk +#LIBS += -L../mardrone/ardrone-lib-arm -lvlib -lsdk + +#For Android +macx { +message("Compiling for Mac OSx") +LIBS += -L../mardrone/ardrone-lib-osx -lvlib +LIBS += -framework SDL +DEFINES+=HAVE_SDL +} +android { + LIBS += -L../mardrone/ardrone-lib-android -lvlib -lsdk /home/kate/necessitas/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a +} +SUBDIRS += $${AR_DRONE_SDK} + +system(pkg-config --exists QtSensors){ + message("I have QtSensors") + DEFINES+=QT_SENSORS +} +message("QMAKESPEC is:") +message($$QMAKESPEC) SOURCES += main.cpp\ - dronecontrol.cpp \ - navdata.cpp \ - video.cpp \ - gauge.cpp \ - gaugelabel.cpp \ - gaugehorizon.cpp - -INCLUDEPATH += $${AR_DRONE_SDK}/ARDroneLib/Soft/Common \ + dronelib/dronecontrol.cpp \ + dronelib/navdata.cpp \ + dronelib/video.cpp \ + gauges/gauge.cpp \ + gauges/gaugelabel.cpp \ + gauges/gaugetape.cpp \ + gauges/gaugehorizon.cpp \ + dronelib/joystick.cpp \ + qdeclarativetoucharea.cpp + +INCLUDEPATH += dronelib \ + gauges \ + $${AR_DRONE_SDK}/ARDroneLib/Soft/Common \ $${AR_DRONE_SDK}/ARDroneLib/VP_SDK \ $${AR_DRONE_SDK}/ARDroneLib/VP_SDK/VP_Os/linux \ $${AR_DRONE_SDK}/ARDroneLib/VP_SDK/VP_Os \ @@ -31,17 +55,26 @@ INCLUDEPATH += $${AR_DRONE_SDK}/ARDroneLib/Soft/Common \ $${AR_DRONE_SDK}/ARDroneLib/VLIB \ $${AR_DRONE_SDK}/ARDroneLib -HEADERS += dronecontrol.h \ - navdata.h \ - video.h \ - gauge.h \ - gaugelabel.h \ - gaugehorizon.h +HEADERS += dronelib/dronecontrol.h \ + dronelib/navdata.h \ + dronelib/video.h \ + gauges/gauge.h \ + gauges/gaugelabel.h \ + gauges/gaugetape.h \ + gauges/gaugehorizon.h \ + dronelib/joystick.h \ + qdeclarativetoucharea.h + +system(pkg-config --exists sdl){ + message("I have sdl") + DEFINES+=HAVE_SDL + SOURCES += + HEADERS += + LIBS+=-lSDL +} OTHER_FILES += \ - ardrone.qml \ - JoyStick.qml \ JoyStick2.qml \ debian/changelog \ debian/compat \ @@ -51,7 +84,37 @@ OTHER_FILES += \ debian/rules \ ardrone1.desktop \ BarGauge.qml \ - ConfigDialog.qml + ConfigDialog.qml \ + ardrone_harmattan.qml \ + ardrone_desktop.qml \ + ConfigDialogDesktop.qml \ + gauges/AltGauge.qml \ + gauges/alt2.png \ + gauges/needle1.png \ + gauges/needle2.png \ + gauges/EfisPFD.qml \ + gauges/qmldir.txt \ + dronelib/JoyStickCalibrator.qml \ + dronelib/JoyStickIndicator.qml \ + CalibrateDialog.qml \ + JoyStickCalibrator.qml \ + JoyStickIndicator.qml \ + JoyStickTouch.qml \ + gauges/qmldir \ + qtc_packaging/debian_harmattan/rules \ + qtc_packaging/debian_harmattan/README \ + qtc_packaging/debian_harmattan/manifest.aegis \ + qtc_packaging/debian_harmattan/copyright \ + qtc_packaging/debian_harmattan/control \ + qtc_packaging/debian_harmattan/compat \ + qtc_packaging/debian_harmattan/changelog \ + gauges/AttitudeGauge.qml \ + CalibrateDialogDesktop.qml \ + JoyStickCalibratorDesktop.qml \ + ardrone_symbian.qml \ + ConfigDialogSymbian.qml \ + gauges/GenericGauge.qml \ + gauges/HeadingGauge.qml unix:!symbian { maemo5 { @@ -77,3 +140,35 @@ unix:!symbian { RESOURCES += \ ardrone.qrc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mardrone/mardrone.pro.user b/mardrone/mardrone.pro.user index d3f582b..89caa12 100644 --- a/mardrone/mardrone.pro.user +++ b/mardrone/mardrone.pro.user @@ -1,256 +1,473 @@ + + ProjectExplorer.Project.ActiveTarget - 0 + 1 ProjectExplorer.Project.EditorSettings - Default + true + false + + Cpp + + false + CppProject + true + false + true + false + false + false + true + true + false + true + false + false + false + true + false + + + 1 + System + Global + 4 + true + 1 + true + false + true + + Cpp + + true + false + CppGlobal + 4 + 1 + false + true + 0 + 8 + + + + QmlJS + + true + false + QmlJSGlobal + 4 + 1 + false + true + 0 + 8 + + + 2 + 0 + 8 + true + 1 + true + true + true + false ProjectExplorer.Project.Target.0 - Desktop - - Qt4ProjectManager.Target.DesktopTarget - 0 - 0 - 0 - - - - qmake - - QtProjectManager.QMakeBuildStep - + Desktop + Desktop + Qt4ProjectManager.Target.DesktopTarget + 0 + 0 + 0 + + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-32bit.gdb + + + qmake + + QtProjectManager.QMakeBuildStep + false + false + + false - - Make - - Qt4ProjectManager.MakeStep - false - - + + Make + + Qt4ProjectManager.MakeStep + false + + - 2 - Build - - ProjectExplorer.BuildSteps.Build + 2 + Build + + ProjectExplorer.BuildSteps.Build - - - Make - - Qt4ProjectManager.MakeStep - true - - clean - - + + + Make + + Qt4ProjectManager.MakeStep + true + clean + - 1 - Clean - - ProjectExplorer.BuildSteps.Clean + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt in PATH Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + /kate/scratchbox/harmattan/mardrone/mardrone + 2 + false + + 1 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy - 2 - false - - Sbox-qt Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone-build-desktop - 11 - 0 - true + 1 + No deployment + + ProjectExplorer.DefaultDeployConfiguration - - - - qmake - - QtProjectManager.QMakeBuildStep - + 1 + + true + true + + + false + false + false + false + false + false + false + false + true + true + 0.01 + 0.01 + 10 + 10 + true + true + 25 + 25 + + + true + true + valgrind + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + mardrone + + Qt4ProjectManager.Qt4RunConfiguration + 2 + + mardrone.pro + false + false + + + 3768 + true + false + false + + 1 + + + + ProjectExplorer.Project.Target.1 + + Harmattan + Harmattan + Qt4ProjectManager.Target.HarmattanDeviceTarget + 1 + 0 + 0 + + Qt4ProjectManager.ToolChain.Maemo:/opt/QtSDK/Madde/targets/harmattan_10.2011.34-1/bin/gcc.arm-linux-generic-elf-32bit./opt/QtSDK/pythongdb/gdb + + + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false - - Make - - Qt4ProjectManager.MakeStep - false - - + + Make + + Qt4ProjectManager.MakeStep + false + + - 2 - Build - - ProjectExplorer.BuildSteps.Build + 2 + Build + + ProjectExplorer.BuildSteps.Build - - - Make - - Qt4ProjectManager.MakeStep - true - - clean - - + + + Make + + Qt4ProjectManager.MakeStep + true + clean + - 1 - Clean - - ProjectExplorer.BuildSteps.Clean + 1 + Clean + + ProjectExplorer.BuildSteps.Clean - 2 - false - - Sbox-qt Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone-build-desktop - 11 - 0 - true + 2 + false + + Harmattan Target (Qt SDK) Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 23 + true - - - - qmake - - QtProjectManager.QMakeBuildStep - + + Qt4ProjectManager.ToolChain.Maemo:/opt/QtSDK/Madde/targets/harmattan_10.2011.34-1/bin/gcc.arm-linux-generic-elf-32bit./opt/QtSDK/pythongdb/gdb + + + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false - - Make - - Qt4ProjectManager.MakeStep - false - - + + Make + + Qt4ProjectManager.MakeStep + false + + - 2 - Build - - ProjectExplorer.BuildSteps.Build + 2 + Build + + ProjectExplorer.BuildSteps.Build - - - Make - - Qt4ProjectManager.MakeStep - true - - clean - - + + + Make + + Qt4ProjectManager.MakeStep + true + clean + - 1 - Clean - - ProjectExplorer.BuildSteps.Clean + 1 + Clean + + ProjectExplorer.BuildSteps.Clean - 2 - false - - host 4.7.0 Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone-build-desktop - 15 - 0 - true + 2 + false + + Harmattan Target (Qt SDK) Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + 23 + true - - - - qmake - - QtProjectManager.QMakeBuildStep - - - - Make - - Qt4ProjectManager.MakeStep - false - - + 2 + + + + Create Debian Package + + MaemoDebianPackageCreationStep - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - - clean + + Deploy Debian package via SFTP upload + + MaemoUploadAndInstallDpkgPackageStep + + /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone-build-harmattan-Harmattan_Target__Qt_SDK__Release/mardrone_0.2.0_armel.deb + /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone-build-harmattan-Harmattan_Target__Qt_SDK__Debug/mardrone_0.2.0_armel.deb + + + 192.168.2.15 + 192.168.2.15 + + + + + + + 2011-12-20T13:12:09 + 2011-12-21T19:30:29 - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy - 2 - false - - host 4.7.0 Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /mnt/hgfs/scratchbox/harmattan/mardrone/mardrone-build-desktop - 15 - 0 - true + 1 + Build Debian Package and Install to Harmattan Device + + DeployToHarmattan + 1 - 4 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - No deployment - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - mardrone - - Qt4ProjectManager.Qt4RunConfiguration - 2 - - mardrone.pro - false - false - - false - - 3768 - true - false + 1 + + true + true + + + false + false + false + false + false + false + false + false + true + true + 0.01 + 0.01 + 10 + 10 + true + true + 25 + 25 + + + true + true + valgrind + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + mardrone (remote) + + Qt4ProjectManager.MaemoRunConfiguration + + 1 + + mardrone.pro + + + 3768 + true + true + false - 1 + 1 ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.EnvironmentId @@ -258,6 +475,6 @@ ProjectExplorer.Project.Updater.FileVersion - 8 + 10 diff --git a/mardrone/navdata.cpp b/mardrone/navdata.cpp deleted file mode 100644 index 85011b4..0000000 --- a/mardrone/navdata.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/*================================================================== - ! - ! mardrone application AR-Drone for MeeGo - - ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - ! All rights reserved. - ! - ! Author:Kate Alhola kate.alhola@nokia.com - ! - ! GNU Lesser General Public License Usage - ! This file may be used under the terms of the GNU Lesser - ! General Public License version 2.1 as published by the Free Software - ! Foundation and appearing in the file LICENSE.LGPL included in the - ! packaging of this file. Please review the following information to - ! ensure the GNU Lesser General Public License version 2.1 requirements - ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - ! - ! - ! - *===================================================================*/ -#include -#include "navdata.h" - - -NavData::NavData(QObject *parent) : - QObject(parent) -{ - vx=0;vy=0;vz=0;pwm_motor1=0;pwm_motor2=0;pwm_motor3=0;pwm_motor4=0; - vbat=0.0;pitch=0.0;roll=0.0;yaw=0.0;altitude=0.0; -} - -void NavData::parseRawNavData(char *buf,unsigned int len) -{ - int opt=0; - navdata_option_t *op; - _navdata_t *nd=(_navdata_t *)buf; - state=nd->ardrone_state; - if(state!=oldState) { - oldState=state; - decodedState=decodeState(state,0); - emit stateUpdated(); - }; -#if 0 - qDebug("parseRawNavData hdr=%8x state=%08x seq=%06d opt[0].tag=%d size=%d", - nd->header,nd->ardrone_state,nd->sequence,nd->options[0].tag,nd->options[0].size); -#endif - qDebug() << decodedState; - op=&(nd->options[0]); - while((((unsigned int)op-(unsigned int)buf)size>0)) - { - parseOption(op); - op=(navdata_option_t *)((unsigned int)op+op->size); - } -}; - -void NavData::parseOption(navdata_option_t *op) -{ - // qDebug("parseOption tag=%d size=%d",op->tag,op->size); - switch(op->tag) { - case NAVDATA_DEMO_TAG: - { - _navdata_demo_t *ndemo=(_navdata_demo_t*)op; - vbat=ndemo->vbat_flying_percentage; - pitch=ndemo->theta/1000.0; - roll=ndemo->phi/1000.0; - yaw=ndemo->psi/1000.0; - altitude=ndemo->altitude; - vx=ndemo->vx; - vy=ndemo->vy; - vz=ndemo->vz; - emit navDataUpdated(); - qDebug("pitch=%2.1f roll=%2.1f yaw=%2.1f alt=%2.1f v(%2.1f,%2.1f,%2.1f bat=%2.1f",pitch,roll,yaw,altitude,vx,vy,vz,vbat); - } - break; - case NAVDATA_TIME_TAG: - { - _navdata_time_t *ntdime=(_navdata_time_t*)op; - } - break; - case NAVDATA_RAW_MEASURES_TAG: - { - _navdata_raw_measures_t *nraw=(_navdata_raw_measures_t*)op; - } - break; - case NAVDATA_PHYS_MEASURES_TAG: - { - _navdata_phys_measures_t *nphys=(_navdata_phys_measures_t*)op; - } - break; - case NAVDATA_GYROS_OFFSETS_TAG: - break; - case NAVDATA_EULER_ANGLES_TAG: - break; - case NAVDATA_REFERENCES_TAG: - break; - case NAVDATA_TRIMS_TAG: // 7 - { - _navdata_trims_t *ntrim=( _navdata_trims_t*)op; - } - break; - case NAVDATA_RC_REFERENCES_TAG: //8 - break; - case NAVDATA_PWM_TAG: - { - _navdata_pwm_t *npwm=( _navdata_pwm_t*)op; - current_motor1=npwm->current_motor1; - pwm_motor1=npwm->motor1; - current_motor2=npwm->current_motor2; - pwm_motor2=npwm->motor2; - current_motor3=npwm->current_motor3; - pwm_motor3=npwm->motor3; - current_motor4=npwm->current_motor4; - pwm_motor4=npwm->motor4; - emit navDataUpdated(); - // qDebug("pwm1=%3d I1=%4f pwm2=%3d I2=%4f pwm3=%3d I3=%4f pwm4=%3d I4=%4f", - // pwm_motor1,current_motor1,pwm_motor2,current_motor2,pwm_motor3,current_motor3,pwm_motor4,current_motor4); - } - break; - case NAVDATA_ALTITUDE_TAG: //10 - break; - case NAVDATA_VISION_RAW_TAG: - break; - case NAVDATA_VISION_OF_TAG: //12 - break; - case NAVDATA_VISION_TAG: - break; - case NAVDATA_VISION_PERF_TAG: - break; - case NAVDATA_TRACKERS_SEND_TAG: - break; - case NAVDATA_VISION_DETECT_TAG: //16 - { - _navdata_vision_detect_t *nvisd=(_navdata_vision_detect_t*)op; - qDebug("nb_detected=%d type=%d xc=%d yc=%d width=%d height=%d dist=%d",nvisd->nb_detected,nvisd->type[0],nvisd->xc[0],nvisd->yc[0], - nvisd->width[0],nvisd->height[0],nvisd->dist[0]); - for(int i=0;i++;i<4) { - tags[i].type=nvisd->type[i]; - tags[i].xc=nvisd->xc[i]; - tags[i].yc=nvisd->yc[i]; - tags[i].height=nvisd->height[i]; - tags[i].width=nvisd->width[i]; - tags[i].dist=nvisd->dist[i]; - } - } - break; - case NAVDATA_WATCHDOG_TAG: - break; - case NAVDATA_ADC_DATA_FRAME_TAG: - break; - case NAVDATA_CKS_TAG: //65535 - break; - } -}; - -QString NavData::decodeState(unsigned int state,int level) -{ - QString s="%1 "; - s=s.arg(state,8,16); - s+=(state & ARDRONE_FLY_MASK)==0 ? "landed ":"flying "; - if(level>1) s+=(state & ARDRONE_VIDEO_MASK)==0 ?"video disable ":"video ena "; - if(level>1)s+=(state & ARDRONE_VISION_MASK)==0 ? "vision disable ":"vision ena "; - if(level>1)s+=(state & ARDRONE_CONTROL_MASK)==0 ? "euler angles ":"angular speed "; - if(level>1)s+=(state & ARDRONE_ALTITUDE_MASK)==0 ? "alt ctrl inact ":"alt ctrl act "; - //s+=(state & ARDRONE_USER_FEEDBACK_START)==0 ? /*!< USER feedback : Start button state */ - s+=(state & ARDRONE_COMMAND_MASK)==0 ? "CMD NAK ":"CMD ACK "; - // s+=(state & ARDRONE_FW_FILE_MASK)==0 ? /* Firmware file is good; - // s+=(state & ARDRONE_FW_VER_MASK )==0 ? /* Firmware update is newer; - // ARDRONE_FW_UPD_MASK = 1 << 9, /* Firmware update is ongoing (1; - s+=(state & ARDRONE_NAVDATA_DEMO_MASK )==0 ? "All navdata ":"navdata demo "; - s+=(state & ARDRONE_NAVDATA_BOOTSTRAP)==0 ? "":"Navdata bootstrap "; - // s+=(state & ARDRONE_MOTORS_MASK)==0 ? /*!< Motors status : (0) Ok, (1) Motors problem */ - s+=(state & ARDRONE_COM_LOST_MASK)? "Com Lost ":"Com ok "; - if(level>1)s+=(state & ARDRONE_VBAT_LOW) ? "VBat low ":"Vbat Ok "; - if(level>1)s+=(state & ARDRONE_USER_EL) ? "User EL ":""; - s+=(state & ARDRONE_TIMER_ELAPSED) ? "Timer elapsed ":""; - s+=(state & ARDRONE_ANGLES_OUT_OF_RANGE) ? "Angles out of range ":""; - s+=(state & ARDRONE_ULTRASOUND_MASK) ? "Ultrasonic sensor deaf ":""; - s+=(state & ARDRONE_CUTOUT_MASK) ? "Cutout system detection detected":""; -// s+=(state & ARDRONE_PIC_VERSION_MASK)==0 ? /*!< PIC Version number OK : (0) a bad version number, (1) version number is OK */ -// s+=(state & ARDRONE_ATCODEC_THREAD_ON)==0 ? /*!< ATCodec thread ON : (0) thread OFF (1) thread ON */ - if(level>2)s+=(state & ARDRONE_NAVDATA_THREAD_ON)==0 ? "Navdata thread OFF ":"Navdata thread ON "; - if(level>2)s+=(state & ARDRONE_VIDEO_THREAD_ON )==0 ? "Video thread OFF ":"Video thread ON "; -// s+=+(state & ARDRONE_ACQ_THREAD_ON)==0 ? "Acquisition thread OFF ":"Acquisition thread ON "; - s+=(state & ARDRONE_CTRL_WATCHDOG_MASK) ? "CTRL watchdog ":""; - s+=(state & ARDRONE_ADC_WATCHDOG_MASK) ? "ADC Watchdog ":""; - s+=(state & ARDRONE_COM_WATCHDOG_MASK) ? "Comm Watchdog ":""; - s+=(state & ARDRONE_EMERGENCY_MASK)? "Emg landing":""; - return s; -} diff --git a/mardrone/navdata.h b/mardrone/navdata.h deleted file mode 100644 index f46ed61..0000000 --- a/mardrone/navdata.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef NAVDATA_H -#define NAVDATA_H - -#include -#undef _GNU_SOURCE // just get rid of error message double definition -#include -#include "config.h" - -struct tag_t { - unsigned int type; - unsigned int xc; - unsigned int yc; - unsigned int width; - unsigned int height; - unsigned int dist; -}; - -class NavData : public QObject -{ - Q_OBJECT -public: - explicit NavData(QObject *parent = 0); - void parseRawNavData(char *buf,unsigned int len); - void parseOption(navdata_option_t *op); - QString decodeState(unsigned int state,int level); - - unsigned int state,oldState; - QString decodedState; - float vbat; - float pitch; - float roll; - float yaw; - float altitude; - float vx; - float vy; - float vf; - float vz; - float current_motor1; - float current_motor2; - float current_motor3; - float current_motor4; - int pwm_motor1; - int pwm_motor2; - int pwm_motor3; - int pwm_motor4; - tag_t tags[4]; -signals: - void navDataUpdated(); - void stateUpdated(); -public slots: - -}; - -#endif // NAVDATA_H diff --git a/mardrone/qtc_packaging/debian_harmattan/control b/mardrone/qtc_packaging/debian_harmattan/control index ff4414a..9229ea4 100644 --- a/mardrone/qtc_packaging/debian_harmattan/control +++ b/mardrone/qtc_packaging/debian_harmattan/control @@ -9,6 +9,7 @@ Homepage: Package: mardrone Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: +Description: ArDrone for MeeGo> XSBC-Maemo-Display-Name: mardrone +XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAJcAAACXAETPAk3AAAJjElEQVRoge1aWUyTSxQ+LSWUfQuK0LBIBYnI1mIiIERxSdQgAX2RgEEWESOBGMUHeHB5IZLwoDwYEhsQEQUFRdCwBMEFCFAICIKkEEB2ylIKtECZ+3Byfwu0vV18uBi/F8rMme+c+f85/5xzZgD+4i90Au0/JZhMpre3t5+fHwBwudzFxcWWlhYAaG1t/f79+8bGho4WsFgsPz8/LpcLAC4uLl1dXa2trcgvFAq15+VyuY2NjY2NjWtra0QJxGJxcXFxcXGxra2tRuT6+vp3796dmJiYmJhQRk4IGRgYiImJiYmJ0Ywa2RXavbKysr6+vr1dKBRevHhRHX4vLy8vL6+Ojg5lT0Rhe3l5ubJnRNdgcv9LbPKBffv2vXz5EgC8vb0BANf306dP6+vr29raAKCnp8fAwAB7ORzOuXPnjh07Rg1//fo1AERFRS0vLytUduvWrfv37wOAvr4+AAwMDAAAj8dra2tD/qmpKScnJw6HAwBcLvfKlSuWlpY4VigUxsbGAsCbN28UT4XBYLS1tVFvrb+/PzAwMDAwUPUDiIuLi4uLE4lE1MCHDx8qlDx79iwls7GxkZOTY2xsbGxsrILczs6uoqKioqICRy0tLS0tLbHZbMXS6enplIKioiIjIyPVpsvD0dGxq6uLMu7o0aPyvZaWlpaWlmNjY4SQ5eXl5eXlkJAQ9ckBICkpibKtoaGBRvu1cHa8DwAAeHh4eHh4SKVSQohAIBAIBKrfrEJ4enqurq6urq4SQgYHBy0sLCwsLHJzc4OCggoKCgoKCvD5JScnJycna2Ekj8ejXsL169c39VVXV1dXV+PbDwoKCgoK0kIBAKSnp1PrsK+vr6+vjxCCzwVRW1tLo9HkF4D6MDc3Hx4eHh4eRmcwNTU1NTUFAKDT6WKxGD/AJSUl2pmOYDAYDAZDxd7k4eGhC39CQkJCQgJSUQ96x/sA3dXVlfqcNTU16cK1vr6+vr6OX/TtkEql3d3duvA3Nzc3Nzfjb19fX19fXwBg4B+EMt0aYXp6WmH7ysoKIUQXZpy/RCJhMpmU2XQfHx9KoqOjQxcFCDMzM4Xt5ubmJiYmujDjG+7s7AQAHx8ftHzn+8Ds7Cz1j4WFhe6Me/bsUdhOo9GUdWkEa2trAJidnUXL6Xw+n+qTX05ag8ViKevSNG3YAgxJXFxcAIDP56Plv38CVlZWyrocHR11YeZyuZi4gfwEdGH8P4A+PT09MjIyMjICAKGhobibasfl6Ojo6OhoaGioTODkyZNamgkAAGFhYWFhYfibSiEAALKysrKysnCLzsjIyMjI0IKdRqPV1tbW1tYqiyMwlra1tdXOE/z9/WUymUwmI4R0dnbS6XQ6/d/lY2hoaGho+OPHD4y9pFKpp6enpgoSExNVmE6htLS0tLRUU3Imk9nb24sMa2tr8r66433gFwICAvAFEUJGR0fPnDmjzig9PT09Pb2bN29KJBJ13gDi2bNnKj5W8mCz2Ww2+9OnT9TYO3fuKJWmPAHB4/F4PJ6K3W3//v1YO1LTbvlSzfj4uLxTbgedTk9JScE8GIe0t7e3t7djQYDCptyCRqNdu3YNADIzM6mcWCKR9PT0jI6OAsDq6iqNRsMuJycnV1dXypNGRkawonHjxg1lNo2NjfX39wNAcHCwfKNAIBCJRACwtLQEALt37waAgwcPyr+lJ0+epKamAgBK/pqnMmU7G2w2u6WlRf01nZeXZ25uHhUVFRUVpUJMIBBgSpmamorZ839icnJycnJShUMq3rMOHTqEIYea8PPzc3V1nZiYUC02MTGBRbGYmJgtS1kZcFvERaUQm3zA2tr68ePHABAREUE1Njc319fXd3V1AQBm6Fgt8/HxOXXq1N69e1FMJpPxeDwAiIuLU6ast7cXy1K42Q8NDQHAhw8fWltbf/78CQCWlpZMJtPNzQ0Ajhw54u/vT42trKy8fPkyAExOTspz/lk+8P79e2rxiUSi2NhYLEcqA5PJzM7Ozs7O3tjYUN9hCCEbGxuPHj0yMjJSXf+Ljo6em5ubm5vDUXV1dXV1dUqrMjExMZSCpqYmjULf4OBg1ZV+CjMzMzMzM8ePH1eTmcVisVgs+Y1sa1ULAOzt7e3t7efn5wkhOGN7e3v1rUecPn1anQmEh4eHh4drSr5r167p6Wlk2FLf/SN84MWLFy9evMD5RUZGRkZGaseTm5ubm5ur4vF//PhRayMjIiIonnfv3m3qEwqFQqGQEFJdXa21AgDAeqWKHerEiRO68JeXl5eXlxNCxGIxlQ/QnZycrKysMOqora3VRcHi4uLi4qKywhYACAQCXfgxYQIAY2Njd3d3d3d3+AN8YFNpsb29XXfGgYEBOzu77e0ymWxsbEwXZnnz8Ny6u7ubjidq2yW0xtu3bxW2d3Z2SiQSXZg7Ojqo4ieHw0HLGTKZjJLQ09PTRQECo5rtkC9AaQd58yizd74PyJfUfXx8xsfHdWRUVt7T/VYFhuIIvE8BAIwtpcXKykod1eAEFhcXAcDU1HR9fR2DZ/zq6c6MoCYAADA1NTU1NUUIaWho0EUB7icYU5WUlJSUlCQnJ5eWluIuJhaLbWxsdOGvqqqqqqoihIhEIuqwcMf7AABAXl5eXl4ePic8CdSOp7CwsLCwEHni4+Pj4+MBQD5LxssU2iE6OpriefXq1aY+GxsbGxsbXEUYDjg7O2uq4MKFC5SChoYGKlah0Wg1NTU1NTXYhYm/puQsFgtXJiFkfn5e8RGEfLjX2dl54MAB9RWEhobOzs5Sa51KlBEODg4ODg4LCwuEkIWFhYWFhfPnz6vJ7Obm5ubmxufzKdsuXbokL/BH+ACFoqIiaqISiSQtLS0tLU3F9mxhYZGfn5+fny8fM1+9elWhsHzKSgh5/vy5tbU1HngpBJ1OT01NxdstOKSsrKysrGyL2KYE2djYODMzEwCSkpKo3HlwcPDr16/URTwTExMMpPz8/AICAqjq3/Ly8u3btwFA2X0hAEhMTHzw4AEA4Hnr3NwcAHz58qW1tRUvEi4sLHA4HOQ/fPiwfG2Kx+OlpKTAttKiYoSEhAwNDSnLS7bj8+fPSu8hbYazs7Ozs3NdXZ2azKOjo6pL5TveB5TefDEzM8OzpuDgYE9PTwMDgy0C8/PzfD4fF2VOTo5GoQ6NRktMTMT6n6+vL3UxDiGVSgHg27dvDQ0N9+7dg38Xm2YTkAeDwcCvqq+vr1gsxvgPr+z9Fjg7O2NeZW5uzufz8U7E2tra7+L/i79QgX8ArOLcBfDePNQAAAAASUVORK5CYII= diff --git a/mardrone/qtc_packaging/debian_harmattan/manifest.aegis b/mardrone/qtc_packaging/debian_harmattan/manifest.aegis index e69de29..c9df14d 100644 --- a/mardrone/qtc_packaging/debian_harmattan/manifest.aegis +++ b/mardrone/qtc_packaging/debian_harmattan/manifest.aegis @@ -0,0 +1,6 @@ + + + + + + diff --git a/mardrone/video.cpp b/mardrone/video.cpp deleted file mode 100644 index ae261ea..0000000 --- a/mardrone/video.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/*================================================================== - ! - ! mardrone application AR-Drone for MeeGo - - ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - ! All rights reserved. - ! - ! Author:Kate Alhola kate.alhola@nokia.com - ! - ! GNU Lesser General Public License Usage - ! This file may be used under the terms of the GNU Lesser - ! General Public License version 2.1 as published by the Free Software - ! Foundation and appearing in the file LICENSE.LGPL included in the - ! packaging of this file. Please review the following information to - ! ensure the GNU Lesser General Public License version 2.1 requirements - ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - ! - ! - ! - *===================================================================*/ -#include "video.h" -#include - -DroneVideo::DroneVideo() -{ - droneHost.setAddress("192.168.1.1"); - initialized=false; -} - -VideoThread::VideoThread(DroneVideo *parentp,QHostAddress host,QImage *_image) -{ - image=_image; - qDebug() << "videoThread::videoThread"; - stopped=false; - parent=parentp; - videoSock=new QUdpSocket(); - videoSock->bind(QHostAddress::Any,5555); - droneHost=host; - start(); - -}; - -void DroneVideo::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - if(!initialized) { // We need initialize QImage here because we don't know display depth before - int depth=0; - - depth=painter->device()->depth(); - qDebug() << "depth=" << depth; - - if(depth==24) { - image=new QImage(320,240, QImage::Format_RGB32); - image->fill(0x555555); - } - else { - image=new QImage(320,240, QImage::Format_RGB16); - image->fill(0x5555); - } - QPainter p(image); - p.drawLine(0,0,image->width(),image->height()); - p.drawLine(image->width(),0,0,image->height()); - update(boundingRect()); - videoThread=new VideoThread(this,droneHost,image); - initialized=true; - } else - painter->drawImage(boundingRect(),*image,image->rect()); - }; - -QRectF DroneVideo::boundingRect() const -{ - return QRectF(0.0,0.0,size().width(),size().height()); -} - - -void VideoThread::run() -{ -#define ACQ_WIDTH 320 -#define ACQ_HEIGHT 240 -#undef memset - memset(&controller,0,sizeof(controller)); - memset(&picture,0,sizeof(picture)); - pictureWidth= image->width(); - pictureHeight=image->height(); - int codec_type=UVLC_CODEC; - qDebug() << "videoThread::run()"; - stateTimer=new QTimer(); - connect(stateTimer,SIGNAL(timeout()),this,SLOT(timer())); - connect(videoSock,SIGNAL(readyRead()),this,SLOT(videoDataReady())); - qDebug() << "videoThread::run() 2"; - luma_only=FALSE; - num_picture_decoded=0; - /// Picture configuration - picture.format = PIX_FMT_YUV420P; - picture.width = pictureWidth; - picture.height = pictureHeight; - picture.framerate = 30; - picture.y_buf = (uint8_t*)(void*)vp_os_malloc((size_t) pictureWidth*pictureHeight ); - picture.cr_buf = (uint8_t*)vp_os_malloc( pictureWidth*pictureHeight/4 ); - picture.cb_buf = (uint8_t*)vp_os_malloc( pictureWidth*pictureHeight/4 ); - picture.y_line_size = pictureWidth; - picture.cb_line_size = pictureWidth / 2; - picture.cr_line_size = pictureWidth / 2; - picture.y_pad = 0; - picture.c_pad = 0; - video_codec_open(&controller, (codec_type_t)UVLC_CODEC); - //stateTimer->start(1000); - qDebug() << "videoThread::run() initialized"; - sendVideoPort("AT"); - while(!stopped) { - exec(); - } - -} - -void VideoThread::timer() -{ - // qDebug() << "thread Timer"; - -} - -void VideoThread::sendVideoPort(QString cmd) -{ - QByteArray dgram; - dgram=cmd.toLatin1(); - qDebug() << "videoThread::sendCmd= " << cmd+"\n" << "to " << droneHost ; - videoSock->writeDatagram(dgram.data(),dgram.size(),droneHost,5555); -} - -void VideoThread::videoDataReady() -{ - qint64 l; - QByteArray videoData; - - QHostAddress host; - quint16 port; - videoData.resize(videoSock->pendingDatagramSize ()); - l=videoSock->readDatagram(videoData.data(),videoData.size(),&host,&port); -// qDebug() << "videoThread::videoDataReady" <<" l=" << l << "from" << host ; - decodeTransform(videoData); -} - -void VideoThread::decodeTransform(QByteArray &videoData) -{ - controller.in_stream.bytes = (uint32_t*)videoData.data(); - controller.in_stream.used = videoData.size(); - controller.in_stream.size = videoData.size(); - controller.in_stream.index = 0; - controller.in_stream.length = 32; - controller.in_stream.code = 0; - - bool_t got_image = FALSE; - //qDebug() <<"VideoThread::decodeTransform"; - video_decode_blockline( &controller, &picture, &got_image ); - //qDebug() <<"VideoThread::decodeTransform 2"; - //video_decode_picture( &controller, &picture, &stream, &got_image ); - if( got_image ) - { - // qDebug() <<"VideoThread::decodeTransform got image" << picture.width << picture.height << image->byteCount() << image->bytesPerLine(); - // we got one picture - // out->size = 1; - picture.complete = 1; - num_picture_decoded++; - vp_stages_YUV420P_to_RGB565(NULL,&picture,image->bits(),image->bytesPerLine()); - - - // qDebug() << "pic " << num_picture_decoded; - } - - -}; - - diff --git a/mardrone/video.h b/mardrone/video.h deleted file mode 100644 index 2dce006..0000000 --- a/mardrone/video.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef VIDEO_H -#define VIDEO_H - -#include -#include -#include -#include -#include -#include -#include -#include "dronecontrol.h" -#undef _GNU_SOURCE // just get rid of error message double definition -#define TARGET_CPU_ARM 1 -#include -#include -#include -extern "C" -{ -#include -void vp_stages_YUV420P_to_RGB565(void *cfg, vp_api_picture_t *picture, uint8_t *dst, uint32_t dst_rbytes); - -} - - -class VideoThread; - -class DroneVideo:public QGraphicsWidget -{ - Q_OBJECT -public: - DroneVideo(); - void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, - QWidget *widget); - QRectF boundingRect() const; - -private: - QHostAddress droneHost; // Ip address of the drone - VideoThread *videoThread; - QImage *image; - bool initialized; -}; - -class VideoThread:public QThread { - Q_OBJECT -public: - VideoThread(DroneVideo *parentp,QHostAddress host,QImage *_image); - - // ~DroneThread (); - void run(); - void sendVideoPort(QString cmd); - void decodeTransform(QByteArray &videoData); - -public slots: - void videoDataReady(); - void timer(); - - - -private: - QImage *image; - video_controller_t controller; - vp_api_picture_t picture; - int pictureWidth; - int pictureHeight; - bool luma_only; - unsigned int num_picture_decoded; - QHostAddress droneHost; // Ip address of the drone - QTimer *stateTimer; - volatile bool stopped; - DroneVideo *parent; - QUdpSocket *videoSock; // Navigation data receive socket port 5554 - -}; - -#endif // VIDEO_H diff --git a/mardrone_0.0.1_armel.changes b/mardrone_0.0.1_armel.changes deleted file mode 100644 index 7cdbb68..0000000 --- a/mardrone_0.0.1_armel.changes +++ /dev/null @@ -1,20 +0,0 @@ -Format: 1.7 -Date: Wed, 22 Dec 2010 15:06:48 +0200 -Source: mardrone -Binary: mardrone -Architecture: source armel -Version: 0.0.1 -Distribution: unstable -Urgency: low -Maintainer: Kate Alhola -Changed-By: Kate Alhola -Description: - mardrone - AR-Drone flict controll app -Changes: - mardrone (0.0.1) unstable; urgency=low - . - * Initial Release. -Files: - c19e2d3cccf5dcc764da734d0127d6a7 269 user/hidden optional mardrone_0.0.1.dsc - 0552a460cc8b4b7d7413e5637e4be22c 1379887 user/hidden optional mardrone_0.0.1.tar.gz - f097693f6af6d6e2785d3f8d282100a9 107678 user/hidden optional mardrone_0.0.1_armel.deb diff --git a/mardrone_0.0.1_armel.deb b/mardrone_0.0.1_armel.deb deleted file mode 100644 index 5c16f7b..0000000 Binary files a/mardrone_0.0.1_armel.deb and /dev/null differ