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
8a6998d1
Commit
8a6998d1
authored
Oct 27, 2012
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hil tests
parent
73522dd1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
21 deletions
+43
-21
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+1
-0
QGCFlightGearLink.h
src/comm/QGCFlightGearLink.h
+5
-0
QGCHilLink.h
src/comm/QGCHilLink.h
+2
-0
QGCXPlaneLink.cc
src/comm/QGCXPlaneLink.cc
+4
-7
QGCXPlaneLink.h
src/comm/QGCXPlaneLink.h
+1
-1
UAS.cc
src/uas/UAS.cc
+20
-4
QGCHilConfiguration.cc
src/ui/QGCHilConfiguration.cc
+4
-7
QGCHilXPlaneConfiguration.cc
src/ui/QGCHilXPlaneConfiguration.cc
+6
-2
No files found.
src/comm/QGCFlightGearLink.cc
View file @
8a6998d1
...
@@ -42,6 +42,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -42,6 +42,7 @@ This file is part of the QGROUNDCONTROL project
QGCFlightGearLink
::
QGCFlightGearLink
(
UASInterface
*
mav
,
QString
startupArguments
,
QString
remoteHost
,
QHostAddress
host
,
quint16
port
)
:
QGCFlightGearLink
::
QGCFlightGearLink
(
UASInterface
*
mav
,
QString
startupArguments
,
QString
remoteHost
,
QHostAddress
host
,
quint16
port
)
:
process
(
NULL
),
process
(
NULL
),
terraSync
(
NULL
),
terraSync
(
NULL
),
socket
(
NULL
),
startupArguments
(
startupArguments
),
startupArguments
(
startupArguments
),
flightGearVersion
(
0
)
flightGearVersion
(
0
)
{
{
...
...
src/comm/QGCFlightGearLink.h
View file @
8a6998d1
...
@@ -99,6 +99,11 @@ public slots:
...
@@ -99,6 +99,11 @@ public slots:
Q_UNUSED
(
version
);
Q_UNUSED
(
version
);
}
}
void
selectAirframe
(
const
QString
&
airframe
)
{
Q_UNUSED
(
airframe
);
}
void
readBytes
();
void
readBytes
();
/**
/**
* @brief Write a number of bytes to the interface.
* @brief Write a number of bytes to the interface.
...
...
src/comm/QGCHilLink.h
View file @
8a6998d1
...
@@ -48,6 +48,8 @@ public slots:
...
@@ -48,6 +48,8 @@ public slots:
/** @brief Set the simulator version as text string */
/** @brief Set the simulator version as text string */
virtual
void
setVersion
(
const
QString
&
version
)
=
0
;
virtual
void
setVersion
(
const
QString
&
version
)
=
0
;
virtual
void
selectAirframe
(
const
QString
&
airframe
)
=
0
;
virtual
void
readBytes
()
=
0
;
virtual
void
readBytes
()
=
0
;
/**
/**
* @brief Write a number of bytes to the interface.
* @brief Write a number of bytes to the interface.
...
...
src/comm/QGCXPlaneLink.cc
View file @
8a6998d1
...
@@ -75,7 +75,7 @@ void QGCXPlaneLink::loadSettings()
...
@@ -75,7 +75,7 @@ void QGCXPlaneLink::loadSettings()
settings
.
beginGroup
(
"QGC_XPLANE_LINK"
);
settings
.
beginGroup
(
"QGC_XPLANE_LINK"
);
setRemoteHost
(
settings
.
value
(
"REMOTE_HOST"
,
QString
(
"%1:%2"
).
arg
(
remoteHost
.
toString
()).
arg
(
remotePort
)).
toString
());
setRemoteHost
(
settings
.
value
(
"REMOTE_HOST"
,
QString
(
"%1:%2"
).
arg
(
remoteHost
.
toString
()).
arg
(
remotePort
)).
toString
());
setVersion
(
settings
.
value
(
"XPLANE_VERSION"
,
10
).
toInt
());
setVersion
(
settings
.
value
(
"XPLANE_VERSION"
,
10
).
toInt
());
select
Plan
e
(
settings
.
value
(
"AIRFRAME"
,
"default"
).
toString
());
select
Airfram
e
(
settings
.
value
(
"AIRFRAME"
,
"default"
).
toString
());
settings
.
endGroup
();
settings
.
endGroup
();
}
}
...
@@ -182,7 +182,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
...
@@ -182,7 +182,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
if
(
newHost
.
contains
(
":"
))
if
(
newHost
.
contains
(
":"
))
{
{
//qDebug() << "HOST: " << newHost.split(":").first();
QHostInfo
info
=
QHostInfo
::
fromName
(
newHost
.
split
(
":"
).
first
());
QHostInfo
info
=
QHostInfo
::
fromName
(
newHost
.
split
(
":"
).
first
());
if
(
info
.
error
()
==
QHostInfo
::
NoError
)
if
(
info
.
error
()
==
QHostInfo
::
NoError
)
{
{
...
@@ -198,7 +197,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
...
@@ -198,7 +197,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
}
}
}
}
remoteHost
=
address
;
remoteHost
=
address
;
//qDebug() << "Address:" << address.toString();
// Set localPort according to user input
// Set localPort according to user input
remotePort
=
newHost
.
split
(
":"
).
last
().
toInt
();
remotePort
=
newHost
.
split
(
":"
).
last
().
toInt
();
}
}
...
@@ -586,7 +584,7 @@ bool QGCXPlaneLink::disconnectSimulation()
...
@@ -586,7 +584,7 @@ bool QGCXPlaneLink::disconnectSimulation()
return
!
connectState
;
return
!
connectState
;
}
}
void
QGCXPlaneLink
::
select
Plan
e
(
const
QString
&
plane
)
void
QGCXPlaneLink
::
select
Airfram
e
(
const
QString
&
plane
)
{
{
airframeName
=
plane
;
airframeName
=
plane
;
...
@@ -718,6 +716,8 @@ void QGCXPlaneLink::setRandomAttitude()
...
@@ -718,6 +716,8 @@ void QGCXPlaneLink::setRandomAttitude()
bool
QGCXPlaneLink
::
connectSimulation
()
bool
QGCXPlaneLink
::
connectSimulation
()
{
{
qDebug
()
<<
"STARTING X-PLANE LINK, CONNECTING TO"
<<
remoteHost
<<
":"
<<
remotePort
;
qDebug
()
<<
"STARTING X-PLANE LINK, CONNECTING TO"
<<
remoteHost
<<
":"
<<
remotePort
;
// XXX Hack
storeSettings
();
start
(
LowPriority
);
start
(
LowPriority
);
...
@@ -730,9 +730,6 @@ bool QGCXPlaneLink::connectSimulation()
...
@@ -730,9 +730,6 @@ bool QGCXPlaneLink::connectSimulation()
QObject
::
connect
(
socket
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
readBytes
()));
QObject
::
connect
(
socket
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
readBytes
()));
//process = new QProcess(this);
//terraSync = new QProcess(this);
connect
(
mav
,
SIGNAL
(
hilControlsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
uint8_t
,
uint8_t
)),
this
,
SLOT
(
updateControls
(
uint64_t
,
float
,
float
,
float
,
float
,
uint8_t
,
uint8_t
)));
connect
(
mav
,
SIGNAL
(
hilControlsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
uint8_t
,
uint8_t
)),
this
,
SLOT
(
updateControls
(
uint64_t
,
float
,
float
,
float
,
float
,
uint8_t
,
uint8_t
)));
connect
(
mav
,
SIGNAL
(
hilActuatorsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
float
,
float
)),
this
,
SLOT
(
updateActuators
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
float
,
float
)));
connect
(
mav
,
SIGNAL
(
hilActuatorsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
float
,
float
)),
this
,
SLOT
(
updateActuators
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
float
,
float
)));
connect
(
this
,
SIGNAL
(
hilStateChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
int32_t
,
int32_t
,
int32_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
)),
mav
,
SLOT
(
sendHilState
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
int32_t
,
int32_t
,
int32_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
)));
connect
(
this
,
SIGNAL
(
hilStateChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
int32_t
,
int32_t
,
int32_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
)),
mav
,
SLOT
(
sendHilState
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
int32_t
,
int32_t
,
int32_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
)));
...
...
src/comm/QGCXPlaneLink.h
View file @
8a6998d1
...
@@ -130,7 +130,7 @@ public slots:
...
@@ -130,7 +130,7 @@ public slots:
* @brief Select airplane model
* @brief Select airplane model
* @param plane the name of the airplane
* @param plane the name of the airplane
*/
*/
void
select
Plane
(
const
QString
&
plan
e
);
void
select
Airframe
(
const
QString
&
airfram
e
);
/**
/**
* @brief Set the airplane position and attitude
* @brief Set the airplane position and attitude
* @param lat
* @param lat
...
...
src/uas/UAS.cc
View file @
8a6998d1
...
@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
...
@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramManager
(
NULL
),
paramManager
(
NULL
),
attitudeStamped
(
false
),
attitudeStamped
(
false
),
lastAttitude
(
0
),
lastAttitude
(
0
),
simulation
(
new
QGCXPlaneLink
(
this
)
),
simulation
(
0
),
isLocalPositionKnown
(
false
),
isLocalPositionKnown
(
false
),
isGlobalPositionKnown
(
false
),
isGlobalPositionKnown
(
false
),
systemIsArmed
(
false
),
systemIsArmed
(
false
),
...
@@ -2592,10 +2592,18 @@ bool UAS::emergencyKILL()
...
@@ -2592,10 +2592,18 @@ bool UAS::emergencyKILL()
*/
*/
void
UAS
::
enableHilFlightGear
(
bool
enable
,
QString
options
)
void
UAS
::
enableHilFlightGear
(
bool
enable
,
QString
options
)
{
{
QGCFlightGearLink
*
link
=
dynamic_cast
<
QGCFlightGearLink
*>
(
simulation
);
if
(
!
link
||
!
simulation
)
{
// Delete wrong sim
if
(
simulation
)
{
stopHil
();
delete
simulation
;
}
simulation
=
new
QGCFlightGearLink
(
this
,
options
);
}
// Connect Flight Gear Link
// Connect Flight Gear Link
if
(
enable
)
if
(
enable
)
{
{
simulation
=
new
QGCFlightGearLink
(
this
,
options
);
startHil
();
startHil
();
}
}
else
else
...
@@ -2609,10 +2617,18 @@ void UAS::enableHilFlightGear(bool enable, QString options)
...
@@ -2609,10 +2617,18 @@ void UAS::enableHilFlightGear(bool enable, QString options)
*/
*/
void
UAS
::
enableHilXPlane
(
bool
enable
)
void
UAS
::
enableHilXPlane
(
bool
enable
)
{
{
QGCXPlaneLink
*
link
=
dynamic_cast
<
QGCXPlaneLink
*>
(
simulation
);
if
(
!
link
||
!
simulation
)
{
if
(
simulation
)
{
stopHil
();
delete
simulation
;
}
qDebug
()
<<
"CREATED NEW XPLANE LINK"
;
simulation
=
new
QGCXPlaneLink
(
this
);
}
// Connect X-Plane Link
// Connect X-Plane Link
if
(
enable
)
if
(
enable
)
{
{
simulation
=
new
QGCXPlaneLink
(
this
);
startHil
();
startHil
();
}
}
else
else
...
@@ -2680,7 +2696,7 @@ void UAS::startHil()
...
@@ -2680,7 +2696,7 @@ void UAS::startHil()
*/
*/
void
UAS
::
stopHil
()
void
UAS
::
stopHil
()
{
{
simulation
->
disconnectSimulation
();
if
(
simulation
)
simulation
->
disconnectSimulation
();
mavlink_message_t
msg
;
mavlink_message_t
msg
;
mavlink_msg_set_mode_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
this
->
getUASID
(),
mode
&
!
MAV_MODE_FLAG_HIL_ENABLED
,
navMode
);
mavlink_msg_set_mode_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
this
->
getUASID
(),
mode
&
!
MAV_MODE_FLAG_HIL_ENABLED
,
navMode
);
sendMessage
(
msg
);
sendMessage
(
msg
);
...
...
src/ui/QGCHilConfiguration.cc
View file @
8a6998d1
...
@@ -10,12 +10,6 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) :
...
@@ -10,12 +10,6 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) :
ui
(
new
Ui
::
QGCHilConfiguration
)
ui
(
new
Ui
::
QGCHilConfiguration
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
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());
// connect(ui->)
}
}
void
QGCHilConfiguration
::
receiveStatusMessage
(
const
QString
&
message
)
void
QGCHilConfiguration
::
receiveStatusMessage
(
const
QString
&
message
)
...
@@ -30,9 +24,10 @@ QGCHilConfiguration::~QGCHilConfiguration()
...
@@ -30,9 +24,10 @@ QGCHilConfiguration::~QGCHilConfiguration()
void
QGCHilConfiguration
::
on_simComboBox_currentIndexChanged
(
int
index
)
void
QGCHilConfiguration
::
on_simComboBox_currentIndexChanged
(
int
index
)
{
{
//XXX make sure here that no other simulator is running
if
(
1
==
index
)
if
(
1
==
index
)
{
{
// Ensure the sim exists and is disabled
mav
->
enableHilFlightGear
(
false
,
""
);
QGCHilFlightGearConfiguration
*
hfgconf
=
new
QGCHilFlightGearConfiguration
(
mav
,
this
);
QGCHilFlightGearConfiguration
*
hfgconf
=
new
QGCHilFlightGearConfiguration
(
mav
,
this
);
hfgconf
->
show
();
hfgconf
->
show
();
ui
->
simulatorConfigurationDockWidget
->
setWidget
(
hfgconf
);
ui
->
simulatorConfigurationDockWidget
->
setWidget
(
hfgconf
);
...
@@ -40,6 +35,8 @@ void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index)
...
@@ -40,6 +35,8 @@ void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index)
}
}
else
if
(
2
==
index
||
3
==
index
)
else
if
(
2
==
index
||
3
==
index
)
{
{
// Ensure the sim exists and is disabled
mav
->
enableHilXPlane
(
false
);
QGCHilXPlaneConfiguration
*
hxpconf
=
new
QGCHilXPlaneConfiguration
(
mav
->
getHILSimulation
(),
this
);
QGCHilXPlaneConfiguration
*
hxpconf
=
new
QGCHilXPlaneConfiguration
(
mav
->
getHILSimulation
(),
this
);
hxpconf
->
show
();
hxpconf
->
show
();
ui
->
simulatorConfigurationDockWidget
->
setWidget
(
hxpconf
);
ui
->
simulatorConfigurationDockWidget
->
setWidget
(
hxpconf
);
...
...
src/ui/QGCHilXPlaneConfiguration.cc
View file @
8a6998d1
...
@@ -7,11 +7,15 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
...
@@ -7,11 +7,15 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
ui
(
new
Ui
::
QGCHilXPlaneConfiguration
)
ui
(
new
Ui
::
QGCHilXPlaneConfiguration
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
this
->
link
=
link
;
connect
(
ui
->
startButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleSimulation
(
bool
)));
connect
(
ui
->
startButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleSimulation
(
bool
)));
connect
(
ui
->
hostComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setRemoteHost
(
QString
)));
connect
(
ui
->
hostComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setRemoteHost
(
QString
)));
connect
(
link
,
SIGNAL
(
remoteChanged
(
QString
)),
ui
->
hostComboBox
,
SLOT
(
setEditText
(
QString
)));
connect
(
link
,
SIGNAL
(
remoteChanged
(
QString
)),
ui
->
hostComboBox
,
SLOT
(
setEditText
(
QString
)));
connect
(
link
,
SIGNAL
(
statusMessage
(
QString
)),
this
,
SLOT
(
receiveStatusMessage
(
QString
)));
connect
(
link
,
SIGNAL
(
statusMessage
(
QString
)),
parent
,
SLOT
(
receiveStatusMessage
(
QString
)));
// connect(mav->getHILSimulation(), SIGNAL(statusMessage(QString)), this, SLOT(receiveStatusMessage(QString)));
// connect(ui->simComboBox, SIGNAL(activated(QString)), mav->getHILSimulation(), SLOT(setVersion(QString)));
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
...
@@ -21,7 +25,7 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
...
@@ -21,7 +25,7 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
{
{
connect
(
ui
->
randomAttitudeButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomAttitude
()));
connect
(
ui
->
randomAttitudeButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomAttitude
()));
connect
(
ui
->
randomPositionButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomPosition
()));
connect
(
ui
->
randomPositionButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomPosition
()));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setAirframe
(
QString
)));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
se
lec
tAirframe
(
QString
)));
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
}
}
...
...
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