Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
45eb8581
Commit
45eb8581
authored
Oct 13, 2012
by
Thomas Gubler
Browse files
HIL: reorganization of UI
parent
172fd1bb
Changes
18
Show whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
45eb8581
...
...
@@ -224,7 +224,9 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
mission
/
QGCMissionDoStartSearch
.
ui
\
src
/
ui
/
mission
/
QGCMissionDoFinishSearch
.
ui
\
src
/
ui
/
QGCVehicleConfig
.
ui
\
src
/
ui
/
QGCHilConfiguration
.
ui
src
/
ui
/
QGCHilConfiguration
.
ui
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
ui
\
src
/
ui
/
QGCHilXPlaneConfiguration
.
ui
INCLUDEPATH
+=
src
\
src
/
ui
\
src
/
ui
/
linechart
\
...
...
@@ -362,7 +364,9 @@ HEADERS += src/MG.h \
src
/
ui
/
mission
/
QGCMissionDoFinishSearch
.
h
\
src
/
ui
/
QGCVehicleConfig
.
h
\
src
/
comm
/
QGCHilLink
.
h
\
src
/
ui
/
QGCHilConfiguration
.
h
src
/
ui
/
QGCHilConfiguration
.
h
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
h
\
src
/
ui
/
QGCHilXPlaneConfiguration
.
h
#
Google
Earth
is
only
supported
on
Mac
OS
and
Windows
with
Visual
Studio
Compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
::
HEADERS
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
h
...
...
@@ -520,7 +524,9 @@ SOURCES += src/main.cc \
src
/
ui
/
mission
/
QGCMissionDoFinishSearch
.
cc
\
src
/
ui
/
QGCVehicleConfig
.
cc
\
src
/
comm
/
QGCHilLink
.
cc
\
src
/
ui
/
QGCHilConfiguration
.
cc
src
/
ui
/
QGCHilConfiguration
.
cc
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
cc
\
src
/
ui
/
QGCHilXPlaneConfiguration
.
cc
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
src/comm/QGCFlightGearLink.cc
View file @
45eb8581
...
...
@@ -39,9 +39,10 @@ This file is part of the QGROUNDCONTROL project
#include
<QHostInfo>
#include
"MainWindow.h"
QGCFlightGearLink
::
QGCFlightGearLink
(
UASInterface
*
mav
,
QString
remoteHost
,
QHostAddress
host
,
quint16
port
)
:
QGCFlightGearLink
::
QGCFlightGearLink
(
UASInterface
*
mav
,
QString
startupArguments
,
QString
remoteHost
,
QHostAddress
host
,
quint16
port
)
:
process
(
NULL
),
terraSync
(
NULL
),
startupArguments
(
startupArguments
),
flightGearVersion
(
0
)
{
this
->
host
=
host
;
...
...
@@ -438,35 +439,37 @@ bool QGCFlightGearLink::connectSimulation()
flightGearArguments
<<
QString
(
"--generic=socket,in,50,127.0.0.1,%1,udp,qgroundcontrol"
).
arg
(
currentPort
);
}
flightGearArguments
<<
"--atlas=socket,out,1,localhost,5505,udp"
;
flightGearArguments
<<
"--in-air"
;
flightGearArguments
<<
"--roll=0"
;
flightGearArguments
<<
"--pitch=0"
;
flightGearArguments
<<
"--vc=90"
;
flightGearArguments
<<
"--heading=300"
;
flightGearArguments
<<
"--timeofday=noon"
;
flightGearArguments
<<
"--disable-hud-3d"
;
flightGearArguments
<<
"--disable-fullscreen"
;
flightGearArguments
<<
"--geometry=400x300"
;
flightGearArguments
<<
"--disable-anti-alias-hud"
;
flightGearArguments
<<
"--wind=0@0"
;
flightGearArguments
<<
"--turbulence=0.0"
;
flightGearArguments
<<
"--prop:/sim/frame-rate-throttle-hz=30"
;
flightGearArguments
<<
"--control=mouse"
;
flightGearArguments
<<
"--disable-intro-music"
;
flightGearArguments
<<
"--disable-sound"
;
flightGearArguments
<<
"--disable-random-objects"
;
flightGearArguments
<<
"--disable-ai-models"
;
flightGearArguments
<<
"--shading-flat"
;
flightGearArguments
<<
"--fog-disable"
;
flightGearArguments
<<
"--disable-specular-highlight"
;
//flightGearArguments << "--disable-skyblend";
flightGearArguments
<<
"--disable-random-objects"
;
flightGearArguments
<<
"--disable-panel"
;
//flightGearArguments << "--disable-horizon-effect";
flightGearArguments
<<
"--disable-clouds"
;
flightGearArguments
<<
"--fdm=jsb"
;
flightGearArguments
<<
"--units-meters"
;
//XXX: check: the protocol xml has already a conversion from feet to m?
flightGearArguments
<<
"--notrim"
;
// flightGearArguments << "--in-air";
// flightGearArguments << "--roll=0";
// flightGearArguments << "--pitch=0";
// flightGearArguments << "--vc=90";
// flightGearArguments << "--heading=300";
// flightGearArguments << "--timeofday=noon";
// flightGearArguments << "--disable-hud-3d";
// flightGearArguments << "--disable-fullscreen";
// flightGearArguments << "--geometry=400x300";
// flightGearArguments << "--disable-anti-alias-hud";
// flightGearArguments << "--wind=0@0";
// flightGearArguments << "--turbulence=0.0";
// flightGearArguments << "--prop:/sim/frame-rate-throttle-hz=30";
// flightGearArguments << "--control=mouse";
// flightGearArguments << "--disable-intro-music";
// flightGearArguments << "--disable-sound";
// flightGearArguments << "--disable-random-objects";
// flightGearArguments << "--disable-ai-models";
// flightGearArguments << "--shading-flat";
// flightGearArguments << "--fog-disable";
// flightGearArguments << "--disable-specular-highlight";
// //flightGearArguments << "--disable-skyblend";
// flightGearArguments << "--disable-random-objects";
// flightGearArguments << "--disable-panel";
// //flightGearArguments << "--disable-horizon-effect";
// flightGearArguments << "--disable-clouds";
// flightGearArguments << "--fdm=jsb";
// flightGearArguments << "--units-meters"; //XXX: check: the protocol xml has already a conversion from feet to m?
// flightGearArguments << "--notrim";
flightGearArguments
+=
startupArguments
.
split
(
" "
);
if
(
mav
->
getSystemType
()
==
MAV_TYPE_QUADROTOR
)
{
// Start all engines of the quad
...
...
src/comm/QGCFlightGearLink.h
View file @
45eb8581
...
...
@@ -49,7 +49,7 @@ class QGCFlightGearLink : public QGCHilLink
//Q_INTERFACES(QGCFlightGearLinkInterface:LinkInterface)
public:
QGCFlightGearLink
(
UASInterface
*
mav
,
QString
remoteHost
=
QString
(
"127.0.0.1:49000"
),
QHostAddress
host
=
QHostAddress
::
Any
,
quint16
port
=
49005
);
QGCFlightGearLink
(
UASInterface
*
mav
,
QString
startupArguments
,
QString
remoteHost
=
QString
(
"127.0.0.1:49000"
),
QHostAddress
host
=
QHostAddress
::
Any
,
quint16
port
=
49005
);
~
QGCFlightGearLink
();
bool
isConnected
();
...
...
@@ -137,6 +137,7 @@ protected:
QProcess
*
process
;
QProcess
*
terraSync
;
unsigned
int
flightGearVersion
;
QString
startupArguments
;
void
setName
(
QString
name
);
...
...
src/uas/UAS.cc
View file @
45eb8581
...
...
@@ -2590,14 +2590,14 @@ bool UAS::emergencyKILL()
}
/**
* If enabled, connect the flig
t
h gear link.
* If enabled, connect the fligh
t
gear link.
*/
void
UAS
::
enableHilFlightGear
(
bool
enable
)
void
UAS
::
enableHilFlightGear
(
bool
enable
,
QString
options
)
{
// Connect Flight Gear Link
if
(
enable
)
{
simulation
=
new
QGCFlightGearLink
(
this
);
simulation
=
new
QGCFlightGearLink
(
this
,
options
);
startHil
();
}
else
...
...
@@ -2607,13 +2607,14 @@ void UAS::enableHilFlightGear(bool enable)
}
/**
* If enabled, connect the
fligth
gear link.
* If enabled, connect the
X-plane
gear link.
*/
void
UAS
::
enableHilXPlane
(
bool
enable
)
{
// Connect
Flight Gear
Link
// Connect
X-Plane
Link
if
(
enable
)
{
simulation
=
new
QGCXPlaneLink
(
this
);
startHil
();
}
else
...
...
src/uas/UAS.h
View file @
45eb8581
...
...
@@ -528,7 +528,7 @@ public slots:
void
go
();
/** @brief Enable / disable HIL */
void
enableHilFlightGear
(
bool
enable
);
void
enableHilFlightGear
(
bool
enable
,
QString
options
);
void
enableHilXPlane
(
bool
enable
);
...
...
src/ui/MainWindow.cc
View file @
45eb8581
...
...
@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project
#include
<QSplashScreen>
#include
<QGCHilLink.h>
#include
<QGCHilConfiguration.h>
#include
<QGCHilFlightGearConfiguration.h>
#include
"QGC.h"
#include
"MAVLinkSimulationLink.h"
...
...
@@ -643,6 +644,26 @@ void MainWindow::showCentralWidget()
centerStack
->
setCurrentWidget
(
widget
);
}
void
MainWindow
::
showHILConfigurationWidget
(
UASInterface
*
uas
)
{
// Add simulation configuration widget
UAS
*
mav
=
dynamic_cast
<
UAS
*>
(
uas
);
if
(
mav
)
{
QGCHilConfiguration
*
hconf
=
new
QGCHilConfiguration
(
mav
,
this
);
QString
hilDockName
=
tr
(
"HIL Config (%1)"
).
arg
(
uas
->
getUASName
());
QDockWidget
*
hilDock
=
new
QDockWidget
(
hilDockName
,
this
);
hilDock
->
setWidget
(
hconf
);
hilDock
->
setObjectName
(
QString
(
"HIL_CONFIG_%1"
).
arg
(
uas
->
getUASID
()));
addTool
(
hilDock
,
hilDockName
,
Qt
::
RightDockWidgetArea
);
}
// Reload view state in case new widgets were added
loadViewState
();
}
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
{
if
(
isVisible
())
storeViewState
();
...
...
@@ -1420,19 +1441,6 @@ void MainWindow::UASCreated(UASInterface* uas)
if
(
!
ui
.
menuConnected_Systems
->
isEnabled
())
ui
.
menuConnected_Systems
->
setEnabled
(
true
);
if
(
!
ui
.
menuUnmanned_System
->
isEnabled
())
ui
.
menuUnmanned_System
->
setEnabled
(
true
);
// Add simulation configuration widget
UAS
*
mav
=
dynamic_cast
<
UAS
*>
(
uas
);
if
(
mav
)
{
QGCHilConfiguration
*
hconf
=
new
QGCHilConfiguration
(
mav
->
getHILSimulation
(),
this
);
QString
hilDockName
=
tr
(
"HIL Config (%1)"
).
arg
(
uas
->
getUASName
());
QDockWidget
*
hilDock
=
new
QDockWidget
(
hilDockName
,
this
);
hilDock
->
setWidget
(
hconf
);
hilDock
->
setObjectName
(
QString
(
"HIL_CONFIG_%1"
).
arg
(
uas
->
getUASID
()));
addTool
(
hilDock
,
hilDockName
,
Qt
::
RightDockWidgetArea
);
}
// Reload view state in case new widgets were added
loadViewState
();
}
...
...
src/ui/MainWindow.h
View file @
45eb8581
...
...
@@ -201,6 +201,9 @@ public slots:
/** @brief Load custom widgets from default file */
void
loadCustomWidgetsFromDefaults
(
const
QString
&
systemType
,
const
QString
&
autopilotType
);
/** @brief Loads and shows the HIL Configuration Widget for the given UAS*/
void
showHILConfigurationWidget
(
UASInterface
*
uas
);
void
closeEvent
(
QCloseEvent
*
event
);
/** @brief Load data view, allowing to plot flight data */
...
...
src/ui/QGCHilConfiguration.cc
View file @
45eb8581
#include
"QGCHilConfiguration.h"
#include
"ui_QGCHilConfiguration.h"
#include
"QGCXPlaneLink.h"
QGCHilConfiguration
::
QGCHilConfiguration
(
QGCHilLink
*
link
,
QWidget
*
parent
)
:
#include
"QGCHilFlightGearConfiguration.h"
#include
"QGCHilXPlaneConfiguration.h"
QGCHilConfiguration
::
QGCHilConfiguration
(
UAS
*
mav
,
QWidget
*
parent
)
:
QWidget
(
parent
),
link
(
link
),
mav
(
mav
),
ui
(
new
Ui
::
QGCHilConfiguration
)
{
ui
->
setupUi
(
this
);
connect
(
ui
->
startButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleSimulation
(
bool
)));
connect
(
ui
->
hostComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setRemoteHost
(
QString
)));
connect
(
link
,
SIGNAL
(
remoteChanged
(
QString
)),
ui
->
hostComboBox
,
SLOT
(
setEditText
(
QString
)));
connect
(
link
,
SIGNAL
(
statusMessage
(
QString
)),
this
,
SLOT
(
receiveStatusMessage
(
QString
)));
connect
(
link
,
SIGNAL
(
versionChanged
(
QString
)),
ui
->
simComboBox
,
SLOT
(
setEditText
(
QString
)));
connect
(
ui
->
simComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setVersion
(
QString
)));
ui
->
simComboBox
->
setEditText
(
link
->
getVersion
());
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
QGCXPlaneLink
*
xplane
=
dynamic_cast
<
QGCXPlaneLink
*>
(
link
);
connect
(
mav
->
getHILSimulation
(),
SIGNAL
(
statusMessage
(
QString
)),
this
,
SLOT
(
receiveStatusMessage
(
QString
)));
connect
(
ui
->
simComboBox
,
SIGNAL
(
activated
(
QString
)),
mav
->
getHILSimulation
(),
SLOT
(
setVersion
(
QString
)));
//ui->simComboBox->setEditText(mav->getHILSimulation()->getVersion());
if
(
xplane
)
{
connect
(
ui
->
randomAttitudeButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomAttitude
()));
connect
(
ui
->
randomPositionButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomPosition
()));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setAirframe
(
QString
)));
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
}
ui
->
hostComboBox
->
clear
();
ui
->
hostComboBox
->
addItem
(
link
->
getRemoteHost
());
// connect(ui->)
}
...
...
@@ -39,23 +23,26 @@ void QGCHilConfiguration::receiveStatusMessage(const QString& message)
ui
->
statusLabel
->
setText
(
message
);
}
void
QGCHilConfiguration
::
toggleSimulation
(
bool
connect
)
QGCHilConfiguration
::~
QGCHilConfiguration
()
{
delete
ui
;
}
void
QGCHilConfiguration
::
on_simComboBox_currentIndexChanged
(
int
index
)
{
Q_UNUSED
(
connect
);
if
(
!
link
->
isConnected
()
)
//XXX make sure here that no other simulator is running
if
(
1
==
index
)
{
link
->
setRemoteHost
(
ui
->
hostComboBox
->
currentText
());
link
->
connectSimulation
();
ui
->
startButton
->
setText
(
tr
(
"Disconnect"
));
QGCHilFlightGearConfiguration
*
hfgconf
=
new
QGCHilFlightGearConfiguration
(
mav
,
this
);
hfgconf
->
show
();
ui
->
simulatorConfigurationDockWidget
->
setWidget
(
hfgconf
);
}
else
else
if
(
2
==
index
||
3
==
index
)
{
link
->
disconnectSimulation
();
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
}
}
QGCHilXPlaneConfiguration
*
hxpconf
=
new
QGCHilXPlaneConfiguration
(
mav
->
getHILSimulation
(),
this
);
hxpconf
->
show
();
ui
->
simulatorConfigurationDockWidget
->
setWidget
(
hxpconf
);
QGCHilConfiguration
::~
QGCHilConfiguration
()
{
delete
ui
;
}
}
src/ui/QGCHilConfiguration.h
View file @
45eb8581
...
...
@@ -4,6 +4,7 @@
#include
<QWidget>
#include
"QGCHilLink.h"
#include
"UAS.h"
namespace
Ui
{
class
QGCHilConfiguration
;
...
...
@@ -14,17 +15,18 @@ class QGCHilConfiguration : public QWidget
Q_OBJECT
public:
QGCHilConfiguration
(
QGCHilLink
*
link
,
QWidget
*
parent
=
0
);
QGCHilConfiguration
(
UAS
*
mav
,
QWidget
*
parent
=
0
);
~
QGCHilConfiguration
();
public
slots
:
/** @brief Start / stop simulation */
void
toggleSimulation
(
bool
connect
);
/** @brief Receive status message */
void
receiveStatusMessage
(
const
QString
&
message
);
protected:
QGCHilLink
*
link
;
UAS
*
mav
;
private
slots
:
void
on_simComboBox_currentIndexChanged
(
int
index
);
private:
Ui
::
QGCHilConfiguration
*
ui
;
...
...
src/ui/QGCHilConfiguration.ui
View file @
45eb8581
...
...
@@ -7,70 +7,13 @@
<x>
0
</x>
<y>
0
</y>
<width>
305
</width>
<height>
261
</height>
<height>
355
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"40,60,50,50"
>
<item
row=
"1"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"airframeComboBox"
>
<property
name=
"editable"
>
<bool>
true
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
X-Plane default
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
QRO_X/MK
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
QRO_X/Ardrone
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
QRO_X/PWM
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Unlimited
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Twinjet
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Early Bird
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Reno Racer
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Slowstick
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Tiny
</string>
</property>
</item>
</widget>
</item>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"40,0,0"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"simLabel"
>
<property
name=
"text"
>
...
...
@@ -78,32 +21,21 @@
</property>
</widget>
</item>
<item
row=
"
4
"
column=
"
2
"
colspan=
"2"
>
<widget
class=
"Q
PushButton"
name=
"setHomeButton
"
>
<property
name=
"
text
"
>
<
string>
Set HOME
</string
>
<item
row=
"
0
"
column=
"
1
"
colspan=
"2"
>
<widget
class=
"Q
ComboBox"
name=
"simComboBox
"
>
<property
name=
"
editable
"
>
<
bool>
true
</bool
>
</property>
</widget>
</item>
<item
row=
"7"
column=
"0"
>
<widget
class=
"QLabel"
name=
"statusLabel"
>
<item>
<property
name=
"text"
>
<string
>
Status
</string
>
<string
/
>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<item>
<property
name=
"text"
>
<string>
Airframe
</string>
<string>
Flightgear
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"simComboBox"
>
<property
name=
"editable"
>
<bool>
true
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
X-Plane 10
</string>
...
...
@@ -116,59 +48,33 @@
</item>
</widget>
</item>
<item
row=
"2"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"hostComboBox"
>
<property
name=
"editable"
>
<bool>
true
</bool>
<item
row=
"1"
column=
"0"
colspan=
"3"
>
<widget
class=
"QDockWidget"
name=
"simulatorConfigurationDockWidget"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<item>
<property
name=
"text"
>
<string>
127.0.0.1:49000
</string>
</property>
</item>
</widget>
</item>
<item
row=
"6"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomPositionButton"
>
<property
name=
"text"
>
<string>
Random POS
</string>
<property
name=
"minimumSize"
>
<size>
<width>
33
</width>
<height>
150
</height>
</size>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomAttitudeButton"
>
<property
name=
"text"
>
<string>
Random ATT
</string>
<property
name=
"features"
>
<set>
QDockWidget::NoDockWidgetFeatures
</set>
</property>
<widget
class=
"QWidget"
name=
"dockWidgetContents"
/>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"hostLabel"
>
<property
name=
"text"
>
<string>
Host
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"startButton"
>
<widget
class=
"QLabel"
name=
"statusLabel"
>
<property
name=
"text"
>
<string>
Sta
r
t
</string>
<string>
Stat
us
</string>
</property>
</widget>
</item>
<item
row=
"8"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
...
...
src/ui/QGCHilFlightGearConfiguration.cc
0 → 100644
View file @
45eb8581
#include
"QGCHilFlightGearConfiguration.h"
#include
"ui_QGCHilFlightGearConfiguration.h"
#include
"MainWindow.h"
QGCHilFlightGearConfiguration
::
QGCHilFlightGearConfiguration
(
UAS
*
mav
,
QWidget
*
parent
)
:
QWidget
(
parent
),
mav
(
mav
),
ui
(
new
Ui
::
QGCHilFlightGearConfiguration
)
{
ui
->
setupUi
(
this
);
}
QGCHilFlightGearConfiguration
::~
QGCHilFlightGearConfiguration
()
{
delete
ui
;
}
void
QGCHilFlightGearConfiguration
::
on_startButton_clicked
()
{
mav
->
enableHilFlightGear
(
true
,
ui
->
optionsPlainTextEdit
->
toPlainText
());
}
src/ui/QGCHilFlightGearConfiguration.h
0 → 100644
View file @
45eb8581
#ifndef QGCHILFLIGHTGEARCONFIGURATION_H
#define QGCHILFLIGHTGEARCONFIGURATION_H
#include
<QWidget>
#include
"QGCHilLink.h"
#include
"QGCFlightGearLink.h"
#include
"UAS.h"
namespace
Ui
{
class
QGCHilFlightGearConfiguration
;
}
class
QGCHilFlightGearConfiguration
:
public
QWidget
{
Q_OBJECT
public:
explicit
QGCHilFlightGearConfiguration
(
UAS
*
mav
,
QWidget
*
parent
=
0
);
~
QGCHilFlightGearConfiguration
();
protected:
UAS
*
mav
;
private
slots
:
void
on_startButton_clicked
();
private:
Ui
::
QGCHilFlightGearConfiguration
*
ui
;
};
#endif // QGCHILFLIGHTGEARCONFIGURATION_H
src/ui/QGCHilFlightGearConfiguration.ui
0 → 100644
View file @
45eb8581
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
QGCHilFlightGearConfiguration
</class>
<widget
class=
"QWidget"
name=
"QGCHilFlightGearConfiguration"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
350
</width>
<height>
261
</height>
</rect>
</property>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Expanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<widget
class=
"QWidget"
name=
"gridLayoutWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
0
</y>
<width>
331
</width>
<height>
261
</height>
</rect>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"margin"
>
<number>
9
</number>
</property>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QPlainTextEdit"
name=
"optionsPlainTextEdit"
>
<property
name=
"plainText"
>
<string>
--in-air --roll=0 --pitch=0 --vc=90 --heading=300 --timeofday=noon --disable-hud-3d --disable-fullscreen --geometry=400x300 --disable-anti-alias-hud --wind=0@0 --turbulence=0.0 --prop:/sim/frame-rate-throttle-hz=30 --control=mouse --disable-intro-music --disable-sound --disable-random-objects --disable-ai-models --shading-flat --fog-disable --disable-specular-highlight --disable-random-objects --disable-panel --disable-clouds --fdm=jsb --units-meters --notrim --prop:/engines/engine/running=true
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"startButton"
>
<property
name=
"text"
>
<string>
Start
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
68
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"plaintextInfoLabel"
>
<property
name=
"text"
>
<string>
Additional Options:
</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
src/ui/QGCHilXPlaneConfiguration.cc
0 → 100644
View file @
45eb8581
#include
"QGCHilXPlaneConfiguration.h"
#include
"ui_QGCHilXPlaneConfiguration.h"
#include
"QGCXPlaneLink.h"
QGCHilXPlaneConfiguration
::
QGCHilXPlaneConfiguration
(
QGCHilLink
*
link
,
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
QGCHilXPlaneConfiguration
)
{
ui
->
setupUi
(
this
);
connect
(
ui
->
startButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleSimulation
(
bool
)));
connect
(
ui
->
hostComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setRemoteHost
(
QString
)));
connect
(
link
,
SIGNAL
(
remoteChanged
(
QString
)),
ui
->
hostComboBox
,
SLOT
(
setEditText
(
QString
)));
connect
(
link
,
SIGNAL
(
statusMessage
(
QString
)),
this
,
SLOT
(
receiveStatusMessage
(
QString
)));
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
QGCXPlaneLink
*
xplane
=
dynamic_cast
<
QGCXPlaneLink
*>
(
link
);
if
(
xplane
)
{
connect
(
ui
->
randomAttitudeButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomAttitude
()));
connect
(
ui
->
randomPositionButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomPosition
()));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setAirframe
(
QString
)));
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
}
ui
->
hostComboBox
->
clear
();
ui
->
hostComboBox
->
addItem
(
link
->
getRemoteHost
());
}
void
QGCHilXPlaneConfiguration
::
toggleSimulation
(
bool
connect
)
{
Q_UNUSED
(
connect
);
if
(
!
link
->
isConnected
())
{
link
->
setRemoteHost
(
ui
->
hostComboBox
->
currentText
());
link
->
connectSimulation
();
ui
->
startButton
->
setText
(
tr
(
"Disconnect"
));
}
else
{
link
->
disconnectSimulation
();
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
}
}
QGCHilXPlaneConfiguration
::~
QGCHilXPlaneConfiguration
()
{
delete
ui
;
}
src/ui/QGCHilXPlaneConfiguration.h
0 → 100644
View file @
45eb8581
#ifndef QGCHILXPLANECONFIGURATION_H
#define QGCHILXPLANECONFIGURATION_H
#include
<QWidget>
#include
"QGCHilLink.h"
namespace
Ui
{
class
QGCHilXPlaneConfiguration
;
}
class
QGCHilXPlaneConfiguration
:
public
QWidget
{
Q_OBJECT
public:
explicit
QGCHilXPlaneConfiguration
(
QGCHilLink
*
link
,
QWidget
*
parent
=
0
);
~
QGCHilXPlaneConfiguration
();
public
slots
:
/** @brief Start / stop simulation */
void
toggleSimulation
(
bool
connect
);
protected:
QGCHilLink
*
link
;
private:
Ui
::
QGCHilXPlaneConfiguration
*
ui
;
};
#endif // QGCHILXPLANECONFIGURATION_H
src/ui/QGCHilXPlaneConfiguration.ui
0 → 100644
View file @
45eb8581
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
QGCHilXPlaneConfiguration
</class>
<widget
class=
"QWidget"
name=
"QGCHilXPlaneConfiguration"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
305
</width>
<height>
261
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"40,0,0,0"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Airframe
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"airframeComboBox"
>
<property
name=
"editable"
>
<bool>
true
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
X-Plane default
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
QRO_X/MK
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
QRO_X/Ardrone
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
QRO_X/PWM
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Unlimited
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Twinjet
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Early Bird
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Reno Racer
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Slowstick
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Tiny
</string>
</property>
</item>
</widget>
</item>
<item
row=
"3"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"setHomeButton"
>
<property
name=
"text"
>
<string>
Set HOME
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"hostComboBox"
>
<property
name=
"editable"
>
<bool>
true
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
127.0.0.1:49000
</string>
</property>
</item>
</widget>
</item>
<item
row=
"5"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomPositionButton"
>
<property
name=
"text"
>
<string>
Random POS
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomAttitudeButton"
>
<property
name=
"text"
>
<string>
Random ATT
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"hostLabel"
>
<property
name=
"text"
>
<string>
Host
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"startButton"
>
<property
name=
"text"
>
<string>
Start
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
src/ui/uas/UASView.cc
View file @
45eb8581
...
...
@@ -40,6 +40,7 @@ This file is part of the PIXHAWK project
#include
"UASWaypointManager.h"
#include
"MainWindow.h"
#include
"ui_UASView.h"
#include
<QGCHilFlightGearConfiguration.h>
UASView
::
UASView
(
UASInterface
*
uas
,
QWidget
*
parent
)
:
QWidget
(
parent
),
...
...
@@ -68,8 +69,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
removeAction
(
new
QAction
(
"Delete this system"
,
this
)),
renameAction
(
new
QAction
(
"Rename.."
,
this
)),
selectAction
(
new
QAction
(
"Control this system"
,
this
)),
hilAction
(
new
QAction
(
"Enable Flightgear Hardware-in-the-Loop Simulation"
,
this
)),
hilXAction
(
new
QAction
(
"Enable X-Plane Hardware-in-the-Loop Simulation"
,
this
)),
hilAction
(
new
QAction
(
"HIL - Hardware in the Loop"
,
this
)),
selectAirframeAction
(
new
QAction
(
"Choose Airframe"
,
this
)),
setBatterySpecsAction
(
new
QAction
(
"Set Battery Options"
,
this
)),
lowPowerModeEnabled
(
true
),
...
...
@@ -81,9 +81,6 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
lowPowerModeEnabled
=
MainWindow
::
instance
()
->
lowPowerModeEnabled
();
hilAction
->
setCheckable
(
true
);
// Flightgear is not ready for prime time
//hilAction->setEnabled(false);
hilXAction
->
setCheckable
(
true
);
m_ui
->
setupUi
(
this
);
...
...
@@ -122,8 +119,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect
(
removeAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
deleteLater
()));
connect
(
renameAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
rename
()));
connect
(
selectAction
,
SIGNAL
(
triggered
()),
uas
,
SLOT
(
setSelected
()));
connect
(
hilAction
,
SIGNAL
(
triggered
(
bool
)),
uas
,
SLOT
(
enableHilFlightGear
(
bool
)));
connect
(
hilXAction
,
SIGNAL
(
triggered
(
bool
)),
uas
,
SLOT
(
enableHilXPlane
(
bool
)));
connect
(
hilAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showHILUi
()));
connect
(
selectAirframeAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
selectAirframe
()));
connect
(
setBatterySpecsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
setBatterySpecs
()));
connect
(
uas
,
SIGNAL
(
systemRemoved
()),
this
,
SLOT
(
deleteLater
()));
...
...
@@ -504,8 +500,6 @@ void UASView::contextMenuEvent (QContextMenuEvent* event)
menu
.
addAction
(
removeAction
);
}
menu
.
addAction
(
hilAction
);
menu
.
addAction
(
hilXAction
);
// XXX Re-enable later menu.addAction(hilXAction);
menu
.
addAction
(
selectAirframeAction
);
menu
.
addAction
(
setBatterySpecsAction
);
menu
.
exec
(
event
->
globalPos
());
...
...
@@ -566,6 +560,11 @@ void UASView::selectAirframe()
}
}
void
UASView
::
showHILUi
()
{
MainWindow
::
instance
()
->
showHILConfigurationWidget
(
uas
);
}
void
UASView
::
refresh
()
{
//setUpdatesEnabled(false);
...
...
src/ui/uas/UASView.h
View file @
45eb8581
...
...
@@ -64,6 +64,7 @@ public slots:
void
updateMode
(
int
sysId
,
QString
status
,
QString
description
);
void
updateLoad
(
UASInterface
*
uas
,
double
load
);
//void receiveValue(int uasid, QString id, double value, quint64 time);
void
showHILUi
();
void
refresh
();
/** @brief Receive new waypoint information */
void
setWaypoint
(
int
uasId
,
int
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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