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
fb05e125
Commit
fb05e125
authored
Jun 09, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update UI control elements from vehicle, allows multi-operator mode
parent
f2c53477
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
16 deletions
+39
-16
UASControlWidget.cc
src/ui/uas/UASControlWidget.cc
+33
-15
UASControlWidget.h
src/ui/uas/UASControlWidget.h
+6
-1
No files found.
src/ui/uas/UASControlWidget.cc
View file @
fb05e125
...
...
@@ -55,7 +55,8 @@ This file is part of the PIXHAWK project
#define CONTROL_MODE_TEST1_INDEX 6
UASControlWidget
::
UASControlWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
uas
(
NULL
)
uas
(
NULL
),
engineOn
(
false
)
{
ui
.
setupUi
(
this
);
...
...
@@ -94,6 +95,9 @@ void UASControlWidget::setUAS(UASInterface* uas)
ui
.
controlStatusLabel
->
setText
(
tr
(
"Connected to "
)
+
uas
->
getUASName
());
connect
(
uas
,
SIGNAL
(
modeChanged
(
int
,
QString
,
QString
)),
this
,
SLOT
(
updateMode
(
int
,
QString
,
QString
)));
connect
(
uas
,
SIGNAL
(
statusChanged
(
int
)),
this
,
SLOT
(
updateState
(
int
)));
this
->
uas
=
uas
;
}
}
...
...
@@ -102,6 +106,28 @@ UASControlWidget::~UASControlWidget() {
}
void
UASControlWidget
::
updateMode
(
int
uas
,
QString
mode
,
QString
description
)
{
Q_UNUSED
(
uas
);
Q_UNUSED
(
mode
);
Q_UNUSED
(
description
);
}
void
UASControlWidget
::
updateState
(
int
state
)
{
switch
(
state
)
{
case
(
int
)
MAV_STATE_ACTIVE
:
engineOn
=
true
;
ui
.
controlButton
->
setText
(
tr
(
"Stop Engine"
));
break
;
case
(
int
)
MAV_STATE_STANDBY
:
engineOn
=
false
;
ui
.
controlButton
->
setText
(
tr
(
"Activate Engine"
));
break
;
}
}
void
UASControlWidget
::
setMode
(
int
mode
)
{
// Adapt context button mode
...
...
@@ -151,34 +177,26 @@ void UASControlWidget::transmitMode()
void
UASControlWidget
::
cycleContextButton
()
{
//switch(uas->getMode());
static
int
state
=
0
;
UAS
*
mav
=
dynamic_cast
<
UAS
*>
(
this
->
uas
);
if
(
mav
)
{
switch
(
state
)
if
(
engineOn
)
{
case
0
:
ui
.
controlButton
->
setText
(
tr
(
"Stop Engine"
));
mav
->
setMode
(
MAV_MODE_MANUAL
);
mav
->
enable_motors
();
ui
.
lastActionLabel
->
setText
(
QString
(
"Enabled motors on %1"
).
arg
(
uas
->
getUASName
()));
state
++
;
break
;
case
1
:
}
else
{
ui
.
controlButton
->
setText
(
tr
(
"Activate Engine"
));
mav
->
setMode
(
MAV_MODE_LOCKED
);
mav
->
disable_motors
();
ui
.
lastActionLabel
->
setText
(
QString
(
"Disabled motors on %1"
).
arg
(
uas
->
getUASName
()));
state
=
0
;
break
;
case
2
:
//ui.controlButton->setText(tr("Force Landing"));
ui
.
controlButton
->
setText
(
tr
(
"KILL VEHICLE"
));
break
;
}
//ui.controlButton->setText(tr("Force Landing"));
//ui.controlButton->setText(tr("KILL VEHICLE"));
}
}
...
...
src/ui/uas/UASControlWidget.h
View file @
fb05e125
...
...
@@ -53,12 +53,17 @@ public slots:
void
cycleContextButton
();
/** @brief Set the operation mode of the MAV */
void
setMode
(
int
mode
);
/** @brief Transmit the operation mode *
*
/
/** @brief Transmit the operation mode */
void
transmitMode
();
/** @brief Update the mode */
void
updateMode
(
int
uas
,
QString
mode
,
QString
description
);
/** @brief Update state */
void
updateState
(
int
state
);
protected:
UASInterface
*
uas
;
unsigned
int
uasMode
;
bool
engineOn
;
private:
Ui
::
uasControl
ui
;
...
...
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