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
18511a93
Commit
18511a93
authored
Apr 23, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made sensor HIL configurable, fixed runtime warnings, WIP
parent
0c9de33c
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
118 additions
and
35 deletions
+118
-35
QGCFlightGearLink.h
src/comm/QGCFlightGearLink.h
+11
-0
QGCHilLink.h
src/comm/QGCHilLink.h
+11
-0
QGCJSBSimLink.h
src/comm/QGCJSBSimLink.h
+11
-0
QGCXPlaneLink.cc
src/comm/QGCXPlaneLink.cc
+4
-2
QGCXPlaneLink.h
src/comm/QGCXPlaneLink.h
+19
-9
configuration.h
src/configuration.h
+2
-2
MainWindow.cc
src/ui/MainWindow.cc
+4
-3
MainWindow.ui
src/ui/MainWindow.ui
+1
-1
QGCHilConfiguration.cc
src/ui/QGCHilConfiguration.cc
+25
-2
QGCHilXPlaneConfiguration.cc
src/ui/QGCHilXPlaneConfiguration.cc
+5
-0
QGCHilXPlaneConfiguration.ui
src/ui/QGCHilXPlaneConfiguration.ui
+23
-16
SystemViewParams.cc
src/ui/map3D/SystemViewParams.cc
+1
-0
ViewParamWidget.cc
src/ui/map3D/ViewParamWidget.cc
+1
-0
No files found.
src/comm/QGCFlightGearLink.h
View file @
18511a93
...
...
@@ -79,6 +79,10 @@ public:
return
-
1
;
}
bool
sensorHilEnabled
()
{
return
_sensorHilEnabled
;
}
void
run
();
public
slots
:
...
...
@@ -104,6 +108,12 @@ public slots:
Q_UNUSED
(
airframe
);
}
void
enableSensorHIL
(
bool
enable
)
{
if
(
enable
!=
_sensorHilEnabled
)
_sensorHilEnabled
=
enable
;
emit
sensorHilChanged
(
enable
);
}
void
readBytes
();
/**
* @brief Write a number of bytes to the interface.
...
...
@@ -144,6 +154,7 @@ protected:
QProcess
*
terraSync
;
unsigned
int
flightGearVersion
;
QString
startupArguments
;
bool
_sensorHilEnabled
;
void
setName
(
QString
name
);
...
...
src/comm/QGCHilLink.h
View file @
18511a93
...
...
@@ -37,6 +37,12 @@ public:
*/
virtual
int
getAirFrameIndex
()
=
0
;
/**
* @brief Check if sensor level HIL is enabled
* @return true if sensor HIL is enabled
*/
virtual
bool
sensorHilEnabled
()
=
0
;
public
slots
:
virtual
void
setPort
(
int
port
)
=
0
;
/** @brief Add a new host to broadcast messages to */
...
...
@@ -47,6 +53,8 @@ public slots:
virtual
void
processError
(
QProcess
::
ProcessError
err
)
=
0
;
/** @brief Set the simulator version as text string */
virtual
void
setVersion
(
const
QString
&
version
)
=
0
;
/** @brief Enable sensor-level HIL (instead of state-level HIL) */
virtual
void
enableSensorHIL
(
bool
enable
)
=
0
;
virtual
void
selectAirframe
(
const
QString
&
airframe
)
=
0
;
...
...
@@ -105,6 +113,9 @@ signals:
/** @brief Selected sim version changed */
void
versionChanged
(
const
QString
&
version
);
/** @brief Sensor leve HIL state changed */
void
sensorHilChanged
(
bool
enabled
);
};
#endif // QGCHILLINK_H
src/comm/QGCJSBSimLink.h
View file @
18511a93
...
...
@@ -81,6 +81,10 @@ public:
void
run
();
bool
sensorHilEnabled
()
{
return
_sensorHilEnabled
;
}
public
slots
:
// void setAddress(QString address);
void
setPort
(
int
port
);
...
...
@@ -104,6 +108,12 @@ public slots:
script
=
airframe
;
}
void
enableSensorHIL
(
bool
enable
)
{
if
(
enable
!=
_sensorHilEnabled
)
_sensorHilEnabled
=
enable
;
emit
sensorHilChanged
(
enable
);
}
void
readBytes
();
/**
* @brief Write a number of bytes to the interface.
...
...
@@ -142,6 +152,7 @@ protected:
unsigned
int
flightGearVersion
;
QString
startupArguments
;
QString
script
;
bool
_sensorHilEnabled
;
void
setName
(
QString
name
);
...
...
src/comm/QGCXPlaneLink.cc
View file @
18511a93
...
...
@@ -54,7 +54,7 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress
simUpdateLast
(
QGC
::
groundTimeMilliseconds
()),
simUpdateLastText
(
QGC
::
groundTimeMilliseconds
()),
simUpdateHz
(
0
),
sensorHilEnabled
(
true
)
_
sensorHilEnabled
(
true
)
{
this
->
localHost
=
localHost
;
this
->
localPort
=
localPort
/*+mav->getUASID()*/
;
...
...
@@ -81,6 +81,7 @@ void QGCXPlaneLink::loadSettings()
setRemoteHost
(
settings
.
value
(
"REMOTE_HOST"
,
QString
(
"%1:%2"
).
arg
(
remoteHost
.
toString
()).
arg
(
remotePort
)).
toString
());
setVersion
(
settings
.
value
(
"XPLANE_VERSION"
,
10
).
toInt
());
selectAirframe
(
settings
.
value
(
"AIRFRAME"
,
"default"
).
toString
());
_sensorHilEnabled
=
settings
.
value
(
"SENSOR_HIL"
,
_sensorHilEnabled
).
toBool
();
settings
.
endGroup
();
}
...
...
@@ -92,6 +93,7 @@ void QGCXPlaneLink::storeSettings()
settings
.
setValue
(
"REMOTE_HOST"
,
QString
(
"%1:%2"
).
arg
(
remoteHost
.
toString
()).
arg
(
remotePort
));
settings
.
setValue
(
"XPLANE_VERSION"
,
xPlaneVersion
);
settings
.
setValue
(
"AIRFRAME"
,
airframeName
);
settings
.
setValue
(
"SENSOR_HIL"
,
_sensorHilEnabled
);
settings
.
endGroup
();
settings
.
sync
();
}
...
...
@@ -623,7 +625,7 @@ void QGCXPlaneLink::readBytes()
}
simUpdateLast
=
QGC
::
groundTimeMilliseconds
();
if
(
sensorHilEnabled
)
if
(
_
sensorHilEnabled
)
{
diff_pressure
=
0.0
f
;
pressure_alt
=
alt
;
...
...
src/comm/QGCXPlaneLink.h
View file @
18511a93
...
...
@@ -91,6 +91,20 @@ public:
AIRFRAME_FIXED_WING_BIXLER_II_AILERONS
};
QString
getVersion
()
{
return
QString
(
"X-Plane %1"
).
arg
(
xPlaneVersion
);
}
int
getAirFrameIndex
()
{
return
(
int
)
airframeID
;
}
bool
sensorHilEnabled
()
{
return
_sensorHilEnabled
;
}
public
slots
:
// void setAddress(QString address);
void
setPort
(
int
port
);
...
...
@@ -104,14 +118,11 @@ public slots:
void
setVersion
(
const
QString
&
version
);
/** @brief Set the simulator version as integer */
void
setVersion
(
unsigned
int
version
);
QString
getVersion
()
{
return
QString
(
"X-Plane %1"
).
arg
(
xPlaneVersion
);
}
int
getAirFrameIndex
()
{
return
(
int
)
airframeID
;
void
enableSensorHIL
(
bool
enable
)
{
if
(
enable
!=
_sensorHilEnabled
)
_sensorHilEnabled
=
enable
;
emit
sensorHilChanged
(
enable
);
}
void
processError
(
QProcess
::
ProcessError
err
);
...
...
@@ -194,10 +205,9 @@ protected:
quint64
simUpdateLast
;
quint64
simUpdateLastText
;
float
simUpdateHz
;
bool
sensorHilEnabled
;
bool
_
sensorHilEnabled
;
void
setName
(
QString
name
);
};
#endif // QGCXPLANESIMULATIONLINK_H
src/configuration.h
View file @
18511a93
...
...
@@ -12,14 +12,14 @@
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION "v. 1.0.
4
(beta)"
#define QGC_APPLICATION_VERSION "v. 1.0.
2
(beta)"
namespace
QGC
{
const
QString
APPNAME
=
"QGROUNDCONTROL"
;
const
QString
COMPANYNAME
=
"QGROUNDCONTROL"
;
const
int
APPLICATIONVERSION
=
10
4
;
// 1.0.4
const
int
APPLICATIONVERSION
=
10
5
;
// 1.0.4
}
#endif // QGC_CONFIGURATION_H
src/ui/MainWindow.cc
View file @
18511a93
...
...
@@ -236,9 +236,10 @@ MainWindow::MainWindow(QWidget *parent):
const
int
screenWidth
=
QApplication
::
desktop
()
->
width
();
const
int
screenHeight
=
QApplication
::
desktop
()
->
height
();
if
(
screenWidth
<
1
2
00
)
if
(
screenWidth
<
1
4
00
)
{
showFullScreen
();
resize
(
screenWidth
,
screenHeight
-
80
);
show
();
}
else
{
...
...
@@ -680,7 +681,7 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
QDockWidget
*
hilDock
=
new
QDockWidget
(
hilDockName
,
this
);
hilDock
->
setWidget
(
hconf
);
hilDock
->
setObjectName
(
QString
(
"HIL_CONFIG_%1"
).
arg
(
uas
->
getUASID
()));
addTool
(
hilDock
,
hilDockName
,
Qt
::
Righ
tDockWidgetArea
);
addTool
(
hilDock
,
hilDockName
,
Qt
::
Lef
tDockWidgetArea
);
hilDocks
.
insert
(
mav
->
getUASID
(),
hilDock
);
if
(
currentView
!=
VIEW_SIMULATION
)
...
...
src/ui/MainWindow.ui
View file @
18511a93
...
...
@@ -497,7 +497,7 @@
<normaloff>
:/files/images/control/launch.svg
</normaloff>
:/files/images/control/launch.svg
</iconset>
</property>
<property
name=
"text"
>
<string>
Simulation
View
</string>
<string>
Simulation
</string>
</property>
<property
name=
"toolTip"
>
<string>
Open the simulation view
</string>
...
...
src/ui/QGCHilConfiguration.cc
View file @
18511a93
#include <QSettings>
#include "QGCHilConfiguration.h"
#include "ui_QGCHilConfiguration.h"
...
...
@@ -11,6 +13,22 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) :
ui
(
new
Ui
::
QGCHilConfiguration
)
{
ui
->
setupUi
(
this
);
// XXX its quite wrong that this is implicitely a factory
// class, but this is something to clean up for later.
QSettings
settings
;
int
i
=
settings
.
value
(
"SIMULATOR_INDEX"
,
-
1
).
toInt
();
settings
.
beginGroup
(
"QGC_HILCONFIG"
);
if
(
i
>
0
)
{
on_simComboBox_currentIndexChanged
(
i
);
ui
->
simComboBox
->
blockSignals
(
true
);
ui
->
simComboBox
->
setCurrentIndex
(
i
);
ui
->
simComboBox
->
blockSignals
(
false
);
}
settings
.
endGroup
();
}
void
QGCHilConfiguration
::
receiveStatusMessage
(
const
QString
&
message
)
...
...
@@ -20,6 +38,11 @@ void QGCHilConfiguration::receiveStatusMessage(const QString& message)
QGCHilConfiguration
::~
QGCHilConfiguration
()
{
QSettings
settings
;
settings
.
beginGroup
(
"QGC_HILCONFIG"
);
settings
.
setValue
(
"SIMULATOR_INDEX"
,
ui
->
simComboBox
->
currentIndex
());
settings
.
endGroup
();
settings
.
sync
();
delete
ui
;
}
...
...
@@ -29,8 +52,8 @@ void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index)
QLayoutItem
*
child
;
while
((
child
=
ui
->
simulatorConfigurationLayout
->
takeAt
(
0
))
!=
0
)
{
delete
child
->
widget
();
delete
child
;
delete
child
->
widget
();
delete
child
;
}
if
(
1
==
index
)
...
...
src/ui/QGCHilXPlaneConfiguration.cc
View file @
18511a93
...
...
@@ -27,6 +27,11 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
// connect(ui->randomPositionButton, SIGNAL(clicked()), link, SLOT(setRandomPosition()));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
selectAirframe
(
QString
)));
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
// XXX not implemented yet
ui
->
airframeComboBox
->
hide
();
ui
->
sensorHilCheckBox
->
setChecked
(
link
->
sensorHilEnabled
());
connect
(
link
,
SIGNAL
(
sensorHilChanged
(
bool
)),
ui
->
sensorHilCheckBox
,
SLOT
(
setChecked
(
bool
)));
connect
(
ui
->
sensorHilCheckBox
,
SIGNAL
(
clicked
(
bool
)),
link
,
SLOT
(
enableSensorHIL
(
bool
)));
}
ui
->
hostComboBox
->
clear
();
...
...
src/ui/QGCHilXPlaneConfiguration.ui
View file @
18511a93
...
...
@@ -6,14 +6,14 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
2
49
</width>
<height>
1
00
</height>
<width>
2
95
</width>
<height>
1
48
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"40,0,0,
0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"0,0,0,0,0,100"
columnstretch=
"40,10,10,4
0"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
...
...
@@ -24,19 +24,6 @@
</property>
</widget>
</item>
<item
row=
"5"
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>
<item
row=
"0"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"airframeComboBox"
>
<property
name=
"editable"
>
...
...
@@ -127,6 +114,26 @@
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"4"
>
<widget
class=
"QCheckBox"
name=
"sensorHilCheckBox"
>
<property
name=
"text"
>
<string>
Enable sensor level HIL
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"4"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
1
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
...
...
src/ui/map3D/SystemViewParams.cc
View file @
18511a93
...
...
@@ -18,6 +18,7 @@ SystemViewParams::SystemViewParams(int systemId)
,
mSetpointHistoryLength
(
100
)
{
setObjectName
(
"RGBD VIEW PARAMS"
);
}
bool
&
...
...
src/ui/map3D/ViewParamWidget.cc
View file @
18511a93
...
...
@@ -19,6 +19,7 @@ ViewParamWidget::ViewParamWidget(GlobalViewParamsPtr& globalViewParams,
,
mFollowCameraComboBox
(
new
QComboBox
(
this
))
,
mTabWidget
(
new
QTabWidget
(
this
))
{
setObjectName
(
"RGBD VIEW PARAMS WIDGET"
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
QWidget
*
widget
=
new
QWidget
;
widget
->
setLayout
(
layout
);
...
...
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