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
87594174
Commit
87594174
authored
Feb 14, 2014
by
Thomas Gubler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flightgear: add configurable barometer offset
parent
27059629
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
17 deletions
+52
-17
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+9
-2
QGCFlightGearLink.h
src/comm/QGCFlightGearLink.h
+3
-0
UAS.cc
src/uas/UAS.cc
+2
-1
UAS.h
src/uas/UAS.h
+1
-1
QGCHilConfiguration.cc
src/ui/QGCHilConfiguration.cc
+1
-1
QGCHilFlightGearConfiguration.cc
src/ui/QGCHilFlightGearConfiguration.cc
+7
-1
QGCHilFlightGearConfiguration.h
src/ui/QGCHilFlightGearConfiguration.h
+4
-0
QGCHilFlightGearConfiguration.ui
src/ui/QGCHilFlightGearConfiguration.ui
+25
-11
No files found.
src/comm/QGCFlightGearLink.cc
View file @
87594174
...
...
@@ -46,7 +46,8 @@ QGCFlightGearLink::QGCFlightGearLink(UASInterface* mav, QString startupArguments
terraSync
(
NULL
),
flightGearVersion
(
0
),
startupArguments
(
startupArguments
),
_sensorHilEnabled
(
true
)
_sensorHilEnabled
(
true
),
barometerOffsetkPa
(
0.0
)
{
this
->
host
=
host
;
this
->
port
=
port
+
mav
->
getUASID
();
...
...
@@ -279,7 +280,8 @@ void QGCFlightGearLink::readBytes()
mag_dip
=
values
.
at
(
18
).
toFloat
();
temperature
=
values
.
at
(
19
).
toFloat
();
abs_pressure
=
values
.
at
(
20
).
toFloat
()
*
1e2
;
//convert to Pa from hPa
abs_pressure
=
values
.
at
(
20
).
toFloat
()
*
1e2
f
;
//convert to Pa from hPa
abs_pressure
+=
barometerOffsetkPa
*
1e3
f
;
//add offset, convert from kPa to Pa
//calculate differential pressure
const
float
air_gas_constant
=
287.1
f
;
// J/(kg * K)
...
...
@@ -736,3 +738,8 @@ void QGCFlightGearLink::setName(QString name)
this
->
name
=
name
;
// emit nameChanged(this->name);
}
void
QGCFlightGearLink
::
setBarometerOffset
(
float
barometerOffsetkPa
)
{
this
->
barometerOffsetkPa
=
barometerOffsetkPa
;
}
src/comm/QGCFlightGearLink.h
View file @
87594174
...
...
@@ -42,6 +42,7 @@ This file is part of the QGROUNDCONTROL project
#include <configuration.h>
#include "UASInterface.h"
#include "QGCHilLink.h"
#include <QGCHilFlightGearConfiguration.h>
class
QGCFlightGearLink
:
public
QGCHilLink
{
...
...
@@ -134,6 +135,7 @@ public slots:
void
printFgfsOutput
();
void
printFgfsError
();
void
setStartupArguments
(
QString
startupArguments
);
void
setBarometerOffset
(
float
barometerOffsetkPa
);
protected:
QString
name
;
...
...
@@ -161,6 +163,7 @@ protected:
unsigned
int
flightGearVersion
;
QString
startupArguments
;
bool
_sensorHilEnabled
;
float
barometerOffsetkPa
;
void
setName
(
QString
name
);
...
...
src/uas/UAS.cc
View file @
87594174
...
...
@@ -2982,7 +2982,7 @@ bool UAS::emergencyKILL()
/**
* If enabled, connect the flight gear link.
*/
void
UAS
::
enableHilFlightGear
(
bool
enable
,
QString
options
,
bool
sensorHil
)
void
UAS
::
enableHilFlightGear
(
bool
enable
,
QString
options
,
bool
sensorHil
,
QObject
*
configuration
)
{
QGCFlightGearLink
*
link
=
dynamic_cast
<
QGCFlightGearLink
*>
(
simulation
);
if
(
!
link
||
!
simulation
)
{
...
...
@@ -2997,6 +2997,7 @@ void UAS::enableHilFlightGear(bool enable, QString options, bool sensorHil)
link
=
dynamic_cast
<
QGCFlightGearLink
*>
(
simulation
);
link
->
setStartupArguments
(
options
);
link
->
sensorHilEnabled
(
sensorHil
);
QObject
::
connect
(
configuration
,
SIGNAL
(
barometerOffsetChanged
(
float
)),
link
,
SLOT
(
setBarometerOffset
(
float
)));
if
(
enable
)
{
startHil
();
...
...
src/uas/UAS.h
View file @
87594174
...
...
@@ -757,7 +757,7 @@ public slots:
void
go
();
/** @brief Enable / disable HIL */
void
enableHilFlightGear
(
bool
enable
,
QString
options
,
bool
sensorHil
);
void
enableHilFlightGear
(
bool
enable
,
QString
options
,
bool
sensorHil
,
QObject
*
configuration
);
void
enableHilJSBSim
(
bool
enable
,
QString
options
);
void
enableHilXPlane
(
bool
enable
);
...
...
src/ui/QGCHilConfiguration.cc
View file @
87594174
...
...
@@ -64,7 +64,7 @@ void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index)
if
(
1
==
index
)
{
// Ensure the sim exists and is disabled
mav
->
enableHilFlightGear
(
false
,
""
,
true
);
mav
->
enableHilFlightGear
(
false
,
""
,
true
,
this
);
QGCHilFlightGearConfiguration
*
hfgconf
=
new
QGCHilFlightGearConfiguration
(
mav
,
this
);
hfgconf
->
show
();
ui
->
simulatorConfigurationLayout
->
addWidget
(
hfgconf
);
...
...
src/ui/QGCHilFlightGearConfiguration.cc
View file @
87594174
...
...
@@ -40,10 +40,16 @@ void QGCHilFlightGearConfiguration::on_startButton_clicked()
//XXX check validity of inputs
QString
options
=
ui
->
optionsPlainTextEdit
->
toPlainText
();
options
.
append
(
" --aircraft="
+
ui
->
aircraftComboBox
->
currentText
());
mav
->
enableHilFlightGear
(
true
,
options
,
ui
->
sensorHilCheckBox
->
isChecked
());
mav
->
enableHilFlightGear
(
true
,
options
,
ui
->
sensorHilCheckBox
->
isChecked
()
,
this
);
}
void
QGCHilFlightGearConfiguration
::
on_stopButton_clicked
()
{
mav
->
stopHil
();
}
void
QGCHilFlightGearConfiguration
::
on_barometerOffsetLineEdit_textChanged
(
const
QString
&
baroOffset
)
{
emit
barometerOffsetChanged
(
baroOffset
.
toFloat
());
}
src/ui/QGCHilFlightGearConfiguration.h
View file @
87594174
...
...
@@ -25,9 +25,13 @@ protected:
private
slots
:
void
on_startButton_clicked
();
void
on_stopButton_clicked
();
void
on_barometerOffsetLineEdit_textChanged
(
const
QString
&
baroOffset
);
private:
Ui
::
QGCHilFlightGearConfiguration
*
ui
;
signals:
void
barometerOffsetChanged
(
float
barometerOffsetkPa
);
};
#endif // QGCHILFLIGHTGEARCONFIGURATION_H
src/ui/QGCHilFlightGearConfiguration.ui
View file @
87594174
...
...
@@ -32,13 +32,6 @@
<property
name=
"spacing"
>
<number>
6
</number>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"aircraftPlaintextInfoLabel"
>
<property
name=
"text"
>
<string>
Airframe:
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
colspan=
"2"
>
<widget
class=
"QComboBox"
name=
"aircraftComboBox"
>
<property
name=
"sizePolicy"
>
...
...
@@ -52,14 +45,21 @@
</property>
</widget>
</item>
<item
row=
"
3
"
column=
"0"
>
<item
row=
"
4
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"optionsLabel"
>
<property
name=
"text"
>
<string>
<
html
><
head/
><
body
><
p
>
Additional Options:
<
/p
><
/body
><
/html
>
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"aircraftPlaintextInfoLabel"
>
<property
name=
"text"
>
<string>
Airframe:
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPlainTextEdit"
name=
"optionsPlainTextEdit"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
...
...
@@ -72,7 +72,7 @@
</property>
</widget>
</item>
<item
row=
"
6
"
column=
"0"
>
<item
row=
"
7
"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"startButton"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
...
...
@@ -85,7 +85,7 @@
</property>
</widget>
</item>
<item
row=
"
6
"
column=
"1"
>
<item
row=
"
7
"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"stopButton"
>
<property
name=
"text"
>
<string>
Stop
</string>
...
...
@@ -102,6 +102,20 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"barometerOffsetLabel"
>
<property
name=
"text"
>
<string>
Barometer Offset [kPa]:
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"barometerOffsetLineEdit"
>
<property
name=
"text"
>
<string>
0
</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
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