Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
e72400d1
Commit
e72400d1
authored
Jun 05, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional functionaltiy of Actions view, including setwaypoint,change speed, and ARM/DISARM
parent
6b449af3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
32 deletions
+159
-32
UASActionsWidget.cpp
src/ui/uas/UASActionsWidget.cpp
+105
-2
UASActionsWidget.h
src/ui/uas/UASActionsWidget.h
+12
-1
UASActionsWidget.ui
src/ui/uas/UASActionsWidget.ui
+42
-29
No files found.
src/ui/uas/UASActionsWidget.cpp
View file @
e72400d1
#include "UASActionsWidget.h"
#include <QMessageBox>
#include <UAS.h>
UASActionsWidget
::
UASActionsWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
m_uas
=
0
;
ui
.
setupUi
(
this
);
connect
(
ui
.
changeAltitudeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeAltitudeClicked
()));
connect
(
ui
.
changeSpeedButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeSpeedClicked
()));
connect
(
ui
.
goToWaypointButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
goToWaypointClicked
()));
connect
(
ui
.
armDisarmButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
armButtonClicked
()));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUASSet
(
UASInterface
*
)));
if
(
UASManager
::
instance
()
->
getActiveUAS
())
{
activeUASSet
(
UASManager
::
instance
()
->
getActiveUAS
());
}
}
void
UASActionsWidget
::
activeUASSet
(
UASInterface
*
uas
)
{
m_uas
=
uas
;
connect
(
m_uas
->
getWaypointManager
(),
SIGNAL
(
waypointEditableListChanged
()),
this
,
SLOT
(
updateWaypointList
()));
connect
(
m_uas
->
getWaypointManager
(),
SIGNAL
(
currentWaypointChanged
(
quint16
)),
this
,
SLOT
(
currentWaypointChanged
(
quint16
)));
connect
(
m_uas
,
SIGNAL
(
armingChanged
(
bool
)),
this
,
SLOT
(
armingChanged
(
bool
)));
armingChanged
(
m_uas
->
isArmed
());
updateWaypointList
();
}
void
UASActionsWidget
::
armButtonClicked
()
{
if
(
m_uas
)
{
if
(
m_uas
->
isArmed
())
{
((
UAS
*
)
m_uas
)
->
disarmSystem
();
}
else
{
((
UAS
*
)
m_uas
)
->
armSystem
();
}
}
}
void
UASActionsWidget
::
armingChanged
(
bool
state
)
{
//TODO:
//Figure out why arm/disarm is in UAS.h and not part of the interface, and fix.
if
(
state
)
{
ui
.
armDisarmButton
->
setText
(
"DISARM
\n
Currently Armed"
);
}
else
{
ui
.
armDisarmButton
->
setText
(
"ARM
\n
Currently Disarmed"
);
}
}
void
UASActionsWidget
::
currentWaypointChanged
(
quint16
wpid
)
{
ui
.
currentWaypointLabel
->
setText
(
"Current: "
+
QString
::
number
(
wpid
));
}
void
UASActionsWidget
::
updateWaypointList
()
{
ui
.
waypointComboBox
->
clear
();
for
(
int
i
=
0
;
i
<
m_uas
->
getWaypointManager
()
->
getWaypointEditableList
().
size
();
i
++
)
{
ui
.
waypointComboBox
->
addItem
(
QString
::
number
(
i
));
}
}
UASActionsWidget
::~
UASActionsWidget
()
{
}
void
UASActionsWidget
::
goToWaypointClicked
()
{
if
(
!
m_uas
)
{
return
;
}
m_uas
->
getWaypointManager
()
->
setCurrentWaypoint
(
ui
.
waypointComboBox
->
currentIndex
());
}
void
UASActionsWidget
::
changeAltitudeClicked
()
{
QMessageBox
::
information
(
0
,
"Error"
,
"No implemented yet."
);
}
void
UASActionsWidget
::
changeSpeedClicked
()
{
if
(
!
m_uas
)
{
return
;
}
if
(
m_uas
->
getSystemType
()
==
MAV_TYPE_QUADROTOR
)
{
m_uas
->
setParameter
(
1
,
"WP_SPEED_MAX"
,
QVariant
(((
float
)
ui
.
altitudeSpinBox
->
value
()
*
100
)));
return
;
}
else
if
(
m_uas
->
getSystemType
()
==
MAV_TYPE_FIXED_WING
)
{
QVariant
variant
;
if
(
m_uas
->
getParamManager
()
->
getParameterValue
(
1
,
"ARSPD_ENABLE"
,
variant
))
{
if
(
variant
.
toInt
()
==
1
)
{
m_uas
->
setParameter
(
1
,
"TRIM_ARSPD_CN"
,
QVariant
(((
float
)
ui
.
altitudeSpinBox
->
value
()
*
100
)));
return
;
}
}
m_uas
->
setParameter
(
1
,
"TRIM_ARSPD_CN"
,
QVariant
(((
float
)
ui
.
altitudeSpinBox
->
value
()
*
100
)));
}
}
src/ui/uas/UASActionsWidget.h
View file @
e72400d1
...
...
@@ -3,7 +3,8 @@
#include <QWidget>
#include "ui_UASActionsWidget.h"
#include <UASManager.h>
#include <UASInterface.h>
class
UASActionsWidget
:
public
QWidget
{
Q_OBJECT
...
...
@@ -14,6 +15,16 @@ public:
private:
Ui
::
UASActionsWidget
ui
;
UASInterface
*
m_uas
;
private
slots
:
void
armButtonClicked
();
void
armingChanged
(
bool
state
);
void
currentWaypointChanged
(
quint16
wpid
);
void
updateWaypointList
();
void
activeUASSet
(
UASInterface
*
uas
);
void
goToWaypointClicked
();
void
changeAltitudeClicked
();
void
changeSpeedClicked
();
};
#endif // UASACTIONSWIDGET_H
src/ui/uas/UASActionsWidget.ui
View file @
e72400d1
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
413
</width>
<height>
3
04
</height>
<width>
321
</width>
<height>
3
63
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -25,7 +25,7 @@
<property
name=
"title"
>
<string>
Mission Controls
</string>
</property>
<widget
class=
"QPushButton"
name=
"
pushButton_9
"
>
<widget
class=
"QPushButton"
name=
"
goToWaypointButton
"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
...
...
@@ -38,7 +38,7 @@
<string>
Go To Waypoint
</string>
</property>
</widget>
<widget
class=
"QComboBox"
name=
"
comboBox_2
"
>
<widget
class=
"QComboBox"
name=
"
waypointComboBox
"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
...
...
@@ -48,19 +48,6 @@
</rect>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton_6"
>
<property
name=
"geometry"
>
<rect>
<x>
150
</x>
<y>
50
</y>
<width>
81
</width>
<height>
23
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Restart Mission
</string>
</property>
</widget>
<widget
class=
"QWidget"
name=
"horizontalLayoutWidget"
>
<property
name=
"geometry"
>
<rect>
...
...
@@ -72,10 +59,10 @@
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QSpinBox"
name=
"sp
inBox_2
"
/>
<widget
class=
"QSpinBox"
name=
"sp
eedSpinBox
"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"
pushButton_12
"
>
<widget
class=
"QPushButton"
name=
"
changeSpeedButton
"
>
<property
name=
"text"
>
<string>
Change Speed
</string>
</property>
...
...
@@ -94,10 +81,10 @@
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QSpinBox"
name=
"
s
pinBox"
/>
<widget
class=
"QSpinBox"
name=
"
altitudeS
pinBox"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"
pushButton_11
"
>
<widget
class=
"QPushButton"
name=
"
changeAltitudeButton
"
>
<property
name=
"text"
>
<string>
Change Altitude
</string>
</property>
...
...
@@ -105,14 +92,40 @@
</item>
</layout>
</widget>
<widget
class=
"QLabel"
name=
"currentWaypointLabel"
>
<property
name=
"geometry"
>
<rect>
<x>
150
</x>
<y>
20
</y>
<width>
81
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Current:
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton_6"
>
<property
name=
"geometry"
>
<rect>
<x>
150
</x>
<y>
50
</y>
<width>
81
</width>
<height>
23
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Restart Mission
</string>
</property>
</widget>
</widget>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
180
</y>
<width>
40
1
</width>
<height>
1
1
1
</height>
<width>
31
1
</width>
<height>
1
6
1
</height>
</rect>
</property>
<property
name=
"title"
>
...
...
@@ -203,17 +216,17 @@
<string>
RTL
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"
pushButton_10
"
>
<widget
class=
"QPushButton"
name=
"
armDisarmButton
"
>
<property
name=
"geometry"
>
<rect>
<x>
3
10
</x>
<y>
2
0
</y>
<width>
8
1
</width>
<height>
5
1
</height>
<x>
10
</x>
<y>
11
0
</y>
<width>
29
1
</width>
<height>
4
1
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
A
rm/Disarm
</string>
<string>
A
RM
</string>
</property>
</widget>
</widget>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment