ADRrone SDK diff added
[mardrone] / mardrone / ardrone.qml
1 import Qt 4.7
2 import com.meego 1.0
3 import Drone 1.0
4
5
6 Window {
7     id:mainWindow
8     fullscreen:true
9     property Component dialogComponent
10 // property alias m: mainPage
11     DroneControl {
12         id:drone
13     }
14
15     Component {
16       id: mainpageComponent
17       Page {
18         id:mainPage
19         onEntered:(mainWindow.fullscreen=true)
20
21         state:"Landscape"
22         DroneVideo {
23             y:0
24             x:00
25             anchors.horizontalCenter:parent.horizontalCenter
26             width:drone.confFullScreen? parent.width:640 ;height:480*width/640;
27         }
28
29         GaugeHorizon {
30             y:0
31             x:100
32             visible:drone.confShowHorizon
33             value:drone.droneRoll
34             value2:drone.dronePitch
35 //            value:lj.xv
36 //            value2:lj.yv
37             opacity:0.5
38             width:640;height:480;
39         }
40         Text {
41             y:100
42             visible:drone.confUseAccel
43             color: "#00FF00"
44             id: droneCtrlValues
45             font.pixelSize:20
46             text: "cmd:pitch=" + Math.round(drone.pitch) + " roll= " +  Math.round(drone.roll) + " yaw=" + Math.round(drone.yaw) + " vv= " +  Math.round(drone.vVelocity)
47         }
48
49         Text {
50             y:115
51             visible:drone.confShowDebug
52             color: "#00FF00"
53             id: droneNavData
54             font.pixelSize:20
55             text: "pitch=" + Math.round(drone.dronePitch) + " roll= " +  Math.round(drone.droneRoll) + "yaw=" + Math.round(drone.droneYaw) + " alt= " +  Math.round(drone.droneAltitude)
56         }
57
58         Text {
59             y:130
60             visible:drone.confShowDebug
61             color: "#00FF00"
62             id: droneStatus
63             font.pixelSize:20
64             text: drone.decodedStatus
65         }
66         Button {
67             y:150;x:0
68             height: 50
69             width: 50
70             text: "conf"
71             onClicked:{   mainWindow.fullscreen = false ;
72                           mainWindow.nextPage(dialogComponent)
73             }
74         }
75         Image {
76             visible: !drone.confUseAccel
77             x:10;y:200
78             width:280;height:280;
79             source: "joybox.png"
80
81             JoyStick {
82                 id:lj
83                 anchors.fill:parent
84                 anchors.margins:50
85                 onYvChanged:{drone.pitch=yv;}
86                 onXvChanged:{drone.roll=xv;}
87
88
89             }
90         }
91         Image {
92             y:200
93             anchors.right:parent.right
94             width:280;height:280;
95             source: "joybox.png"
96             JoyStick {
97                 id:rj
98                 anchors.fill:parent
99                 anchors.margins:50
100                 onYvChanged:{drone.vVelocity=-1*yv;}
101                 onXvChanged:{drone.yaw=xv;}
102                 onPressedChanged: { drone.ctrlActive=pressed;}
103             }
104         }
105         Row {
106             spacing: 5
107             anchors.right:parent.right
108             anchors.rightMargin: 10
109             y:100
110             height:100
111         BarGauge {
112            val:drone.pwm_motor1;
113            max: 255
114            height:100
115         }
116         BarGauge {
117             val:drone.pwm_motor2;
118             max: 255
119             height:100
120         }
121         BarGauge {
122             val:drone.pwm_motor3;
123             max: 255
124             height:100
125         }
126         BarGauge {
127             val:drone.pwm_motor4;
128             max: 255
129             height:100
130         }
131         BarGauge {
132             val:drone.droneVBat
133             max: 100
134             height:100
135         }
136         }
137
138         Button {
139             x:400
140             width:60
141             id:flyButton
142             anchors.bottom:parent.bottom
143             anchors.margins:15
144             text:"Fly";
145             checkable:true
146             onClicked:{drone.fly=checked;
147             // mainWindow.fullsecreen=checked;
148             }
149         }
150         Button {
151             x:400;y:100
152             width:120
153             id:emergencyButton
154             anchors.top:parent.top
155             anchors.margins:15
156             text:"Energency";
157             checkable:true
158             onClicked:{drone.emergency=checked;}
159         }
160
161         } // Main page
162     }
163
164       Component.onCompleted: {
165             mainWindow.fullscreen = true ;
166             dialogComponent = Qt.createComponent("ConfigDialog.qml");
167             mainWindow.nextPage(mainpageComponent)
168
169       }
170  }